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.

25593 lines
681KB

  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 z
  1075. Set numerator/zeros coefficients.
  1076. @item p
  1077. Set denominator/poles coefficients.
  1078. @item k
  1079. Set channels gains.
  1080. @item dry_gain
  1081. Set input gain.
  1082. @item wet_gain
  1083. Set output gain.
  1084. @item 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 r
  1097. Set kind of processing.
  1098. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1099. @item 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 mix
  1112. How much to use filtered signal in output. Default is 1.
  1113. Range is between 0 and 1.
  1114. @item response
  1115. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1116. By default it is disabled.
  1117. @item channel
  1118. Set for which IR channel to display frequency response. By default is first channel
  1119. displayed. This option is used only when @var{response} is enabled.
  1120. @item size
  1121. Set video stream size. This option is used only when @var{response} is enabled.
  1122. @end table
  1123. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1124. order.
  1125. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1126. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1127. imaginary unit.
  1128. Different coefficients and gains can be provided for every channel, in such case
  1129. use '|' to separate coefficients or gains. Last provided coefficients will be
  1130. used for all remaining channels.
  1131. @subsection Examples
  1132. @itemize
  1133. @item
  1134. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1135. @example
  1136. 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
  1137. @end example
  1138. @item
  1139. Same as above but in @code{zp} format:
  1140. @example
  1141. 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
  1142. @end example
  1143. @end itemize
  1144. @section alimiter
  1145. The limiter prevents an input signal from rising over a desired threshold.
  1146. This limiter uses lookahead technology to prevent your signal from distorting.
  1147. It means that there is a small delay after the signal is processed. Keep in mind
  1148. that the delay it produces is the attack time you set.
  1149. The filter accepts the following options:
  1150. @table @option
  1151. @item level_in
  1152. Set input gain. Default is 1.
  1153. @item level_out
  1154. Set output gain. Default is 1.
  1155. @item limit
  1156. Don't let signals above this level pass the limiter. Default is 1.
  1157. @item attack
  1158. The limiter will reach its attenuation level in this amount of time in
  1159. milliseconds. Default is 5 milliseconds.
  1160. @item release
  1161. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1162. Default is 50 milliseconds.
  1163. @item asc
  1164. When gain reduction is always needed ASC takes care of releasing to an
  1165. average reduction level rather than reaching a reduction of 0 in the release
  1166. time.
  1167. @item asc_level
  1168. Select how much the release time is affected by ASC, 0 means nearly no changes
  1169. in release time while 1 produces higher release times.
  1170. @item level
  1171. Auto level output signal. Default is enabled.
  1172. This normalizes audio back to 0dB if enabled.
  1173. @end table
  1174. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1175. with @ref{aresample} before applying this filter.
  1176. @section allpass
  1177. Apply a two-pole all-pass filter with central frequency (in Hz)
  1178. @var{frequency}, and filter-width @var{width}.
  1179. An all-pass filter changes the audio's frequency to phase relationship
  1180. without changing its frequency to amplitude relationship.
  1181. The filter accepts the following options:
  1182. @table @option
  1183. @item frequency, f
  1184. Set frequency in Hz.
  1185. @item width_type, t
  1186. Set method to specify band-width of filter.
  1187. @table @option
  1188. @item h
  1189. Hz
  1190. @item q
  1191. Q-Factor
  1192. @item o
  1193. octave
  1194. @item s
  1195. slope
  1196. @item k
  1197. kHz
  1198. @end table
  1199. @item width, w
  1200. Specify the band-width of a filter in width_type units.
  1201. @item mix, m
  1202. How much to use filtered signal in output. Default is 1.
  1203. Range is between 0 and 1.
  1204. @item channels, c
  1205. Specify which channels to filter, by default all available are filtered.
  1206. @item normalize, n
  1207. Normalize biquad coefficients, by default is disabled.
  1208. Enabling it will normalize magnitude response at DC to 0dB.
  1209. @end table
  1210. @subsection Commands
  1211. This filter supports the following commands:
  1212. @table @option
  1213. @item frequency, f
  1214. Change allpass frequency.
  1215. Syntax for the command is : "@var{frequency}"
  1216. @item width_type, t
  1217. Change allpass width_type.
  1218. Syntax for the command is : "@var{width_type}"
  1219. @item width, w
  1220. Change allpass width.
  1221. Syntax for the command is : "@var{width}"
  1222. @item mix, m
  1223. Change allpass mix.
  1224. Syntax for the command is : "@var{mix}"
  1225. @end table
  1226. @section aloop
  1227. Loop audio samples.
  1228. The filter accepts the following options:
  1229. @table @option
  1230. @item loop
  1231. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1232. Default is 0.
  1233. @item size
  1234. Set maximal number of samples. Default is 0.
  1235. @item start
  1236. Set first sample of loop. Default is 0.
  1237. @end table
  1238. @anchor{amerge}
  1239. @section amerge
  1240. Merge two or more audio streams into a single multi-channel stream.
  1241. The filter accepts the following options:
  1242. @table @option
  1243. @item inputs
  1244. Set the number of inputs. Default is 2.
  1245. @end table
  1246. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1247. the channel layout of the output will be set accordingly and the channels
  1248. will be reordered as necessary. If the channel layouts of the inputs are not
  1249. disjoint, the output will have all the channels of the first input then all
  1250. the channels of the second input, in that order, and the channel layout of
  1251. the output will be the default value corresponding to the total number of
  1252. channels.
  1253. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1254. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1255. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1256. first input, b1 is the first channel of the second input).
  1257. On the other hand, if both input are in stereo, the output channels will be
  1258. in the default order: a1, a2, b1, b2, and the channel layout will be
  1259. arbitrarily set to 4.0, which may or may not be the expected value.
  1260. All inputs must have the same sample rate, and format.
  1261. If inputs do not have the same duration, the output will stop with the
  1262. shortest.
  1263. @subsection Examples
  1264. @itemize
  1265. @item
  1266. Merge two mono files into a stereo stream:
  1267. @example
  1268. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1269. @end example
  1270. @item
  1271. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1272. @example
  1273. 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
  1274. @end example
  1275. @end itemize
  1276. @section amix
  1277. Mixes multiple audio inputs into a single output.
  1278. Note that this filter only supports float samples (the @var{amerge}
  1279. and @var{pan} audio filters support many formats). If the @var{amix}
  1280. input has integer samples then @ref{aresample} will be automatically
  1281. inserted to perform the conversion to float samples.
  1282. For example
  1283. @example
  1284. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1285. @end example
  1286. will mix 3 input audio streams to a single output with the same duration as the
  1287. first input and a dropout transition time of 3 seconds.
  1288. It accepts the following parameters:
  1289. @table @option
  1290. @item inputs
  1291. The number of inputs. If unspecified, it defaults to 2.
  1292. @item duration
  1293. How to determine the end-of-stream.
  1294. @table @option
  1295. @item longest
  1296. The duration of the longest input. (default)
  1297. @item shortest
  1298. The duration of the shortest input.
  1299. @item first
  1300. The duration of the first input.
  1301. @end table
  1302. @item dropout_transition
  1303. The transition time, in seconds, for volume renormalization when an input
  1304. stream ends. The default value is 2 seconds.
  1305. @item weights
  1306. Specify weight of each input audio stream as sequence.
  1307. Each weight is separated by space. By default all inputs have same weight.
  1308. @end table
  1309. @subsection Commands
  1310. This filter supports the following commands:
  1311. @table @option
  1312. @item weights
  1313. Syntax is same as option with same name.
  1314. @end table
  1315. @section amultiply
  1316. Multiply first audio stream with second audio stream and store result
  1317. in output audio stream. Multiplication is done by multiplying each
  1318. sample from first stream with sample at same position from second stream.
  1319. With this element-wise multiplication one can create amplitude fades and
  1320. amplitude modulations.
  1321. @section anequalizer
  1322. High-order parametric multiband equalizer for each channel.
  1323. It accepts the following parameters:
  1324. @table @option
  1325. @item params
  1326. This option string is in format:
  1327. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1328. Each equalizer band is separated by '|'.
  1329. @table @option
  1330. @item chn
  1331. Set channel number to which equalization will be applied.
  1332. If input doesn't have that channel the entry is ignored.
  1333. @item f
  1334. Set central frequency for band.
  1335. If input doesn't have that frequency the entry is ignored.
  1336. @item w
  1337. Set band width in hertz.
  1338. @item g
  1339. Set band gain in dB.
  1340. @item t
  1341. Set filter type for band, optional, can be:
  1342. @table @samp
  1343. @item 0
  1344. Butterworth, this is default.
  1345. @item 1
  1346. Chebyshev type 1.
  1347. @item 2
  1348. Chebyshev type 2.
  1349. @end table
  1350. @end table
  1351. @item curves
  1352. With this option activated frequency response of anequalizer is displayed
  1353. in video stream.
  1354. @item size
  1355. Set video stream size. Only useful if curves option is activated.
  1356. @item mgain
  1357. Set max gain that will be displayed. Only useful if curves option is activated.
  1358. Setting this to a reasonable value makes it possible to display gain which is derived from
  1359. neighbour bands which are too close to each other and thus produce higher gain
  1360. when both are activated.
  1361. @item fscale
  1362. Set frequency scale used to draw frequency response in video output.
  1363. Can be linear or logarithmic. Default is logarithmic.
  1364. @item colors
  1365. Set color for each channel curve which is going to be displayed in video stream.
  1366. This is list of color names separated by space or by '|'.
  1367. Unrecognised or missing colors will be replaced by white color.
  1368. @end table
  1369. @subsection Examples
  1370. @itemize
  1371. @item
  1372. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1373. for first 2 channels using Chebyshev type 1 filter:
  1374. @example
  1375. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1376. @end example
  1377. @end itemize
  1378. @subsection Commands
  1379. This filter supports the following commands:
  1380. @table @option
  1381. @item change
  1382. Alter existing filter parameters.
  1383. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1384. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1385. error is returned.
  1386. @var{freq} set new frequency parameter.
  1387. @var{width} set new width parameter in herz.
  1388. @var{gain} set new gain parameter in dB.
  1389. Full filter invocation with asendcmd may look like this:
  1390. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1391. @end table
  1392. @section anlmdn
  1393. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1394. Each sample is adjusted by looking for other samples with similar contexts. This
  1395. context similarity is defined by comparing their surrounding patches of size
  1396. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1397. The filter accepts the following options:
  1398. @table @option
  1399. @item s
  1400. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1401. @item p
  1402. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1403. Default value is 2 milliseconds.
  1404. @item r
  1405. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1406. Default value is 6 milliseconds.
  1407. @item o
  1408. Set the output mode.
  1409. It accepts the following values:
  1410. @table @option
  1411. @item i
  1412. Pass input unchanged.
  1413. @item o
  1414. Pass noise filtered out.
  1415. @item n
  1416. Pass only noise.
  1417. Default value is @var{o}.
  1418. @end table
  1419. @item m
  1420. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1421. @end table
  1422. @subsection Commands
  1423. This filter supports the following commands:
  1424. @table @option
  1425. @item s
  1426. Change denoise strength. Argument is single float number.
  1427. Syntax for the command is : "@var{s}"
  1428. @item o
  1429. Change output mode.
  1430. Syntax for the command is : "i", "o" or "n" string.
  1431. @end table
  1432. @section anlms
  1433. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1434. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1435. relate to producing the least mean square of the error signal (difference between the desired,
  1436. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1437. A description of the accepted options follows.
  1438. @table @option
  1439. @item order
  1440. Set filter order.
  1441. @item mu
  1442. Set filter mu.
  1443. @item eps
  1444. Set the filter eps.
  1445. @item leakage
  1446. Set the filter leakage.
  1447. @item out_mode
  1448. It accepts the following values:
  1449. @table @option
  1450. @item i
  1451. Pass the 1st input.
  1452. @item d
  1453. Pass the 2nd input.
  1454. @item o
  1455. Pass filtered samples.
  1456. @item n
  1457. Pass difference between desired and filtered samples.
  1458. Default value is @var{o}.
  1459. @end table
  1460. @end table
  1461. @subsection Examples
  1462. @itemize
  1463. @item
  1464. One of many usages of this filter is noise reduction, input audio is filtered
  1465. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1466. @example
  1467. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1468. @end example
  1469. @end itemize
  1470. @subsection Commands
  1471. This filter supports the same commands as options, excluding option @code{order}.
  1472. @section anull
  1473. Pass the audio source unchanged to the output.
  1474. @section apad
  1475. Pad the end of an audio stream with silence.
  1476. This can be used together with @command{ffmpeg} @option{-shortest} to
  1477. extend audio streams to the same length as the video stream.
  1478. A description of the accepted options follows.
  1479. @table @option
  1480. @item packet_size
  1481. Set silence packet size. Default value is 4096.
  1482. @item pad_len
  1483. Set the number of samples of silence to add to the end. After the
  1484. value is reached, the stream is terminated. This option is mutually
  1485. exclusive with @option{whole_len}.
  1486. @item whole_len
  1487. Set the minimum total number of samples in the output audio stream. If
  1488. the value is longer than the input audio length, silence is added to
  1489. the end, until the value is reached. This option is mutually exclusive
  1490. with @option{pad_len}.
  1491. @item pad_dur
  1492. Specify the duration of samples of silence to add. See
  1493. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1494. for the accepted syntax. Used only if set to non-zero value.
  1495. @item whole_dur
  1496. Specify the minimum total duration in the output audio stream. See
  1497. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1498. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1499. the input audio length, silence is added to the end, until the value is reached.
  1500. This option is mutually exclusive with @option{pad_dur}
  1501. @end table
  1502. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1503. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1504. the input stream indefinitely.
  1505. @subsection Examples
  1506. @itemize
  1507. @item
  1508. Add 1024 samples of silence to the end of the input:
  1509. @example
  1510. apad=pad_len=1024
  1511. @end example
  1512. @item
  1513. Make sure the audio output will contain at least 10000 samples, pad
  1514. the input with silence if required:
  1515. @example
  1516. apad=whole_len=10000
  1517. @end example
  1518. @item
  1519. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1520. video stream will always result the shortest and will be converted
  1521. until the end in the output file when using the @option{shortest}
  1522. option:
  1523. @example
  1524. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1525. @end example
  1526. @end itemize
  1527. @section aphaser
  1528. Add a phasing effect to the input audio.
  1529. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1530. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1531. A description of the accepted parameters follows.
  1532. @table @option
  1533. @item in_gain
  1534. Set input gain. Default is 0.4.
  1535. @item out_gain
  1536. Set output gain. Default is 0.74
  1537. @item delay
  1538. Set delay in milliseconds. Default is 3.0.
  1539. @item decay
  1540. Set decay. Default is 0.4.
  1541. @item speed
  1542. Set modulation speed in Hz. Default is 0.5.
  1543. @item type
  1544. Set modulation type. Default is triangular.
  1545. It accepts the following values:
  1546. @table @samp
  1547. @item triangular, t
  1548. @item sinusoidal, s
  1549. @end table
  1550. @end table
  1551. @section apulsator
  1552. Audio pulsator is something between an autopanner and a tremolo.
  1553. But it can produce funny stereo effects as well. Pulsator changes the volume
  1554. of the left and right channel based on a LFO (low frequency oscillator) with
  1555. different waveforms and shifted phases.
  1556. This filter have the ability to define an offset between left and right
  1557. channel. An offset of 0 means that both LFO shapes match each other.
  1558. The left and right channel are altered equally - a conventional tremolo.
  1559. An offset of 50% means that the shape of the right channel is exactly shifted
  1560. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1561. an autopanner. At 1 both curves match again. Every setting in between moves the
  1562. phase shift gapless between all stages and produces some "bypassing" sounds with
  1563. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1564. the 0.5) the faster the signal passes from the left to the right speaker.
  1565. The filter accepts the following options:
  1566. @table @option
  1567. @item level_in
  1568. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1569. @item level_out
  1570. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1571. @item mode
  1572. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1573. sawup or sawdown. Default is sine.
  1574. @item amount
  1575. Set modulation. Define how much of original signal is affected by the LFO.
  1576. @item offset_l
  1577. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1578. @item offset_r
  1579. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1580. @item width
  1581. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1582. @item timing
  1583. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1584. @item bpm
  1585. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1586. is set to bpm.
  1587. @item ms
  1588. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1589. is set to ms.
  1590. @item hz
  1591. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1592. if timing is set to hz.
  1593. @end table
  1594. @anchor{aresample}
  1595. @section aresample
  1596. Resample the input audio to the specified parameters, using the
  1597. libswresample library. If none are specified then the filter will
  1598. automatically convert between its input and output.
  1599. This filter is also able to stretch/squeeze the audio data to make it match
  1600. the timestamps or to inject silence / cut out audio to make it match the
  1601. timestamps, do a combination of both or do neither.
  1602. The filter accepts the syntax
  1603. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1604. expresses a sample rate and @var{resampler_options} is a list of
  1605. @var{key}=@var{value} pairs, separated by ":". See the
  1606. @ref{Resampler Options,,"Resampler Options" section in the
  1607. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1608. for the complete list of supported options.
  1609. @subsection Examples
  1610. @itemize
  1611. @item
  1612. Resample the input audio to 44100Hz:
  1613. @example
  1614. aresample=44100
  1615. @end example
  1616. @item
  1617. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1618. samples per second compensation:
  1619. @example
  1620. aresample=async=1000
  1621. @end example
  1622. @end itemize
  1623. @section areverse
  1624. Reverse an audio clip.
  1625. Warning: This filter requires memory to buffer the entire clip, so trimming
  1626. is suggested.
  1627. @subsection Examples
  1628. @itemize
  1629. @item
  1630. Take the first 5 seconds of a clip, and reverse it.
  1631. @example
  1632. atrim=end=5,areverse
  1633. @end example
  1634. @end itemize
  1635. @section arnndn
  1636. Reduce noise from speech using Recurrent Neural Networks.
  1637. This filter accepts the following options:
  1638. @table @option
  1639. @item model, m
  1640. Set train model file to load. This option is always required.
  1641. @end table
  1642. @section asetnsamples
  1643. Set the number of samples per each output audio frame.
  1644. The last output packet may contain a different number of samples, as
  1645. the filter will flush all the remaining samples when the input audio
  1646. signals its end.
  1647. The filter accepts the following options:
  1648. @table @option
  1649. @item nb_out_samples, n
  1650. Set the number of frames per each output audio frame. The number is
  1651. intended as the number of samples @emph{per each channel}.
  1652. Default value is 1024.
  1653. @item pad, p
  1654. If set to 1, the filter will pad the last audio frame with zeroes, so
  1655. that the last frame will contain the same number of samples as the
  1656. previous ones. Default value is 1.
  1657. @end table
  1658. For example, to set the number of per-frame samples to 1234 and
  1659. disable padding for the last frame, use:
  1660. @example
  1661. asetnsamples=n=1234:p=0
  1662. @end example
  1663. @section asetrate
  1664. Set the sample rate without altering the PCM data.
  1665. This will result in a change of speed and pitch.
  1666. The filter accepts the following options:
  1667. @table @option
  1668. @item sample_rate, r
  1669. Set the output sample rate. Default is 44100 Hz.
  1670. @end table
  1671. @section ashowinfo
  1672. Show a line containing various information for each input audio frame.
  1673. The input audio is not modified.
  1674. The shown line contains a sequence of key/value pairs of the form
  1675. @var{key}:@var{value}.
  1676. The following values are shown in the output:
  1677. @table @option
  1678. @item n
  1679. The (sequential) number of the input frame, starting from 0.
  1680. @item pts
  1681. The presentation timestamp of the input frame, in time base units; the time base
  1682. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1683. @item pts_time
  1684. The presentation timestamp of the input frame in seconds.
  1685. @item pos
  1686. position of the frame in the input stream, -1 if this information in
  1687. unavailable and/or meaningless (for example in case of synthetic audio)
  1688. @item fmt
  1689. The sample format.
  1690. @item chlayout
  1691. The channel layout.
  1692. @item rate
  1693. The sample rate for the audio frame.
  1694. @item nb_samples
  1695. The number of samples (per channel) in the frame.
  1696. @item checksum
  1697. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1698. audio, the data is treated as if all the planes were concatenated.
  1699. @item plane_checksums
  1700. A list of Adler-32 checksums for each data plane.
  1701. @end table
  1702. @section asoftclip
  1703. Apply audio soft clipping.
  1704. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1705. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1706. This filter accepts the following options:
  1707. @table @option
  1708. @item type
  1709. Set type of soft-clipping.
  1710. It accepts the following values:
  1711. @table @option
  1712. @item tanh
  1713. @item atan
  1714. @item cubic
  1715. @item exp
  1716. @item alg
  1717. @item quintic
  1718. @item sin
  1719. @end table
  1720. @item param
  1721. Set additional parameter which controls sigmoid function.
  1722. @end table
  1723. @subsection Commands
  1724. This filter supports the all above options as @ref{commands}.
  1725. @section asr
  1726. Automatic Speech Recognition
  1727. This filter uses PocketSphinx for speech recognition. To enable
  1728. compilation of this filter, you need to configure FFmpeg with
  1729. @code{--enable-pocketsphinx}.
  1730. It accepts the following options:
  1731. @table @option
  1732. @item rate
  1733. Set sampling rate of input audio. Defaults is @code{16000}.
  1734. This need to match speech models, otherwise one will get poor results.
  1735. @item hmm
  1736. Set dictionary containing acoustic model files.
  1737. @item dict
  1738. Set pronunciation dictionary.
  1739. @item lm
  1740. Set language model file.
  1741. @item lmctl
  1742. Set language model set.
  1743. @item lmname
  1744. Set which language model to use.
  1745. @item logfn
  1746. Set output for log messages.
  1747. @end table
  1748. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1749. @anchor{astats}
  1750. @section astats
  1751. Display time domain statistical information about the audio channels.
  1752. Statistics are calculated and displayed for each audio channel and,
  1753. where applicable, an overall figure is also given.
  1754. It accepts the following option:
  1755. @table @option
  1756. @item length
  1757. Short window length in seconds, used for peak and trough RMS measurement.
  1758. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1759. @item metadata
  1760. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1761. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1762. disabled.
  1763. Available keys for each channel are:
  1764. DC_offset
  1765. Min_level
  1766. Max_level
  1767. Min_difference
  1768. Max_difference
  1769. Mean_difference
  1770. RMS_difference
  1771. Peak_level
  1772. RMS_peak
  1773. RMS_trough
  1774. Crest_factor
  1775. Flat_factor
  1776. Peak_count
  1777. Noise_floor
  1778. Noise_floor_count
  1779. Bit_depth
  1780. Dynamic_range
  1781. Zero_crossings
  1782. Zero_crossings_rate
  1783. Number_of_NaNs
  1784. Number_of_Infs
  1785. Number_of_denormals
  1786. and for Overall:
  1787. DC_offset
  1788. Min_level
  1789. Max_level
  1790. Min_difference
  1791. Max_difference
  1792. Mean_difference
  1793. RMS_difference
  1794. Peak_level
  1795. RMS_level
  1796. RMS_peak
  1797. RMS_trough
  1798. Flat_factor
  1799. Peak_count
  1800. Noise_floor
  1801. Noise_floor_count
  1802. Bit_depth
  1803. Number_of_samples
  1804. Number_of_NaNs
  1805. Number_of_Infs
  1806. Number_of_denormals
  1807. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1808. this @code{lavfi.astats.Overall.Peak_count}.
  1809. For description what each key means read below.
  1810. @item reset
  1811. Set number of frame after which stats are going to be recalculated.
  1812. Default is disabled.
  1813. @item measure_perchannel
  1814. Select the entries which need to be measured per channel. The metadata keys can
  1815. be used as flags, default is @option{all} which measures everything.
  1816. @option{none} disables all per channel measurement.
  1817. @item measure_overall
  1818. Select the entries which need to be measured overall. The metadata keys can
  1819. be used as flags, default is @option{all} which measures everything.
  1820. @option{none} disables all overall measurement.
  1821. @end table
  1822. A description of each shown parameter follows:
  1823. @table @option
  1824. @item DC offset
  1825. Mean amplitude displacement from zero.
  1826. @item Min level
  1827. Minimal sample level.
  1828. @item Max level
  1829. Maximal sample level.
  1830. @item Min difference
  1831. Minimal difference between two consecutive samples.
  1832. @item Max difference
  1833. Maximal difference between two consecutive samples.
  1834. @item Mean difference
  1835. Mean difference between two consecutive samples.
  1836. The average of each difference between two consecutive samples.
  1837. @item RMS difference
  1838. Root Mean Square difference between two consecutive samples.
  1839. @item Peak level dB
  1840. @item RMS level dB
  1841. Standard peak and RMS level measured in dBFS.
  1842. @item RMS peak dB
  1843. @item RMS trough dB
  1844. Peak and trough values for RMS level measured over a short window.
  1845. @item Crest factor
  1846. Standard ratio of peak to RMS level (note: not in dB).
  1847. @item Flat factor
  1848. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1849. (i.e. either @var{Min level} or @var{Max level}).
  1850. @item Peak count
  1851. Number of occasions (not the number of samples) that the signal attained either
  1852. @var{Min level} or @var{Max level}.
  1853. @item Noise floor dB
  1854. Minimum local peak measured in dBFS over a short window.
  1855. @item Noise floor count
  1856. Number of occasions (not the number of samples) that the signal attained
  1857. @var{Noise floor}.
  1858. @item Bit depth
  1859. Overall bit depth of audio. Number of bits used for each sample.
  1860. @item Dynamic range
  1861. Measured dynamic range of audio in dB.
  1862. @item Zero crossings
  1863. Number of points where the waveform crosses the zero level axis.
  1864. @item Zero crossings rate
  1865. Rate of Zero crossings and number of audio samples.
  1866. @end table
  1867. @section asubboost
  1868. Boost subwoofer frequencies.
  1869. The filter accepts the following options:
  1870. @table @option
  1871. @item dry
  1872. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  1873. Default value is 0.5.
  1874. @item wet
  1875. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  1876. Default value is 0.8.
  1877. @item decay
  1878. Set delay line decay gain value. Allowed range is from 0 to 1.
  1879. Default value is 0.7.
  1880. @item feedback
  1881. Set delay line feedback gain value. Allowed range is from 0 to 1.
  1882. Default value is 0.5.
  1883. @item cutoff
  1884. Set cutoff frequency in herz. Allowed range is 50 to 900.
  1885. Default value is 100.
  1886. @item slope
  1887. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  1888. Default value is 0.5.
  1889. @item delay
  1890. Set delay. Allowed range is from 1 to 100.
  1891. Default value is 20.
  1892. @end table
  1893. @subsection Commands
  1894. This filter supports the all above options as @ref{commands}.
  1895. @section atempo
  1896. Adjust audio tempo.
  1897. The filter accepts exactly one parameter, the audio tempo. If not
  1898. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1899. be in the [0.5, 100.0] range.
  1900. Note that tempo greater than 2 will skip some samples rather than
  1901. blend them in. If for any reason this is a concern it is always
  1902. possible to daisy-chain several instances of atempo to achieve the
  1903. desired product tempo.
  1904. @subsection Examples
  1905. @itemize
  1906. @item
  1907. Slow down audio to 80% tempo:
  1908. @example
  1909. atempo=0.8
  1910. @end example
  1911. @item
  1912. To speed up audio to 300% tempo:
  1913. @example
  1914. atempo=3
  1915. @end example
  1916. @item
  1917. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1918. @example
  1919. atempo=sqrt(3),atempo=sqrt(3)
  1920. @end example
  1921. @end itemize
  1922. @subsection Commands
  1923. This filter supports the following commands:
  1924. @table @option
  1925. @item tempo
  1926. Change filter tempo scale factor.
  1927. Syntax for the command is : "@var{tempo}"
  1928. @end table
  1929. @section atrim
  1930. Trim the input so that the output contains one continuous subpart of the input.
  1931. It accepts the following parameters:
  1932. @table @option
  1933. @item start
  1934. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1935. sample with the timestamp @var{start} will be the first sample in the output.
  1936. @item end
  1937. Specify time of the first audio sample that will be dropped, i.e. the
  1938. audio sample immediately preceding the one with the timestamp @var{end} will be
  1939. the last sample in the output.
  1940. @item start_pts
  1941. Same as @var{start}, except this option sets the start timestamp in samples
  1942. instead of seconds.
  1943. @item end_pts
  1944. Same as @var{end}, except this option sets the end timestamp in samples instead
  1945. of seconds.
  1946. @item duration
  1947. The maximum duration of the output in seconds.
  1948. @item start_sample
  1949. The number of the first sample that should be output.
  1950. @item end_sample
  1951. The number of the first sample that should be dropped.
  1952. @end table
  1953. @option{start}, @option{end}, and @option{duration} are expressed as time
  1954. duration specifications; see
  1955. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1956. Note that the first two sets of the start/end options and the @option{duration}
  1957. option look at the frame timestamp, while the _sample options simply count the
  1958. samples that pass through the filter. So start/end_pts and start/end_sample will
  1959. give different results when the timestamps are wrong, inexact or do not start at
  1960. zero. Also note that this filter does not modify the timestamps. If you wish
  1961. to have the output timestamps start at zero, insert the asetpts filter after the
  1962. atrim filter.
  1963. If multiple start or end options are set, this filter tries to be greedy and
  1964. keep all samples that match at least one of the specified constraints. To keep
  1965. only the part that matches all the constraints at once, chain multiple atrim
  1966. filters.
  1967. The defaults are such that all the input is kept. So it is possible to set e.g.
  1968. just the end values to keep everything before the specified time.
  1969. Examples:
  1970. @itemize
  1971. @item
  1972. Drop everything except the second minute of input:
  1973. @example
  1974. ffmpeg -i INPUT -af atrim=60:120
  1975. @end example
  1976. @item
  1977. Keep only the first 1000 samples:
  1978. @example
  1979. ffmpeg -i INPUT -af atrim=end_sample=1000
  1980. @end example
  1981. @end itemize
  1982. @section axcorrelate
  1983. Calculate normalized cross-correlation between two input audio streams.
  1984. Resulted samples are always between -1 and 1 inclusive.
  1985. If result is 1 it means two input samples are highly correlated in that selected segment.
  1986. Result 0 means they are not correlated at all.
  1987. If result is -1 it means two input samples are out of phase, which means they cancel each
  1988. other.
  1989. The filter accepts the following options:
  1990. @table @option
  1991. @item size
  1992. Set size of segment over which cross-correlation is calculated.
  1993. Default is 256. Allowed range is from 2 to 131072.
  1994. @item algo
  1995. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  1996. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  1997. are always zero and thus need much less calculations to make.
  1998. This is generally not true, but is valid for typical audio streams.
  1999. @end table
  2000. @subsection Examples
  2001. @itemize
  2002. @item
  2003. Calculate correlation between channels in stereo audio stream:
  2004. @example
  2005. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2006. @end example
  2007. @end itemize
  2008. @section bandpass
  2009. Apply a two-pole Butterworth band-pass filter with central
  2010. frequency @var{frequency}, and (3dB-point) band-width width.
  2011. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2012. instead of the default: constant 0dB peak gain.
  2013. The filter roll off at 6dB per octave (20dB per decade).
  2014. The filter accepts the following options:
  2015. @table @option
  2016. @item frequency, f
  2017. Set the filter's central frequency. Default is @code{3000}.
  2018. @item csg
  2019. Constant skirt gain if set to 1. Defaults to 0.
  2020. @item width_type, t
  2021. Set method to specify band-width of filter.
  2022. @table @option
  2023. @item h
  2024. Hz
  2025. @item q
  2026. Q-Factor
  2027. @item o
  2028. octave
  2029. @item s
  2030. slope
  2031. @item k
  2032. kHz
  2033. @end table
  2034. @item width, w
  2035. Specify the band-width of a filter in width_type units.
  2036. @item mix, m
  2037. How much to use filtered signal in output. Default is 1.
  2038. Range is between 0 and 1.
  2039. @item channels, c
  2040. Specify which channels to filter, by default all available are filtered.
  2041. @item normalize, n
  2042. Normalize biquad coefficients, by default is disabled.
  2043. Enabling it will normalize magnitude response at DC to 0dB.
  2044. @end table
  2045. @subsection Commands
  2046. This filter supports the following commands:
  2047. @table @option
  2048. @item frequency, f
  2049. Change bandpass frequency.
  2050. Syntax for the command is : "@var{frequency}"
  2051. @item width_type, t
  2052. Change bandpass width_type.
  2053. Syntax for the command is : "@var{width_type}"
  2054. @item width, w
  2055. Change bandpass width.
  2056. Syntax for the command is : "@var{width}"
  2057. @item mix, m
  2058. Change bandpass mix.
  2059. Syntax for the command is : "@var{mix}"
  2060. @end table
  2061. @section bandreject
  2062. Apply a two-pole Butterworth band-reject filter with central
  2063. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2064. The filter roll off at 6dB per octave (20dB per decade).
  2065. The filter accepts the following options:
  2066. @table @option
  2067. @item frequency, f
  2068. Set the filter's central frequency. Default is @code{3000}.
  2069. @item width_type, t
  2070. Set method to specify band-width of filter.
  2071. @table @option
  2072. @item h
  2073. Hz
  2074. @item q
  2075. Q-Factor
  2076. @item o
  2077. octave
  2078. @item s
  2079. slope
  2080. @item k
  2081. kHz
  2082. @end table
  2083. @item width, w
  2084. Specify the band-width of a filter in width_type units.
  2085. @item mix, m
  2086. How much to use filtered signal in output. Default is 1.
  2087. Range is between 0 and 1.
  2088. @item channels, c
  2089. Specify which channels to filter, by default all available are filtered.
  2090. @item normalize, n
  2091. Normalize biquad coefficients, by default is disabled.
  2092. Enabling it will normalize magnitude response at DC to 0dB.
  2093. @end table
  2094. @subsection Commands
  2095. This filter supports the following commands:
  2096. @table @option
  2097. @item frequency, f
  2098. Change bandreject frequency.
  2099. Syntax for the command is : "@var{frequency}"
  2100. @item width_type, t
  2101. Change bandreject width_type.
  2102. Syntax for the command is : "@var{width_type}"
  2103. @item width, w
  2104. Change bandreject width.
  2105. Syntax for the command is : "@var{width}"
  2106. @item mix, m
  2107. Change bandreject mix.
  2108. Syntax for the command is : "@var{mix}"
  2109. @end table
  2110. @section bass, lowshelf
  2111. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2112. shelving filter with a response similar to that of a standard
  2113. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2114. The filter accepts the following options:
  2115. @table @option
  2116. @item gain, g
  2117. Give the gain at 0 Hz. Its useful range is about -20
  2118. (for a large cut) to +20 (for a large boost).
  2119. Beware of clipping when using a positive gain.
  2120. @item frequency, f
  2121. Set the filter's central frequency and so can be used
  2122. to extend or reduce the frequency range to be boosted or cut.
  2123. The default value is @code{100} Hz.
  2124. @item width_type, t
  2125. Set method to specify band-width of filter.
  2126. @table @option
  2127. @item h
  2128. Hz
  2129. @item q
  2130. Q-Factor
  2131. @item o
  2132. octave
  2133. @item s
  2134. slope
  2135. @item k
  2136. kHz
  2137. @end table
  2138. @item width, w
  2139. Determine how steep is the filter's shelf transition.
  2140. @item mix, m
  2141. How much to use filtered signal in output. Default is 1.
  2142. Range is between 0 and 1.
  2143. @item channels, c
  2144. Specify which channels to filter, by default all available are filtered.
  2145. @item normalize, n
  2146. Normalize biquad coefficients, by default is disabled.
  2147. Enabling it will normalize magnitude response at DC to 0dB.
  2148. @end table
  2149. @subsection Commands
  2150. This filter supports the following commands:
  2151. @table @option
  2152. @item frequency, f
  2153. Change bass frequency.
  2154. Syntax for the command is : "@var{frequency}"
  2155. @item width_type, t
  2156. Change bass width_type.
  2157. Syntax for the command is : "@var{width_type}"
  2158. @item width, w
  2159. Change bass width.
  2160. Syntax for the command is : "@var{width}"
  2161. @item gain, g
  2162. Change bass gain.
  2163. Syntax for the command is : "@var{gain}"
  2164. @item mix, m
  2165. Change bass mix.
  2166. Syntax for the command is : "@var{mix}"
  2167. @end table
  2168. @section biquad
  2169. Apply a biquad IIR filter with the given coefficients.
  2170. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2171. are the numerator and denominator coefficients respectively.
  2172. and @var{channels}, @var{c} specify which channels to filter, by default all
  2173. available are filtered.
  2174. @subsection Commands
  2175. This filter supports the following commands:
  2176. @table @option
  2177. @item a0
  2178. @item a1
  2179. @item a2
  2180. @item b0
  2181. @item b1
  2182. @item b2
  2183. Change biquad parameter.
  2184. Syntax for the command is : "@var{value}"
  2185. @item mix, m
  2186. How much to use filtered signal in output. Default is 1.
  2187. Range is between 0 and 1.
  2188. @item channels, c
  2189. Specify which channels to filter, by default all available are filtered.
  2190. @item normalize, n
  2191. Normalize biquad coefficients, by default is disabled.
  2192. Enabling it will normalize magnitude response at DC to 0dB.
  2193. @end table
  2194. @section bs2b
  2195. Bauer stereo to binaural transformation, which improves headphone listening of
  2196. stereo audio records.
  2197. To enable compilation of this filter you need to configure FFmpeg with
  2198. @code{--enable-libbs2b}.
  2199. It accepts the following parameters:
  2200. @table @option
  2201. @item profile
  2202. Pre-defined crossfeed level.
  2203. @table @option
  2204. @item default
  2205. Default level (fcut=700, feed=50).
  2206. @item cmoy
  2207. Chu Moy circuit (fcut=700, feed=60).
  2208. @item jmeier
  2209. Jan Meier circuit (fcut=650, feed=95).
  2210. @end table
  2211. @item fcut
  2212. Cut frequency (in Hz).
  2213. @item feed
  2214. Feed level (in Hz).
  2215. @end table
  2216. @section channelmap
  2217. Remap input channels to new locations.
  2218. It accepts the following parameters:
  2219. @table @option
  2220. @item map
  2221. Map channels from input to output. The argument is a '|'-separated list of
  2222. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2223. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2224. channel (e.g. FL for front left) or its index in the input channel layout.
  2225. @var{out_channel} is the name of the output channel or its index in the output
  2226. channel layout. If @var{out_channel} is not given then it is implicitly an
  2227. index, starting with zero and increasing by one for each mapping.
  2228. @item channel_layout
  2229. The channel layout of the output stream.
  2230. @end table
  2231. If no mapping is present, the filter will implicitly map input channels to
  2232. output channels, preserving indices.
  2233. @subsection Examples
  2234. @itemize
  2235. @item
  2236. For example, assuming a 5.1+downmix input MOV file,
  2237. @example
  2238. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2239. @end example
  2240. will create an output WAV file tagged as stereo from the downmix channels of
  2241. the input.
  2242. @item
  2243. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2244. @example
  2245. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2246. @end example
  2247. @end itemize
  2248. @section channelsplit
  2249. Split each channel from an input audio stream into a separate output stream.
  2250. It accepts the following parameters:
  2251. @table @option
  2252. @item channel_layout
  2253. The channel layout of the input stream. The default is "stereo".
  2254. @item channels
  2255. A channel layout describing the channels to be extracted as separate output streams
  2256. or "all" to extract each input channel as a separate stream. The default is "all".
  2257. Choosing channels not present in channel layout in the input will result in an error.
  2258. @end table
  2259. @subsection Examples
  2260. @itemize
  2261. @item
  2262. For example, assuming a stereo input MP3 file,
  2263. @example
  2264. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2265. @end example
  2266. will create an output Matroska file with two audio streams, one containing only
  2267. the left channel and the other the right channel.
  2268. @item
  2269. Split a 5.1 WAV file into per-channel files:
  2270. @example
  2271. ffmpeg -i in.wav -filter_complex
  2272. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2273. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2274. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2275. side_right.wav
  2276. @end example
  2277. @item
  2278. Extract only LFE from a 5.1 WAV file:
  2279. @example
  2280. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2281. -map '[LFE]' lfe.wav
  2282. @end example
  2283. @end itemize
  2284. @section chorus
  2285. Add a chorus effect to the audio.
  2286. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2287. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2288. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2289. The modulation depth defines the range the modulated delay is played before or after
  2290. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2291. sound tuned around the original one, like in a chorus where some vocals are slightly
  2292. off key.
  2293. It accepts the following parameters:
  2294. @table @option
  2295. @item in_gain
  2296. Set input gain. Default is 0.4.
  2297. @item out_gain
  2298. Set output gain. Default is 0.4.
  2299. @item delays
  2300. Set delays. A typical delay is around 40ms to 60ms.
  2301. @item decays
  2302. Set decays.
  2303. @item speeds
  2304. Set speeds.
  2305. @item depths
  2306. Set depths.
  2307. @end table
  2308. @subsection Examples
  2309. @itemize
  2310. @item
  2311. A single delay:
  2312. @example
  2313. chorus=0.7:0.9:55:0.4:0.25:2
  2314. @end example
  2315. @item
  2316. Two delays:
  2317. @example
  2318. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2319. @end example
  2320. @item
  2321. Fuller sounding chorus with three delays:
  2322. @example
  2323. 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
  2324. @end example
  2325. @end itemize
  2326. @section compand
  2327. Compress or expand the audio's dynamic range.
  2328. It accepts the following parameters:
  2329. @table @option
  2330. @item attacks
  2331. @item decays
  2332. A list of times in seconds for each channel over which the instantaneous level
  2333. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2334. increase of volume and @var{decays} refers to decrease of volume. For most
  2335. situations, the attack time (response to the audio getting louder) should be
  2336. shorter than the decay time, because the human ear is more sensitive to sudden
  2337. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2338. a typical value for decay is 0.8 seconds.
  2339. If specified number of attacks & decays is lower than number of channels, the last
  2340. set attack/decay will be used for all remaining channels.
  2341. @item points
  2342. A list of points for the transfer function, specified in dB relative to the
  2343. maximum possible signal amplitude. Each key points list must be defined using
  2344. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2345. @code{x0/y0 x1/y1 x2/y2 ....}
  2346. The input values must be in strictly increasing order but the transfer function
  2347. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2348. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2349. function are @code{-70/-70|-60/-20|1/0}.
  2350. @item soft-knee
  2351. Set the curve radius in dB for all joints. It defaults to 0.01.
  2352. @item gain
  2353. Set the additional gain in dB to be applied at all points on the transfer
  2354. function. This allows for easy adjustment of the overall gain.
  2355. It defaults to 0.
  2356. @item volume
  2357. Set an initial volume, in dB, to be assumed for each channel when filtering
  2358. starts. This permits the user to supply a nominal level initially, so that, for
  2359. example, a very large gain is not applied to initial signal levels before the
  2360. companding has begun to operate. A typical value for audio which is initially
  2361. quiet is -90 dB. It defaults to 0.
  2362. @item delay
  2363. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2364. delayed before being fed to the volume adjuster. Specifying a delay
  2365. approximately equal to the attack/decay times allows the filter to effectively
  2366. operate in predictive rather than reactive mode. It defaults to 0.
  2367. @end table
  2368. @subsection Examples
  2369. @itemize
  2370. @item
  2371. Make music with both quiet and loud passages suitable for listening to in a
  2372. noisy environment:
  2373. @example
  2374. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2375. @end example
  2376. Another example for audio with whisper and explosion parts:
  2377. @example
  2378. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2379. @end example
  2380. @item
  2381. A noise gate for when the noise is at a lower level than the signal:
  2382. @example
  2383. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2384. @end example
  2385. @item
  2386. Here is another noise gate, this time for when the noise is at a higher level
  2387. than the signal (making it, in some ways, similar to squelch):
  2388. @example
  2389. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2390. @end example
  2391. @item
  2392. 2:1 compression starting at -6dB:
  2393. @example
  2394. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2395. @end example
  2396. @item
  2397. 2:1 compression starting at -9dB:
  2398. @example
  2399. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2400. @end example
  2401. @item
  2402. 2:1 compression starting at -12dB:
  2403. @example
  2404. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2405. @end example
  2406. @item
  2407. 2:1 compression starting at -18dB:
  2408. @example
  2409. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2410. @end example
  2411. @item
  2412. 3:1 compression starting at -15dB:
  2413. @example
  2414. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2415. @end example
  2416. @item
  2417. Compressor/Gate:
  2418. @example
  2419. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2420. @end example
  2421. @item
  2422. Expander:
  2423. @example
  2424. 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
  2425. @end example
  2426. @item
  2427. Hard limiter at -6dB:
  2428. @example
  2429. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2430. @end example
  2431. @item
  2432. Hard limiter at -12dB:
  2433. @example
  2434. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2435. @end example
  2436. @item
  2437. Hard noise gate at -35 dB:
  2438. @example
  2439. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2440. @end example
  2441. @item
  2442. Soft limiter:
  2443. @example
  2444. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2445. @end example
  2446. @end itemize
  2447. @section compensationdelay
  2448. Compensation Delay Line is a metric based delay to compensate differing
  2449. positions of microphones or speakers.
  2450. For example, you have recorded guitar with two microphones placed in
  2451. different locations. Because the front of sound wave has fixed speed in
  2452. normal conditions, the phasing of microphones can vary and depends on
  2453. their location and interposition. The best sound mix can be achieved when
  2454. these microphones are in phase (synchronized). Note that a distance of
  2455. ~30 cm between microphones makes one microphone capture the signal in
  2456. antiphase to the other microphone. That makes the final mix sound moody.
  2457. This filter helps to solve phasing problems by adding different delays
  2458. to each microphone track and make them synchronized.
  2459. The best result can be reached when you take one track as base and
  2460. synchronize other tracks one by one with it.
  2461. Remember that synchronization/delay tolerance depends on sample rate, too.
  2462. Higher sample rates will give more tolerance.
  2463. The filter accepts the following parameters:
  2464. @table @option
  2465. @item mm
  2466. Set millimeters distance. This is compensation distance for fine tuning.
  2467. Default is 0.
  2468. @item cm
  2469. Set cm distance. This is compensation distance for tightening distance setup.
  2470. Default is 0.
  2471. @item m
  2472. Set meters distance. This is compensation distance for hard distance setup.
  2473. Default is 0.
  2474. @item dry
  2475. Set dry amount. Amount of unprocessed (dry) signal.
  2476. Default is 0.
  2477. @item wet
  2478. Set wet amount. Amount of processed (wet) signal.
  2479. Default is 1.
  2480. @item temp
  2481. Set temperature in degrees Celsius. This is the temperature of the environment.
  2482. Default is 20.
  2483. @end table
  2484. @section crossfeed
  2485. Apply headphone crossfeed filter.
  2486. Crossfeed is the process of blending the left and right channels of stereo
  2487. audio recording.
  2488. It is mainly used to reduce extreme stereo separation of low frequencies.
  2489. The intent is to produce more speaker like sound to the listener.
  2490. The filter accepts the following options:
  2491. @table @option
  2492. @item strength
  2493. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2494. This sets gain of low shelf filter for side part of stereo image.
  2495. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2496. @item range
  2497. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2498. This sets cut off frequency of low shelf filter. Default is cut off near
  2499. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2500. @item slope
  2501. Set curve slope of low shelf filter. Default is 0.5.
  2502. Allowed range is from 0.01 to 1.
  2503. @item level_in
  2504. Set input gain. Default is 0.9.
  2505. @item level_out
  2506. Set output gain. Default is 1.
  2507. @end table
  2508. @subsection Commands
  2509. This filter supports the all above options as @ref{commands}.
  2510. @section crystalizer
  2511. Simple algorithm to expand audio dynamic range.
  2512. The filter accepts the following options:
  2513. @table @option
  2514. @item i
  2515. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2516. (unchanged sound) to 10.0 (maximum effect).
  2517. @item c
  2518. Enable clipping. By default is enabled.
  2519. @end table
  2520. @subsection Commands
  2521. This filter supports the all above options as @ref{commands}.
  2522. @section dcshift
  2523. Apply a DC shift to the audio.
  2524. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2525. in the recording chain) from the audio. The effect of a DC offset is reduced
  2526. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2527. a signal has a DC offset.
  2528. @table @option
  2529. @item shift
  2530. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2531. the audio.
  2532. @item limitergain
  2533. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2534. used to prevent clipping.
  2535. @end table
  2536. @section deesser
  2537. Apply de-essing to the audio samples.
  2538. @table @option
  2539. @item i
  2540. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2541. Default is 0.
  2542. @item m
  2543. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2544. Default is 0.5.
  2545. @item f
  2546. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2547. Default is 0.5.
  2548. @item s
  2549. Set the output mode.
  2550. It accepts the following values:
  2551. @table @option
  2552. @item i
  2553. Pass input unchanged.
  2554. @item o
  2555. Pass ess filtered out.
  2556. @item e
  2557. Pass only ess.
  2558. Default value is @var{o}.
  2559. @end table
  2560. @end table
  2561. @section drmeter
  2562. Measure audio dynamic range.
  2563. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2564. is found in transition material. And anything less that 8 have very poor dynamics
  2565. and is very compressed.
  2566. The filter accepts the following options:
  2567. @table @option
  2568. @item length
  2569. Set window length in seconds used to split audio into segments of equal length.
  2570. Default is 3 seconds.
  2571. @end table
  2572. @section dynaudnorm
  2573. Dynamic Audio Normalizer.
  2574. This filter applies a certain amount of gain to the input audio in order
  2575. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2576. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2577. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2578. This allows for applying extra gain to the "quiet" sections of the audio
  2579. while avoiding distortions or clipping the "loud" sections. In other words:
  2580. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2581. sections, in the sense that the volume of each section is brought to the
  2582. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2583. this goal *without* applying "dynamic range compressing". It will retain 100%
  2584. of the dynamic range *within* each section of the audio file.
  2585. @table @option
  2586. @item framelen, f
  2587. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2588. Default is 500 milliseconds.
  2589. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2590. referred to as frames. This is required, because a peak magnitude has no
  2591. meaning for just a single sample value. Instead, we need to determine the
  2592. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2593. normalizer would simply use the peak magnitude of the complete file, the
  2594. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2595. frame. The length of a frame is specified in milliseconds. By default, the
  2596. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2597. been found to give good results with most files.
  2598. Note that the exact frame length, in number of samples, will be determined
  2599. automatically, based on the sampling rate of the individual input audio file.
  2600. @item gausssize, g
  2601. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2602. number. Default is 31.
  2603. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2604. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2605. is specified in frames, centered around the current frame. For the sake of
  2606. simplicity, this must be an odd number. Consequently, the default value of 31
  2607. takes into account the current frame, as well as the 15 preceding frames and
  2608. the 15 subsequent frames. Using a larger window results in a stronger
  2609. smoothing effect and thus in less gain variation, i.e. slower gain
  2610. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2611. effect and thus in more gain variation, i.e. faster gain adaptation.
  2612. In other words, the more you increase this value, the more the Dynamic Audio
  2613. Normalizer will behave like a "traditional" normalization filter. On the
  2614. contrary, the more you decrease this value, the more the Dynamic Audio
  2615. Normalizer will behave like a dynamic range compressor.
  2616. @item peak, p
  2617. Set the target peak value. This specifies the highest permissible magnitude
  2618. level for the normalized audio input. This filter will try to approach the
  2619. target peak magnitude as closely as possible, but at the same time it also
  2620. makes sure that the normalized signal will never exceed the peak magnitude.
  2621. A frame's maximum local gain factor is imposed directly by the target peak
  2622. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2623. It is not recommended to go above this value.
  2624. @item maxgain, m
  2625. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2626. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2627. factor for each input frame, i.e. the maximum gain factor that does not
  2628. result in clipping or distortion. The maximum gain factor is determined by
  2629. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2630. additionally bounds the frame's maximum gain factor by a predetermined
  2631. (global) maximum gain factor. This is done in order to avoid excessive gain
  2632. factors in "silent" or almost silent frames. By default, the maximum gain
  2633. factor is 10.0, For most inputs the default value should be sufficient and
  2634. it usually is not recommended to increase this value. Though, for input
  2635. with an extremely low overall volume level, it may be necessary to allow even
  2636. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2637. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2638. Instead, a "sigmoid" threshold function will be applied. This way, the
  2639. gain factors will smoothly approach the threshold value, but never exceed that
  2640. value.
  2641. @item targetrms, r
  2642. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2643. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2644. This means that the maximum local gain factor for each frame is defined
  2645. (only) by the frame's highest magnitude sample. This way, the samples can
  2646. be amplified as much as possible without exceeding the maximum signal
  2647. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2648. Normalizer can also take into account the frame's root mean square,
  2649. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2650. determine the power of a time-varying signal. It is therefore considered
  2651. that the RMS is a better approximation of the "perceived loudness" than
  2652. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2653. frames to a constant RMS value, a uniform "perceived loudness" can be
  2654. established. If a target RMS value has been specified, a frame's local gain
  2655. factor is defined as the factor that would result in exactly that RMS value.
  2656. Note, however, that the maximum local gain factor is still restricted by the
  2657. frame's highest magnitude sample, in order to prevent clipping.
  2658. @item coupling, n
  2659. Enable channels coupling. By default is enabled.
  2660. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2661. amount. This means the same gain factor will be applied to all channels, i.e.
  2662. the maximum possible gain factor is determined by the "loudest" channel.
  2663. However, in some recordings, it may happen that the volume of the different
  2664. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2665. In this case, this option can be used to disable the channel coupling. This way,
  2666. the gain factor will be determined independently for each channel, depending
  2667. only on the individual channel's highest magnitude sample. This allows for
  2668. harmonizing the volume of the different channels.
  2669. @item correctdc, c
  2670. Enable DC bias correction. By default is disabled.
  2671. An audio signal (in the time domain) is a sequence of sample values.
  2672. In the Dynamic Audio Normalizer these sample values are represented in the
  2673. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2674. audio signal, or "waveform", should be centered around the zero point.
  2675. That means if we calculate the mean value of all samples in a file, or in a
  2676. single frame, then the result should be 0.0 or at least very close to that
  2677. value. If, however, there is a significant deviation of the mean value from
  2678. 0.0, in either positive or negative direction, this is referred to as a
  2679. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2680. Audio Normalizer provides optional DC bias correction.
  2681. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2682. the mean value, or "DC correction" offset, of each input frame and subtract
  2683. that value from all of the frame's sample values which ensures those samples
  2684. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2685. boundaries, the DC correction offset values will be interpolated smoothly
  2686. between neighbouring frames.
  2687. @item altboundary, b
  2688. Enable alternative boundary mode. By default is disabled.
  2689. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2690. around each frame. This includes the preceding frames as well as the
  2691. subsequent frames. However, for the "boundary" frames, located at the very
  2692. beginning and at the very end of the audio file, not all neighbouring
  2693. frames are available. In particular, for the first few frames in the audio
  2694. file, the preceding frames are not known. And, similarly, for the last few
  2695. frames in the audio file, the subsequent frames are not known. Thus, the
  2696. question arises which gain factors should be assumed for the missing frames
  2697. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2698. to deal with this situation. The default boundary mode assumes a gain factor
  2699. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2700. "fade out" at the beginning and at the end of the input, respectively.
  2701. @item compress, s
  2702. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2703. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2704. compression. This means that signal peaks will not be pruned and thus the
  2705. full dynamic range will be retained within each local neighbourhood. However,
  2706. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2707. normalization algorithm with a more "traditional" compression.
  2708. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2709. (thresholding) function. If (and only if) the compression feature is enabled,
  2710. all input frames will be processed by a soft knee thresholding function prior
  2711. to the actual normalization process. Put simply, the thresholding function is
  2712. going to prune all samples whose magnitude exceeds a certain threshold value.
  2713. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2714. value. Instead, the threshold value will be adjusted for each individual
  2715. frame.
  2716. In general, smaller parameters result in stronger compression, and vice versa.
  2717. Values below 3.0 are not recommended, because audible distortion may appear.
  2718. @item threshold, t
  2719. Set the target threshold value. This specifies the lowest permissible
  2720. magnitude level for the audio input which will be normalized.
  2721. If input frame volume is above this value frame will be normalized.
  2722. Otherwise frame may not be normalized at all. The default value is set
  2723. to 0, which means all input frames will be normalized.
  2724. This option is mostly useful if digital noise is not wanted to be amplified.
  2725. @end table
  2726. @subsection Commands
  2727. This filter supports the all above options as @ref{commands}.
  2728. @section earwax
  2729. Make audio easier to listen to on headphones.
  2730. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2731. so that when listened to on headphones the stereo image is moved from
  2732. inside your head (standard for headphones) to outside and in front of
  2733. the listener (standard for speakers).
  2734. Ported from SoX.
  2735. @section equalizer
  2736. Apply a two-pole peaking equalisation (EQ) filter. With this
  2737. filter, the signal-level at and around a selected frequency can
  2738. be increased or decreased, whilst (unlike bandpass and bandreject
  2739. filters) that at all other frequencies is unchanged.
  2740. In order to produce complex equalisation curves, this filter can
  2741. be given several times, each with a different central frequency.
  2742. The filter accepts the following options:
  2743. @table @option
  2744. @item frequency, f
  2745. Set the filter's central frequency in Hz.
  2746. @item width_type, t
  2747. Set method to specify band-width of filter.
  2748. @table @option
  2749. @item h
  2750. Hz
  2751. @item q
  2752. Q-Factor
  2753. @item o
  2754. octave
  2755. @item s
  2756. slope
  2757. @item k
  2758. kHz
  2759. @end table
  2760. @item width, w
  2761. Specify the band-width of a filter in width_type units.
  2762. @item gain, g
  2763. Set the required gain or attenuation in dB.
  2764. Beware of clipping when using a positive gain.
  2765. @item mix, m
  2766. How much to use filtered signal in output. Default is 1.
  2767. Range is between 0 and 1.
  2768. @item channels, c
  2769. Specify which channels to filter, by default all available are filtered.
  2770. @item normalize, n
  2771. Normalize biquad coefficients, by default is disabled.
  2772. Enabling it will normalize magnitude response at DC to 0dB.
  2773. @end table
  2774. @subsection Examples
  2775. @itemize
  2776. @item
  2777. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2778. @example
  2779. equalizer=f=1000:t=h:width=200:g=-10
  2780. @end example
  2781. @item
  2782. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2783. @example
  2784. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2785. @end example
  2786. @end itemize
  2787. @subsection Commands
  2788. This filter supports the following commands:
  2789. @table @option
  2790. @item frequency, f
  2791. Change equalizer frequency.
  2792. Syntax for the command is : "@var{frequency}"
  2793. @item width_type, t
  2794. Change equalizer width_type.
  2795. Syntax for the command is : "@var{width_type}"
  2796. @item width, w
  2797. Change equalizer width.
  2798. Syntax for the command is : "@var{width}"
  2799. @item gain, g
  2800. Change equalizer gain.
  2801. Syntax for the command is : "@var{gain}"
  2802. @item mix, m
  2803. Change equalizer mix.
  2804. Syntax for the command is : "@var{mix}"
  2805. @end table
  2806. @section extrastereo
  2807. Linearly increases the difference between left and right channels which
  2808. adds some sort of "live" effect to playback.
  2809. The filter accepts the following options:
  2810. @table @option
  2811. @item m
  2812. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2813. (average of both channels), with 1.0 sound will be unchanged, with
  2814. -1.0 left and right channels will be swapped.
  2815. @item c
  2816. Enable clipping. By default is enabled.
  2817. @end table
  2818. @subsection Commands
  2819. This filter supports the all above options as @ref{commands}.
  2820. @section firequalizer
  2821. Apply FIR Equalization using arbitrary frequency response.
  2822. The filter accepts the following option:
  2823. @table @option
  2824. @item gain
  2825. Set gain curve equation (in dB). The expression can contain variables:
  2826. @table @option
  2827. @item f
  2828. the evaluated frequency
  2829. @item sr
  2830. sample rate
  2831. @item ch
  2832. channel number, set to 0 when multichannels evaluation is disabled
  2833. @item chid
  2834. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2835. multichannels evaluation is disabled
  2836. @item chs
  2837. number of channels
  2838. @item chlayout
  2839. channel_layout, see libavutil/channel_layout.h
  2840. @end table
  2841. and functions:
  2842. @table @option
  2843. @item gain_interpolate(f)
  2844. interpolate gain on frequency f based on gain_entry
  2845. @item cubic_interpolate(f)
  2846. same as gain_interpolate, but smoother
  2847. @end table
  2848. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2849. @item gain_entry
  2850. Set gain entry for gain_interpolate function. The expression can
  2851. contain functions:
  2852. @table @option
  2853. @item entry(f, g)
  2854. store gain entry at frequency f with value g
  2855. @end table
  2856. This option is also available as command.
  2857. @item delay
  2858. Set filter delay in seconds. Higher value means more accurate.
  2859. Default is @code{0.01}.
  2860. @item accuracy
  2861. Set filter accuracy in Hz. Lower value means more accurate.
  2862. Default is @code{5}.
  2863. @item wfunc
  2864. Set window function. Acceptable values are:
  2865. @table @option
  2866. @item rectangular
  2867. rectangular window, useful when gain curve is already smooth
  2868. @item hann
  2869. hann window (default)
  2870. @item hamming
  2871. hamming window
  2872. @item blackman
  2873. blackman window
  2874. @item nuttall3
  2875. 3-terms continuous 1st derivative nuttall window
  2876. @item mnuttall3
  2877. minimum 3-terms discontinuous nuttall window
  2878. @item nuttall
  2879. 4-terms continuous 1st derivative nuttall window
  2880. @item bnuttall
  2881. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2882. @item bharris
  2883. blackman-harris window
  2884. @item tukey
  2885. tukey window
  2886. @end table
  2887. @item fixed
  2888. If enabled, use fixed number of audio samples. This improves speed when
  2889. filtering with large delay. Default is disabled.
  2890. @item multi
  2891. Enable multichannels evaluation on gain. Default is disabled.
  2892. @item zero_phase
  2893. Enable zero phase mode by subtracting timestamp to compensate delay.
  2894. Default is disabled.
  2895. @item scale
  2896. Set scale used by gain. Acceptable values are:
  2897. @table @option
  2898. @item linlin
  2899. linear frequency, linear gain
  2900. @item linlog
  2901. linear frequency, logarithmic (in dB) gain (default)
  2902. @item loglin
  2903. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2904. @item loglog
  2905. logarithmic frequency, logarithmic gain
  2906. @end table
  2907. @item dumpfile
  2908. Set file for dumping, suitable for gnuplot.
  2909. @item dumpscale
  2910. Set scale for dumpfile. Acceptable values are same with scale option.
  2911. Default is linlog.
  2912. @item fft2
  2913. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2914. Default is disabled.
  2915. @item min_phase
  2916. Enable minimum phase impulse response. Default is disabled.
  2917. @end table
  2918. @subsection Examples
  2919. @itemize
  2920. @item
  2921. lowpass at 1000 Hz:
  2922. @example
  2923. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2924. @end example
  2925. @item
  2926. lowpass at 1000 Hz with gain_entry:
  2927. @example
  2928. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2929. @end example
  2930. @item
  2931. custom equalization:
  2932. @example
  2933. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2934. @end example
  2935. @item
  2936. higher delay with zero phase to compensate delay:
  2937. @example
  2938. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2939. @end example
  2940. @item
  2941. lowpass on left channel, highpass on right channel:
  2942. @example
  2943. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2944. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2945. @end example
  2946. @end itemize
  2947. @section flanger
  2948. Apply a flanging effect to the audio.
  2949. The filter accepts the following options:
  2950. @table @option
  2951. @item delay
  2952. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2953. @item depth
  2954. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2955. @item regen
  2956. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2957. Default value is 0.
  2958. @item width
  2959. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2960. Default value is 71.
  2961. @item speed
  2962. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2963. @item shape
  2964. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2965. Default value is @var{sinusoidal}.
  2966. @item phase
  2967. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2968. Default value is 25.
  2969. @item interp
  2970. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2971. Default is @var{linear}.
  2972. @end table
  2973. @section haas
  2974. Apply Haas effect to audio.
  2975. Note that this makes most sense to apply on mono signals.
  2976. With this filter applied to mono signals it give some directionality and
  2977. stretches its stereo image.
  2978. The filter accepts the following options:
  2979. @table @option
  2980. @item level_in
  2981. Set input level. By default is @var{1}, or 0dB
  2982. @item level_out
  2983. Set output level. By default is @var{1}, or 0dB.
  2984. @item side_gain
  2985. Set gain applied to side part of signal. By default is @var{1}.
  2986. @item middle_source
  2987. Set kind of middle source. Can be one of the following:
  2988. @table @samp
  2989. @item left
  2990. Pick left channel.
  2991. @item right
  2992. Pick right channel.
  2993. @item mid
  2994. Pick middle part signal of stereo image.
  2995. @item side
  2996. Pick side part signal of stereo image.
  2997. @end table
  2998. @item middle_phase
  2999. Change middle phase. By default is disabled.
  3000. @item left_delay
  3001. Set left channel delay. By default is @var{2.05} milliseconds.
  3002. @item left_balance
  3003. Set left channel balance. By default is @var{-1}.
  3004. @item left_gain
  3005. Set left channel gain. By default is @var{1}.
  3006. @item left_phase
  3007. Change left phase. By default is disabled.
  3008. @item right_delay
  3009. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3010. @item right_balance
  3011. Set right channel balance. By default is @var{1}.
  3012. @item right_gain
  3013. Set right channel gain. By default is @var{1}.
  3014. @item right_phase
  3015. Change right phase. By default is enabled.
  3016. @end table
  3017. @section hdcd
  3018. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3019. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3020. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3021. of HDCD, and detects the Transient Filter flag.
  3022. @example
  3023. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3024. @end example
  3025. When using the filter with wav, note the default encoding for wav is 16-bit,
  3026. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3027. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3028. @example
  3029. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3030. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3031. @end example
  3032. The filter accepts the following options:
  3033. @table @option
  3034. @item disable_autoconvert
  3035. Disable any automatic format conversion or resampling in the filter graph.
  3036. @item process_stereo
  3037. Process the stereo channels together. If target_gain does not match between
  3038. channels, consider it invalid and use the last valid target_gain.
  3039. @item cdt_ms
  3040. Set the code detect timer period in ms.
  3041. @item force_pe
  3042. Always extend peaks above -3dBFS even if PE isn't signaled.
  3043. @item analyze_mode
  3044. Replace audio with a solid tone and adjust the amplitude to signal some
  3045. specific aspect of the decoding process. The output file can be loaded in
  3046. an audio editor alongside the original to aid analysis.
  3047. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3048. Modes are:
  3049. @table @samp
  3050. @item 0, off
  3051. Disabled
  3052. @item 1, lle
  3053. Gain adjustment level at each sample
  3054. @item 2, pe
  3055. Samples where peak extend occurs
  3056. @item 3, cdt
  3057. Samples where the code detect timer is active
  3058. @item 4, tgm
  3059. Samples where the target gain does not match between channels
  3060. @end table
  3061. @end table
  3062. @section headphone
  3063. Apply head-related transfer functions (HRTFs) to create virtual
  3064. loudspeakers around the user for binaural listening via headphones.
  3065. The HRIRs are provided via additional streams, for each channel
  3066. one stereo input stream is needed.
  3067. The filter accepts the following options:
  3068. @table @option
  3069. @item map
  3070. Set mapping of input streams for convolution.
  3071. The argument is a '|'-separated list of channel names in order as they
  3072. are given as additional stream inputs for filter.
  3073. This also specify number of input streams. Number of input streams
  3074. must be not less than number of channels in first stream plus one.
  3075. @item gain
  3076. Set gain applied to audio. Value is in dB. Default is 0.
  3077. @item type
  3078. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3079. processing audio in time domain which is slow.
  3080. @var{freq} is processing audio in frequency domain which is fast.
  3081. Default is @var{freq}.
  3082. @item lfe
  3083. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3084. @item size
  3085. Set size of frame in number of samples which will be processed at once.
  3086. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3087. @item hrir
  3088. Set format of hrir stream.
  3089. Default value is @var{stereo}. Alternative value is @var{multich}.
  3090. If value is set to @var{stereo}, number of additional streams should
  3091. be greater or equal to number of input channels in first input stream.
  3092. Also each additional stream should have stereo number of channels.
  3093. If value is set to @var{multich}, number of additional streams should
  3094. be exactly one. Also number of input channels of additional stream
  3095. should be equal or greater than twice number of channels of first input
  3096. stream.
  3097. @end table
  3098. @subsection Examples
  3099. @itemize
  3100. @item
  3101. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3102. each amovie filter use stereo file with IR coefficients as input.
  3103. The files give coefficients for each position of virtual loudspeaker:
  3104. @example
  3105. ffmpeg -i input.wav
  3106. -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"
  3107. output.wav
  3108. @end example
  3109. @item
  3110. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3111. but now in @var{multich} @var{hrir} format.
  3112. @example
  3113. 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"
  3114. output.wav
  3115. @end example
  3116. @end itemize
  3117. @section highpass
  3118. Apply a high-pass filter with 3dB point frequency.
  3119. The filter can be either single-pole, or double-pole (the default).
  3120. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3121. The filter accepts the following options:
  3122. @table @option
  3123. @item frequency, f
  3124. Set frequency in Hz. Default is 3000.
  3125. @item poles, p
  3126. Set number of poles. Default is 2.
  3127. @item width_type, t
  3128. Set method to specify band-width of filter.
  3129. @table @option
  3130. @item h
  3131. Hz
  3132. @item q
  3133. Q-Factor
  3134. @item o
  3135. octave
  3136. @item s
  3137. slope
  3138. @item k
  3139. kHz
  3140. @end table
  3141. @item width, w
  3142. Specify the band-width of a filter in width_type units.
  3143. Applies only to double-pole filter.
  3144. The default is 0.707q and gives a Butterworth response.
  3145. @item mix, m
  3146. How much to use filtered signal in output. Default is 1.
  3147. Range is between 0 and 1.
  3148. @item channels, c
  3149. Specify which channels to filter, by default all available are filtered.
  3150. @item normalize, n
  3151. Normalize biquad coefficients, by default is disabled.
  3152. Enabling it will normalize magnitude response at DC to 0dB.
  3153. @end table
  3154. @subsection Commands
  3155. This filter supports the following commands:
  3156. @table @option
  3157. @item frequency, f
  3158. Change highpass frequency.
  3159. Syntax for the command is : "@var{frequency}"
  3160. @item width_type, t
  3161. Change highpass width_type.
  3162. Syntax for the command is : "@var{width_type}"
  3163. @item width, w
  3164. Change highpass width.
  3165. Syntax for the command is : "@var{width}"
  3166. @item mix, m
  3167. Change highpass mix.
  3168. Syntax for the command is : "@var{mix}"
  3169. @end table
  3170. @section join
  3171. Join multiple input streams into one multi-channel stream.
  3172. It accepts the following parameters:
  3173. @table @option
  3174. @item inputs
  3175. The number of input streams. It defaults to 2.
  3176. @item channel_layout
  3177. The desired output channel layout. It defaults to stereo.
  3178. @item map
  3179. Map channels from inputs to output. The argument is a '|'-separated list of
  3180. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3181. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3182. can be either the name of the input channel (e.g. FL for front left) or its
  3183. index in the specified input stream. @var{out_channel} is the name of the output
  3184. channel.
  3185. @end table
  3186. The filter will attempt to guess the mappings when they are not specified
  3187. explicitly. It does so by first trying to find an unused matching input channel
  3188. and if that fails it picks the first unused input channel.
  3189. Join 3 inputs (with properly set channel layouts):
  3190. @example
  3191. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3192. @end example
  3193. Build a 5.1 output from 6 single-channel streams:
  3194. @example
  3195. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3196. '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'
  3197. out
  3198. @end example
  3199. @section ladspa
  3200. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3201. To enable compilation of this filter you need to configure FFmpeg with
  3202. @code{--enable-ladspa}.
  3203. @table @option
  3204. @item file, f
  3205. Specifies the name of LADSPA plugin library to load. If the environment
  3206. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3207. each one of the directories specified by the colon separated list in
  3208. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3209. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3210. @file{/usr/lib/ladspa/}.
  3211. @item plugin, p
  3212. Specifies the plugin within the library. Some libraries contain only
  3213. one plugin, but others contain many of them. If this is not set filter
  3214. will list all available plugins within the specified library.
  3215. @item controls, c
  3216. Set the '|' separated list of controls which are zero or more floating point
  3217. values that determine the behavior of the loaded plugin (for example delay,
  3218. threshold or gain).
  3219. Controls need to be defined using the following syntax:
  3220. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3221. @var{valuei} is the value set on the @var{i}-th control.
  3222. Alternatively they can be also defined using the following syntax:
  3223. @var{value0}|@var{value1}|@var{value2}|..., where
  3224. @var{valuei} is the value set on the @var{i}-th control.
  3225. If @option{controls} is set to @code{help}, all available controls and
  3226. their valid ranges are printed.
  3227. @item sample_rate, s
  3228. Specify the sample rate, default to 44100. Only used if plugin have
  3229. zero inputs.
  3230. @item nb_samples, n
  3231. Set the number of samples per channel per each output frame, default
  3232. is 1024. Only used if plugin have zero inputs.
  3233. @item duration, d
  3234. Set the minimum duration of the sourced audio. See
  3235. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3236. for the accepted syntax.
  3237. Note that the resulting duration may be greater than the specified duration,
  3238. as the generated audio is always cut at the end of a complete frame.
  3239. If not specified, or the expressed duration is negative, the audio is
  3240. supposed to be generated forever.
  3241. Only used if plugin have zero inputs.
  3242. @end table
  3243. @subsection Examples
  3244. @itemize
  3245. @item
  3246. List all available plugins within amp (LADSPA example plugin) library:
  3247. @example
  3248. ladspa=file=amp
  3249. @end example
  3250. @item
  3251. List all available controls and their valid ranges for @code{vcf_notch}
  3252. plugin from @code{VCF} library:
  3253. @example
  3254. ladspa=f=vcf:p=vcf_notch:c=help
  3255. @end example
  3256. @item
  3257. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3258. plugin library:
  3259. @example
  3260. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3261. @end example
  3262. @item
  3263. Add reverberation to the audio using TAP-plugins
  3264. (Tom's Audio Processing plugins):
  3265. @example
  3266. ladspa=file=tap_reverb:tap_reverb
  3267. @end example
  3268. @item
  3269. Generate white noise, with 0.2 amplitude:
  3270. @example
  3271. ladspa=file=cmt:noise_source_white:c=c0=.2
  3272. @end example
  3273. @item
  3274. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3275. @code{C* Audio Plugin Suite} (CAPS) library:
  3276. @example
  3277. ladspa=file=caps:Click:c=c1=20'
  3278. @end example
  3279. @item
  3280. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3281. @example
  3282. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3283. @end example
  3284. @item
  3285. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3286. @code{SWH Plugins} collection:
  3287. @example
  3288. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3289. @end example
  3290. @item
  3291. Attenuate low frequencies using Multiband EQ from Steve Harris
  3292. @code{SWH Plugins} collection:
  3293. @example
  3294. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3295. @end example
  3296. @item
  3297. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3298. (CAPS) library:
  3299. @example
  3300. ladspa=caps:Narrower
  3301. @end example
  3302. @item
  3303. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3304. @example
  3305. ladspa=caps:White:.2
  3306. @end example
  3307. @item
  3308. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3309. @example
  3310. ladspa=caps:Fractal:c=c1=1
  3311. @end example
  3312. @item
  3313. Dynamic volume normalization using @code{VLevel} plugin:
  3314. @example
  3315. ladspa=vlevel-ladspa:vlevel_mono
  3316. @end example
  3317. @end itemize
  3318. @subsection Commands
  3319. This filter supports the following commands:
  3320. @table @option
  3321. @item cN
  3322. Modify the @var{N}-th control value.
  3323. If the specified value is not valid, it is ignored and prior one is kept.
  3324. @end table
  3325. @section loudnorm
  3326. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3327. Support for both single pass (livestreams, files) and double pass (files) modes.
  3328. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  3329. detect true peaks, the audio stream will be upsampled to 192 kHz.
  3330. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3331. The filter accepts the following options:
  3332. @table @option
  3333. @item I, i
  3334. Set integrated loudness target.
  3335. Range is -70.0 - -5.0. Default value is -24.0.
  3336. @item LRA, lra
  3337. Set loudness range target.
  3338. Range is 1.0 - 20.0. Default value is 7.0.
  3339. @item TP, tp
  3340. Set maximum true peak.
  3341. Range is -9.0 - +0.0. Default value is -2.0.
  3342. @item measured_I, measured_i
  3343. Measured IL of input file.
  3344. Range is -99.0 - +0.0.
  3345. @item measured_LRA, measured_lra
  3346. Measured LRA of input file.
  3347. Range is 0.0 - 99.0.
  3348. @item measured_TP, measured_tp
  3349. Measured true peak of input file.
  3350. Range is -99.0 - +99.0.
  3351. @item measured_thresh
  3352. Measured threshold of input file.
  3353. Range is -99.0 - +0.0.
  3354. @item offset
  3355. Set offset gain. Gain is applied before the true-peak limiter.
  3356. Range is -99.0 - +99.0. Default is +0.0.
  3357. @item linear
  3358. Normalize by linearly scaling the source audio.
  3359. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  3360. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  3361. be lower than source LRA and the change in integrated loudness shouldn't
  3362. result in a true peak which exceeds the target TP. If any of these
  3363. conditions aren't met, normalization mode will revert to @var{dynamic}.
  3364. Options are @code{true} or @code{false}. Default is @code{true}.
  3365. @item dual_mono
  3366. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3367. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3368. If set to @code{true}, this option will compensate for this effect.
  3369. Multi-channel input files are not affected by this option.
  3370. Options are true or false. Default is false.
  3371. @item print_format
  3372. Set print format for stats. Options are summary, json, or none.
  3373. Default value is none.
  3374. @end table
  3375. @section lowpass
  3376. Apply a low-pass filter with 3dB point frequency.
  3377. The filter can be either single-pole or double-pole (the default).
  3378. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3379. The filter accepts the following options:
  3380. @table @option
  3381. @item frequency, f
  3382. Set frequency in Hz. Default is 500.
  3383. @item poles, p
  3384. Set number of poles. Default is 2.
  3385. @item width_type, t
  3386. Set method to specify band-width of filter.
  3387. @table @option
  3388. @item h
  3389. Hz
  3390. @item q
  3391. Q-Factor
  3392. @item o
  3393. octave
  3394. @item s
  3395. slope
  3396. @item k
  3397. kHz
  3398. @end table
  3399. @item width, w
  3400. Specify the band-width of a filter in width_type units.
  3401. Applies only to double-pole filter.
  3402. The default is 0.707q and gives a Butterworth response.
  3403. @item mix, m
  3404. How much to use filtered signal in output. Default is 1.
  3405. Range is between 0 and 1.
  3406. @item channels, c
  3407. Specify which channels to filter, by default all available are filtered.
  3408. @item normalize, n
  3409. Normalize biquad coefficients, by default is disabled.
  3410. Enabling it will normalize magnitude response at DC to 0dB.
  3411. @end table
  3412. @subsection Examples
  3413. @itemize
  3414. @item
  3415. Lowpass only LFE channel, it LFE is not present it does nothing:
  3416. @example
  3417. lowpass=c=LFE
  3418. @end example
  3419. @end itemize
  3420. @subsection Commands
  3421. This filter supports the following commands:
  3422. @table @option
  3423. @item frequency, f
  3424. Change lowpass frequency.
  3425. Syntax for the command is : "@var{frequency}"
  3426. @item width_type, t
  3427. Change lowpass width_type.
  3428. Syntax for the command is : "@var{width_type}"
  3429. @item width, w
  3430. Change lowpass width.
  3431. Syntax for the command is : "@var{width}"
  3432. @item mix, m
  3433. Change lowpass mix.
  3434. Syntax for the command is : "@var{mix}"
  3435. @end table
  3436. @section lv2
  3437. Load a LV2 (LADSPA Version 2) plugin.
  3438. To enable compilation of this filter you need to configure FFmpeg with
  3439. @code{--enable-lv2}.
  3440. @table @option
  3441. @item plugin, p
  3442. Specifies the plugin URI. You may need to escape ':'.
  3443. @item controls, c
  3444. Set the '|' separated list of controls which are zero or more floating point
  3445. values that determine the behavior of the loaded plugin (for example delay,
  3446. threshold or gain).
  3447. If @option{controls} is set to @code{help}, all available controls and
  3448. their valid ranges are printed.
  3449. @item sample_rate, s
  3450. Specify the sample rate, default to 44100. Only used if plugin have
  3451. zero inputs.
  3452. @item nb_samples, n
  3453. Set the number of samples per channel per each output frame, default
  3454. is 1024. Only used if plugin have zero inputs.
  3455. @item duration, d
  3456. Set the minimum duration of the sourced audio. See
  3457. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3458. for the accepted syntax.
  3459. Note that the resulting duration may be greater than the specified duration,
  3460. as the generated audio is always cut at the end of a complete frame.
  3461. If not specified, or the expressed duration is negative, the audio is
  3462. supposed to be generated forever.
  3463. Only used if plugin have zero inputs.
  3464. @end table
  3465. @subsection Examples
  3466. @itemize
  3467. @item
  3468. Apply bass enhancer plugin from Calf:
  3469. @example
  3470. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3471. @end example
  3472. @item
  3473. Apply vinyl plugin from Calf:
  3474. @example
  3475. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3476. @end example
  3477. @item
  3478. Apply bit crusher plugin from ArtyFX:
  3479. @example
  3480. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3481. @end example
  3482. @end itemize
  3483. @section mcompand
  3484. Multiband Compress or expand the audio's dynamic range.
  3485. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3486. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3487. response when absent compander action.
  3488. It accepts the following parameters:
  3489. @table @option
  3490. @item args
  3491. This option syntax is:
  3492. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3493. For explanation of each item refer to compand filter documentation.
  3494. @end table
  3495. @anchor{pan}
  3496. @section pan
  3497. Mix channels with specific gain levels. The filter accepts the output
  3498. channel layout followed by a set of channels definitions.
  3499. This filter is also designed to efficiently remap the channels of an audio
  3500. stream.
  3501. The filter accepts parameters of the form:
  3502. "@var{l}|@var{outdef}|@var{outdef}|..."
  3503. @table @option
  3504. @item l
  3505. output channel layout or number of channels
  3506. @item outdef
  3507. output channel specification, of the form:
  3508. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3509. @item out_name
  3510. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3511. number (c0, c1, etc.)
  3512. @item gain
  3513. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3514. @item in_name
  3515. input channel to use, see out_name for details; it is not possible to mix
  3516. named and numbered input channels
  3517. @end table
  3518. If the `=' in a channel specification is replaced by `<', then the gains for
  3519. that specification will be renormalized so that the total is 1, thus
  3520. avoiding clipping noise.
  3521. @subsection Mixing examples
  3522. For example, if you want to down-mix from stereo to mono, but with a bigger
  3523. factor for the left channel:
  3524. @example
  3525. pan=1c|c0=0.9*c0+0.1*c1
  3526. @end example
  3527. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3528. 7-channels surround:
  3529. @example
  3530. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3531. @end example
  3532. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3533. that should be preferred (see "-ac" option) unless you have very specific
  3534. needs.
  3535. @subsection Remapping examples
  3536. The channel remapping will be effective if, and only if:
  3537. @itemize
  3538. @item gain coefficients are zeroes or ones,
  3539. @item only one input per channel output,
  3540. @end itemize
  3541. If all these conditions are satisfied, the filter will notify the user ("Pure
  3542. channel mapping detected"), and use an optimized and lossless method to do the
  3543. remapping.
  3544. For example, if you have a 5.1 source and want a stereo audio stream by
  3545. dropping the extra channels:
  3546. @example
  3547. pan="stereo| c0=FL | c1=FR"
  3548. @end example
  3549. Given the same source, you can also switch front left and front right channels
  3550. and keep the input channel layout:
  3551. @example
  3552. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3553. @end example
  3554. If the input is a stereo audio stream, you can mute the front left channel (and
  3555. still keep the stereo channel layout) with:
  3556. @example
  3557. pan="stereo|c1=c1"
  3558. @end example
  3559. Still with a stereo audio stream input, you can copy the right channel in both
  3560. front left and right:
  3561. @example
  3562. pan="stereo| c0=FR | c1=FR"
  3563. @end example
  3564. @section replaygain
  3565. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3566. outputs it unchanged.
  3567. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3568. @section resample
  3569. Convert the audio sample format, sample rate and channel layout. It is
  3570. not meant to be used directly.
  3571. @section rubberband
  3572. Apply time-stretching and pitch-shifting with librubberband.
  3573. To enable compilation of this filter, you need to configure FFmpeg with
  3574. @code{--enable-librubberband}.
  3575. The filter accepts the following options:
  3576. @table @option
  3577. @item tempo
  3578. Set tempo scale factor.
  3579. @item pitch
  3580. Set pitch scale factor.
  3581. @item transients
  3582. Set transients detector.
  3583. Possible values are:
  3584. @table @var
  3585. @item crisp
  3586. @item mixed
  3587. @item smooth
  3588. @end table
  3589. @item detector
  3590. Set detector.
  3591. Possible values are:
  3592. @table @var
  3593. @item compound
  3594. @item percussive
  3595. @item soft
  3596. @end table
  3597. @item phase
  3598. Set phase.
  3599. Possible values are:
  3600. @table @var
  3601. @item laminar
  3602. @item independent
  3603. @end table
  3604. @item window
  3605. Set processing window size.
  3606. Possible values are:
  3607. @table @var
  3608. @item standard
  3609. @item short
  3610. @item long
  3611. @end table
  3612. @item smoothing
  3613. Set smoothing.
  3614. Possible values are:
  3615. @table @var
  3616. @item off
  3617. @item on
  3618. @end table
  3619. @item formant
  3620. Enable formant preservation when shift pitching.
  3621. Possible values are:
  3622. @table @var
  3623. @item shifted
  3624. @item preserved
  3625. @end table
  3626. @item pitchq
  3627. Set pitch quality.
  3628. Possible values are:
  3629. @table @var
  3630. @item quality
  3631. @item speed
  3632. @item consistency
  3633. @end table
  3634. @item channels
  3635. Set channels.
  3636. Possible values are:
  3637. @table @var
  3638. @item apart
  3639. @item together
  3640. @end table
  3641. @end table
  3642. @subsection Commands
  3643. This filter supports the following commands:
  3644. @table @option
  3645. @item tempo
  3646. Change filter tempo scale factor.
  3647. Syntax for the command is : "@var{tempo}"
  3648. @item pitch
  3649. Change filter pitch scale factor.
  3650. Syntax for the command is : "@var{pitch}"
  3651. @end table
  3652. @section sidechaincompress
  3653. This filter acts like normal compressor but has the ability to compress
  3654. detected signal using second input signal.
  3655. It needs two input streams and returns one output stream.
  3656. First input stream will be processed depending on second stream signal.
  3657. The filtered signal then can be filtered with other filters in later stages of
  3658. processing. See @ref{pan} and @ref{amerge} filter.
  3659. The filter accepts the following options:
  3660. @table @option
  3661. @item level_in
  3662. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3663. @item mode
  3664. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3665. Default is @code{downward}.
  3666. @item threshold
  3667. If a signal of second stream raises above this level it will affect the gain
  3668. reduction of first stream.
  3669. By default is 0.125. Range is between 0.00097563 and 1.
  3670. @item ratio
  3671. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3672. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3673. Default is 2. Range is between 1 and 20.
  3674. @item attack
  3675. Amount of milliseconds the signal has to rise above the threshold before gain
  3676. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3677. @item release
  3678. Amount of milliseconds the signal has to fall below the threshold before
  3679. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3680. @item makeup
  3681. Set the amount by how much signal will be amplified after processing.
  3682. Default is 1. Range is from 1 to 64.
  3683. @item knee
  3684. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3685. Default is 2.82843. Range is between 1 and 8.
  3686. @item link
  3687. Choose if the @code{average} level between all channels of side-chain stream
  3688. or the louder(@code{maximum}) channel of side-chain stream affects the
  3689. reduction. Default is @code{average}.
  3690. @item detection
  3691. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3692. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3693. @item level_sc
  3694. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3695. @item mix
  3696. How much to use compressed signal in output. Default is 1.
  3697. Range is between 0 and 1.
  3698. @end table
  3699. @subsection Commands
  3700. This filter supports the all above options as @ref{commands}.
  3701. @subsection Examples
  3702. @itemize
  3703. @item
  3704. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3705. depending on the signal of 2nd input and later compressed signal to be
  3706. merged with 2nd input:
  3707. @example
  3708. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3709. @end example
  3710. @end itemize
  3711. @section sidechaingate
  3712. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3713. filter the detected signal before sending it to the gain reduction stage.
  3714. Normally a gate uses the full range signal to detect a level above the
  3715. threshold.
  3716. For example: If you cut all lower frequencies from your sidechain signal
  3717. the gate will decrease the volume of your track only if not enough highs
  3718. appear. With this technique you are able to reduce the resonation of a
  3719. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3720. guitar.
  3721. It needs two input streams and returns one output stream.
  3722. First input stream will be processed depending on second stream signal.
  3723. The filter accepts the following options:
  3724. @table @option
  3725. @item level_in
  3726. Set input level before filtering.
  3727. Default is 1. Allowed range is from 0.015625 to 64.
  3728. @item mode
  3729. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3730. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3731. will be amplified, expanding dynamic range in upward direction.
  3732. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3733. @item range
  3734. Set the level of gain reduction when the signal is below the threshold.
  3735. Default is 0.06125. Allowed range is from 0 to 1.
  3736. Setting this to 0 disables reduction and then filter behaves like expander.
  3737. @item threshold
  3738. If a signal rises above this level the gain reduction is released.
  3739. Default is 0.125. Allowed range is from 0 to 1.
  3740. @item ratio
  3741. Set a ratio about which the signal is reduced.
  3742. Default is 2. Allowed range is from 1 to 9000.
  3743. @item attack
  3744. Amount of milliseconds the signal has to rise above the threshold before gain
  3745. reduction stops.
  3746. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3747. @item release
  3748. Amount of milliseconds the signal has to fall below the threshold before the
  3749. reduction is increased again. Default is 250 milliseconds.
  3750. Allowed range is from 0.01 to 9000.
  3751. @item makeup
  3752. Set amount of amplification of signal after processing.
  3753. Default is 1. Allowed range is from 1 to 64.
  3754. @item knee
  3755. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3756. Default is 2.828427125. Allowed range is from 1 to 8.
  3757. @item detection
  3758. Choose if exact signal should be taken for detection or an RMS like one.
  3759. Default is rms. Can be peak or rms.
  3760. @item link
  3761. Choose if the average level between all channels or the louder channel affects
  3762. the reduction.
  3763. Default is average. Can be average or maximum.
  3764. @item level_sc
  3765. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3766. @end table
  3767. @section silencedetect
  3768. Detect silence in an audio stream.
  3769. This filter logs a message when it detects that the input audio volume is less
  3770. or equal to a noise tolerance value for a duration greater or equal to the
  3771. minimum detected noise duration.
  3772. The printed times and duration are expressed in seconds. The
  3773. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  3774. is set on the first frame whose timestamp equals or exceeds the detection
  3775. duration and it contains the timestamp of the first frame of the silence.
  3776. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  3777. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  3778. keys are set on the first frame after the silence. If @option{mono} is
  3779. enabled, and each channel is evaluated separately, the @code{.X}
  3780. suffixed keys are used, and @code{X} corresponds to the channel number.
  3781. The filter accepts the following options:
  3782. @table @option
  3783. @item noise, n
  3784. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3785. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3786. @item duration, d
  3787. Set silence duration until notification (default is 2 seconds). See
  3788. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3789. for the accepted syntax.
  3790. @item mono, m
  3791. Process each channel separately, instead of combined. By default is disabled.
  3792. @end table
  3793. @subsection Examples
  3794. @itemize
  3795. @item
  3796. Detect 5 seconds of silence with -50dB noise tolerance:
  3797. @example
  3798. silencedetect=n=-50dB:d=5
  3799. @end example
  3800. @item
  3801. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3802. tolerance in @file{silence.mp3}:
  3803. @example
  3804. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3805. @end example
  3806. @end itemize
  3807. @section silenceremove
  3808. Remove silence from the beginning, middle or end of the audio.
  3809. The filter accepts the following options:
  3810. @table @option
  3811. @item start_periods
  3812. This value is used to indicate if audio should be trimmed at beginning of
  3813. the audio. A value of zero indicates no silence should be trimmed from the
  3814. beginning. When specifying a non-zero value, it trims audio up until it
  3815. finds non-silence. Normally, when trimming silence from beginning of audio
  3816. the @var{start_periods} will be @code{1} but it can be increased to higher
  3817. values to trim all audio up to specific count of non-silence periods.
  3818. Default value is @code{0}.
  3819. @item start_duration
  3820. Specify the amount of time that non-silence must be detected before it stops
  3821. trimming audio. By increasing the duration, bursts of noises can be treated
  3822. as silence and trimmed off. Default value is @code{0}.
  3823. @item start_threshold
  3824. This indicates what sample value should be treated as silence. For digital
  3825. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3826. you may wish to increase the value to account for background noise.
  3827. Can be specified in dB (in case "dB" is appended to the specified value)
  3828. or amplitude ratio. Default value is @code{0}.
  3829. @item start_silence
  3830. Specify max duration of silence at beginning that will be kept after
  3831. trimming. Default is 0, which is equal to trimming all samples detected
  3832. as silence.
  3833. @item start_mode
  3834. Specify mode of detection of silence end in start of multi-channel audio.
  3835. Can be @var{any} or @var{all}. Default is @var{any}.
  3836. With @var{any}, any sample that is detected as non-silence will cause
  3837. stopped trimming of silence.
  3838. With @var{all}, only if all channels are detected as non-silence will cause
  3839. stopped trimming of silence.
  3840. @item stop_periods
  3841. Set the count for trimming silence from the end of audio.
  3842. To remove silence from the middle of a file, specify a @var{stop_periods}
  3843. that is negative. This value is then treated as a positive value and is
  3844. used to indicate the effect should restart processing as specified by
  3845. @var{start_periods}, making it suitable for removing periods of silence
  3846. in the middle of the audio.
  3847. Default value is @code{0}.
  3848. @item stop_duration
  3849. Specify a duration of silence that must exist before audio is not copied any
  3850. more. By specifying a higher duration, silence that is wanted can be left in
  3851. the audio.
  3852. Default value is @code{0}.
  3853. @item stop_threshold
  3854. This is the same as @option{start_threshold} but for trimming silence from
  3855. the end of audio.
  3856. Can be specified in dB (in case "dB" is appended to the specified value)
  3857. or amplitude ratio. Default value is @code{0}.
  3858. @item stop_silence
  3859. Specify max duration of silence at end that will be kept after
  3860. trimming. Default is 0, which is equal to trimming all samples detected
  3861. as silence.
  3862. @item stop_mode
  3863. Specify mode of detection of silence start in end of multi-channel audio.
  3864. Can be @var{any} or @var{all}. Default is @var{any}.
  3865. With @var{any}, any sample that is detected as non-silence will cause
  3866. stopped trimming of silence.
  3867. With @var{all}, only if all channels are detected as non-silence will cause
  3868. stopped trimming of silence.
  3869. @item detection
  3870. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3871. and works better with digital silence which is exactly 0.
  3872. Default value is @code{rms}.
  3873. @item window
  3874. Set duration in number of seconds used to calculate size of window in number
  3875. of samples for detecting silence.
  3876. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3877. @end table
  3878. @subsection Examples
  3879. @itemize
  3880. @item
  3881. The following example shows how this filter can be used to start a recording
  3882. that does not contain the delay at the start which usually occurs between
  3883. pressing the record button and the start of the performance:
  3884. @example
  3885. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3886. @end example
  3887. @item
  3888. Trim all silence encountered from beginning to end where there is more than 1
  3889. second of silence in audio:
  3890. @example
  3891. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3892. @end example
  3893. @item
  3894. Trim all digital silence samples, using peak detection, from beginning to end
  3895. where there is more than 0 samples of digital silence in audio and digital
  3896. silence is detected in all channels at same positions in stream:
  3897. @example
  3898. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  3899. @end example
  3900. @end itemize
  3901. @section sofalizer
  3902. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3903. loudspeakers around the user for binaural listening via headphones (audio
  3904. formats up to 9 channels supported).
  3905. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3906. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3907. Austrian Academy of Sciences.
  3908. To enable compilation of this filter you need to configure FFmpeg with
  3909. @code{--enable-libmysofa}.
  3910. The filter accepts the following options:
  3911. @table @option
  3912. @item sofa
  3913. Set the SOFA file used for rendering.
  3914. @item gain
  3915. Set gain applied to audio. Value is in dB. Default is 0.
  3916. @item rotation
  3917. Set rotation of virtual loudspeakers in deg. Default is 0.
  3918. @item elevation
  3919. Set elevation of virtual speakers in deg. Default is 0.
  3920. @item radius
  3921. Set distance in meters between loudspeakers and the listener with near-field
  3922. HRTFs. Default is 1.
  3923. @item type
  3924. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3925. processing audio in time domain which is slow.
  3926. @var{freq} is processing audio in frequency domain which is fast.
  3927. Default is @var{freq}.
  3928. @item speakers
  3929. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3930. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3931. Each virtual loudspeaker is described with short channel name following with
  3932. azimuth and elevation in degrees.
  3933. Each virtual loudspeaker description is separated by '|'.
  3934. For example to override front left and front right channel positions use:
  3935. 'speakers=FL 45 15|FR 345 15'.
  3936. Descriptions with unrecognised channel names are ignored.
  3937. @item lfegain
  3938. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3939. @item framesize
  3940. Set custom frame size in number of samples. Default is 1024.
  3941. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3942. is set to @var{freq}.
  3943. @item normalize
  3944. Should all IRs be normalized upon importing SOFA file.
  3945. By default is enabled.
  3946. @item interpolate
  3947. Should nearest IRs be interpolated with neighbor IRs if exact position
  3948. does not match. By default is disabled.
  3949. @item minphase
  3950. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3951. @item anglestep
  3952. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3953. @item radstep
  3954. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3955. @end table
  3956. @subsection Examples
  3957. @itemize
  3958. @item
  3959. Using ClubFritz6 sofa file:
  3960. @example
  3961. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3962. @end example
  3963. @item
  3964. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3965. @example
  3966. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3967. @end example
  3968. @item
  3969. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3970. and also with custom gain:
  3971. @example
  3972. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3973. @end example
  3974. @end itemize
  3975. @section stereotools
  3976. This filter has some handy utilities to manage stereo signals, for converting
  3977. M/S stereo recordings to L/R signal while having control over the parameters
  3978. or spreading the stereo image of master track.
  3979. The filter accepts the following options:
  3980. @table @option
  3981. @item level_in
  3982. Set input level before filtering for both channels. Defaults is 1.
  3983. Allowed range is from 0.015625 to 64.
  3984. @item level_out
  3985. Set output level after filtering for both channels. Defaults is 1.
  3986. Allowed range is from 0.015625 to 64.
  3987. @item balance_in
  3988. Set input balance between both channels. Default is 0.
  3989. Allowed range is from -1 to 1.
  3990. @item balance_out
  3991. Set output balance between both channels. Default is 0.
  3992. Allowed range is from -1 to 1.
  3993. @item softclip
  3994. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3995. clipping. Disabled by default.
  3996. @item mutel
  3997. Mute the left channel. Disabled by default.
  3998. @item muter
  3999. Mute the right channel. Disabled by default.
  4000. @item phasel
  4001. Change the phase of the left channel. Disabled by default.
  4002. @item phaser
  4003. Change the phase of the right channel. Disabled by default.
  4004. @item mode
  4005. Set stereo mode. Available values are:
  4006. @table @samp
  4007. @item lr>lr
  4008. Left/Right to Left/Right, this is default.
  4009. @item lr>ms
  4010. Left/Right to Mid/Side.
  4011. @item ms>lr
  4012. Mid/Side to Left/Right.
  4013. @item lr>ll
  4014. Left/Right to Left/Left.
  4015. @item lr>rr
  4016. Left/Right to Right/Right.
  4017. @item lr>l+r
  4018. Left/Right to Left + Right.
  4019. @item lr>rl
  4020. Left/Right to Right/Left.
  4021. @item ms>ll
  4022. Mid/Side to Left/Left.
  4023. @item ms>rr
  4024. Mid/Side to Right/Right.
  4025. @end table
  4026. @item slev
  4027. Set level of side signal. Default is 1.
  4028. Allowed range is from 0.015625 to 64.
  4029. @item sbal
  4030. Set balance of side signal. Default is 0.
  4031. Allowed range is from -1 to 1.
  4032. @item mlev
  4033. Set level of the middle signal. Default is 1.
  4034. Allowed range is from 0.015625 to 64.
  4035. @item mpan
  4036. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4037. @item base
  4038. Set stereo base between mono and inversed channels. Default is 0.
  4039. Allowed range is from -1 to 1.
  4040. @item delay
  4041. Set delay in milliseconds how much to delay left from right channel and
  4042. vice versa. Default is 0. Allowed range is from -20 to 20.
  4043. @item sclevel
  4044. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4045. @item phase
  4046. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4047. @item bmode_in, bmode_out
  4048. Set balance mode for balance_in/balance_out option.
  4049. Can be one of the following:
  4050. @table @samp
  4051. @item balance
  4052. Classic balance mode. Attenuate one channel at time.
  4053. Gain is raised up to 1.
  4054. @item amplitude
  4055. Similar as classic mode above but gain is raised up to 2.
  4056. @item power
  4057. Equal power distribution, from -6dB to +6dB range.
  4058. @end table
  4059. @end table
  4060. @subsection Examples
  4061. @itemize
  4062. @item
  4063. Apply karaoke like effect:
  4064. @example
  4065. stereotools=mlev=0.015625
  4066. @end example
  4067. @item
  4068. Convert M/S signal to L/R:
  4069. @example
  4070. "stereotools=mode=ms>lr"
  4071. @end example
  4072. @end itemize
  4073. @section stereowiden
  4074. This filter enhance the stereo effect by suppressing signal common to both
  4075. channels and by delaying the signal of left into right and vice versa,
  4076. thereby widening the stereo effect.
  4077. The filter accepts the following options:
  4078. @table @option
  4079. @item delay
  4080. Time in milliseconds of the delay of left signal into right and vice versa.
  4081. Default is 20 milliseconds.
  4082. @item feedback
  4083. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4084. effect of left signal in right output and vice versa which gives widening
  4085. effect. Default is 0.3.
  4086. @item crossfeed
  4087. Cross feed of left into right with inverted phase. This helps in suppressing
  4088. the mono. If the value is 1 it will cancel all the signal common to both
  4089. channels. Default is 0.3.
  4090. @item drymix
  4091. Set level of input signal of original channel. Default is 0.8.
  4092. @end table
  4093. @subsection Commands
  4094. This filter supports the all above options except @code{delay} as @ref{commands}.
  4095. @section superequalizer
  4096. Apply 18 band equalizer.
  4097. The filter accepts the following options:
  4098. @table @option
  4099. @item 1b
  4100. Set 65Hz band gain.
  4101. @item 2b
  4102. Set 92Hz band gain.
  4103. @item 3b
  4104. Set 131Hz band gain.
  4105. @item 4b
  4106. Set 185Hz band gain.
  4107. @item 5b
  4108. Set 262Hz band gain.
  4109. @item 6b
  4110. Set 370Hz band gain.
  4111. @item 7b
  4112. Set 523Hz band gain.
  4113. @item 8b
  4114. Set 740Hz band gain.
  4115. @item 9b
  4116. Set 1047Hz band gain.
  4117. @item 10b
  4118. Set 1480Hz band gain.
  4119. @item 11b
  4120. Set 2093Hz band gain.
  4121. @item 12b
  4122. Set 2960Hz band gain.
  4123. @item 13b
  4124. Set 4186Hz band gain.
  4125. @item 14b
  4126. Set 5920Hz band gain.
  4127. @item 15b
  4128. Set 8372Hz band gain.
  4129. @item 16b
  4130. Set 11840Hz band gain.
  4131. @item 17b
  4132. Set 16744Hz band gain.
  4133. @item 18b
  4134. Set 20000Hz band gain.
  4135. @end table
  4136. @section surround
  4137. Apply audio surround upmix filter.
  4138. This filter allows to produce multichannel output from audio stream.
  4139. The filter accepts the following options:
  4140. @table @option
  4141. @item chl_out
  4142. Set output channel layout. By default, this is @var{5.1}.
  4143. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4144. for the required syntax.
  4145. @item chl_in
  4146. Set input channel layout. By default, this is @var{stereo}.
  4147. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4148. for the required syntax.
  4149. @item level_in
  4150. Set input volume level. By default, this is @var{1}.
  4151. @item level_out
  4152. Set output volume level. By default, this is @var{1}.
  4153. @item lfe
  4154. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4155. @item lfe_low
  4156. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4157. @item lfe_high
  4158. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4159. @item lfe_mode
  4160. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4161. In @var{add} mode, LFE channel is created from input audio and added to output.
  4162. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4163. also all non-LFE output channels are subtracted with output LFE channel.
  4164. @item angle
  4165. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4166. Default is @var{90}.
  4167. @item fc_in
  4168. Set front center input volume. By default, this is @var{1}.
  4169. @item fc_out
  4170. Set front center output volume. By default, this is @var{1}.
  4171. @item fl_in
  4172. Set front left input volume. By default, this is @var{1}.
  4173. @item fl_out
  4174. Set front left output volume. By default, this is @var{1}.
  4175. @item fr_in
  4176. Set front right input volume. By default, this is @var{1}.
  4177. @item fr_out
  4178. Set front right output volume. By default, this is @var{1}.
  4179. @item sl_in
  4180. Set side left input volume. By default, this is @var{1}.
  4181. @item sl_out
  4182. Set side left output volume. By default, this is @var{1}.
  4183. @item sr_in
  4184. Set side right input volume. By default, this is @var{1}.
  4185. @item sr_out
  4186. Set side right output volume. By default, this is @var{1}.
  4187. @item bl_in
  4188. Set back left input volume. By default, this is @var{1}.
  4189. @item bl_out
  4190. Set back left output volume. By default, this is @var{1}.
  4191. @item br_in
  4192. Set back right input volume. By default, this is @var{1}.
  4193. @item br_out
  4194. Set back right output volume. By default, this is @var{1}.
  4195. @item bc_in
  4196. Set back center input volume. By default, this is @var{1}.
  4197. @item bc_out
  4198. Set back center output volume. By default, this is @var{1}.
  4199. @item lfe_in
  4200. Set LFE input volume. By default, this is @var{1}.
  4201. @item lfe_out
  4202. Set LFE output volume. By default, this is @var{1}.
  4203. @item allx
  4204. Set spread usage of stereo image across X axis for all channels.
  4205. @item ally
  4206. Set spread usage of stereo image across Y axis for all channels.
  4207. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4208. Set spread usage of stereo image across X axis for each channel.
  4209. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4210. Set spread usage of stereo image across Y axis for each channel.
  4211. @item win_size
  4212. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4213. @item win_func
  4214. Set window function.
  4215. It accepts the following values:
  4216. @table @samp
  4217. @item rect
  4218. @item bartlett
  4219. @item hann, hanning
  4220. @item hamming
  4221. @item blackman
  4222. @item welch
  4223. @item flattop
  4224. @item bharris
  4225. @item bnuttall
  4226. @item bhann
  4227. @item sine
  4228. @item nuttall
  4229. @item lanczos
  4230. @item gauss
  4231. @item tukey
  4232. @item dolph
  4233. @item cauchy
  4234. @item parzen
  4235. @item poisson
  4236. @item bohman
  4237. @end table
  4238. Default is @code{hann}.
  4239. @item overlap
  4240. Set window overlap. If set to 1, the recommended overlap for selected
  4241. window function will be picked. Default is @code{0.5}.
  4242. @end table
  4243. @section treble, highshelf
  4244. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4245. shelving filter with a response similar to that of a standard
  4246. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4247. The filter accepts the following options:
  4248. @table @option
  4249. @item gain, g
  4250. Give the gain at whichever is the lower of ~22 kHz and the
  4251. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4252. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4253. @item frequency, f
  4254. Set the filter's central frequency and so can be used
  4255. to extend or reduce the frequency range to be boosted or cut.
  4256. The default value is @code{3000} Hz.
  4257. @item width_type, t
  4258. Set method to specify band-width of filter.
  4259. @table @option
  4260. @item h
  4261. Hz
  4262. @item q
  4263. Q-Factor
  4264. @item o
  4265. octave
  4266. @item s
  4267. slope
  4268. @item k
  4269. kHz
  4270. @end table
  4271. @item width, w
  4272. Determine how steep is the filter's shelf transition.
  4273. @item mix, m
  4274. How much to use filtered signal in output. Default is 1.
  4275. Range is between 0 and 1.
  4276. @item channels, c
  4277. Specify which channels to filter, by default all available are filtered.
  4278. @item normalize, n
  4279. Normalize biquad coefficients, by default is disabled.
  4280. Enabling it will normalize magnitude response at DC to 0dB.
  4281. @end table
  4282. @subsection Commands
  4283. This filter supports the following commands:
  4284. @table @option
  4285. @item frequency, f
  4286. Change treble frequency.
  4287. Syntax for the command is : "@var{frequency}"
  4288. @item width_type, t
  4289. Change treble width_type.
  4290. Syntax for the command is : "@var{width_type}"
  4291. @item width, w
  4292. Change treble width.
  4293. Syntax for the command is : "@var{width}"
  4294. @item gain, g
  4295. Change treble gain.
  4296. Syntax for the command is : "@var{gain}"
  4297. @item mix, m
  4298. Change treble mix.
  4299. Syntax for the command is : "@var{mix}"
  4300. @end table
  4301. @section tremolo
  4302. Sinusoidal amplitude modulation.
  4303. The filter accepts the following options:
  4304. @table @option
  4305. @item f
  4306. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4307. (20 Hz or lower) will result in a tremolo effect.
  4308. This filter may also be used as a ring modulator by specifying
  4309. a modulation frequency higher than 20 Hz.
  4310. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4311. @item d
  4312. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4313. Default value is 0.5.
  4314. @end table
  4315. @section vibrato
  4316. Sinusoidal phase modulation.
  4317. The filter accepts the following options:
  4318. @table @option
  4319. @item f
  4320. Modulation frequency in Hertz.
  4321. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4322. @item d
  4323. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4324. Default value is 0.5.
  4325. @end table
  4326. @section volume
  4327. Adjust the input audio volume.
  4328. It accepts the following parameters:
  4329. @table @option
  4330. @item volume
  4331. Set audio volume expression.
  4332. Output values are clipped to the maximum value.
  4333. The output audio volume is given by the relation:
  4334. @example
  4335. @var{output_volume} = @var{volume} * @var{input_volume}
  4336. @end example
  4337. The default value for @var{volume} is "1.0".
  4338. @item precision
  4339. This parameter represents the mathematical precision.
  4340. It determines which input sample formats will be allowed, which affects the
  4341. precision of the volume scaling.
  4342. @table @option
  4343. @item fixed
  4344. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4345. @item float
  4346. 32-bit floating-point; this limits input sample format to FLT. (default)
  4347. @item double
  4348. 64-bit floating-point; this limits input sample format to DBL.
  4349. @end table
  4350. @item replaygain
  4351. Choose the behaviour on encountering ReplayGain side data in input frames.
  4352. @table @option
  4353. @item drop
  4354. Remove ReplayGain side data, ignoring its contents (the default).
  4355. @item ignore
  4356. Ignore ReplayGain side data, but leave it in the frame.
  4357. @item track
  4358. Prefer the track gain, if present.
  4359. @item album
  4360. Prefer the album gain, if present.
  4361. @end table
  4362. @item replaygain_preamp
  4363. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4364. Default value for @var{replaygain_preamp} is 0.0.
  4365. @item replaygain_noclip
  4366. Prevent clipping by limiting the gain applied.
  4367. Default value for @var{replaygain_noclip} is 1.
  4368. @item eval
  4369. Set when the volume expression is evaluated.
  4370. It accepts the following values:
  4371. @table @samp
  4372. @item once
  4373. only evaluate expression once during the filter initialization, or
  4374. when the @samp{volume} command is sent
  4375. @item frame
  4376. evaluate expression for each incoming frame
  4377. @end table
  4378. Default value is @samp{once}.
  4379. @end table
  4380. The volume expression can contain the following parameters.
  4381. @table @option
  4382. @item n
  4383. frame number (starting at zero)
  4384. @item nb_channels
  4385. number of channels
  4386. @item nb_consumed_samples
  4387. number of samples consumed by the filter
  4388. @item nb_samples
  4389. number of samples in the current frame
  4390. @item pos
  4391. original frame position in the file
  4392. @item pts
  4393. frame PTS
  4394. @item sample_rate
  4395. sample rate
  4396. @item startpts
  4397. PTS at start of stream
  4398. @item startt
  4399. time at start of stream
  4400. @item t
  4401. frame time
  4402. @item tb
  4403. timestamp timebase
  4404. @item volume
  4405. last set volume value
  4406. @end table
  4407. Note that when @option{eval} is set to @samp{once} only the
  4408. @var{sample_rate} and @var{tb} variables are available, all other
  4409. variables will evaluate to NAN.
  4410. @subsection Commands
  4411. This filter supports the following commands:
  4412. @table @option
  4413. @item volume
  4414. Modify the volume expression.
  4415. The command accepts the same syntax of the corresponding option.
  4416. If the specified expression is not valid, it is kept at its current
  4417. value.
  4418. @end table
  4419. @subsection Examples
  4420. @itemize
  4421. @item
  4422. Halve the input audio volume:
  4423. @example
  4424. volume=volume=0.5
  4425. volume=volume=1/2
  4426. volume=volume=-6.0206dB
  4427. @end example
  4428. In all the above example the named key for @option{volume} can be
  4429. omitted, for example like in:
  4430. @example
  4431. volume=0.5
  4432. @end example
  4433. @item
  4434. Increase input audio power by 6 decibels using fixed-point precision:
  4435. @example
  4436. volume=volume=6dB:precision=fixed
  4437. @end example
  4438. @item
  4439. Fade volume after time 10 with an annihilation period of 5 seconds:
  4440. @example
  4441. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4442. @end example
  4443. @end itemize
  4444. @section volumedetect
  4445. Detect the volume of the input video.
  4446. The filter has no parameters. The input is not modified. Statistics about
  4447. the volume will be printed in the log when the input stream end is reached.
  4448. In particular it will show the mean volume (root mean square), maximum
  4449. volume (on a per-sample basis), and the beginning of a histogram of the
  4450. registered volume values (from the maximum value to a cumulated 1/1000 of
  4451. the samples).
  4452. All volumes are in decibels relative to the maximum PCM value.
  4453. @subsection Examples
  4454. Here is an excerpt of the output:
  4455. @example
  4456. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4457. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4458. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4459. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4460. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4461. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4462. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4463. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4464. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4465. @end example
  4466. It means that:
  4467. @itemize
  4468. @item
  4469. The mean square energy is approximately -27 dB, or 10^-2.7.
  4470. @item
  4471. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4472. @item
  4473. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4474. @end itemize
  4475. In other words, raising the volume by +4 dB does not cause any clipping,
  4476. raising it by +5 dB causes clipping for 6 samples, etc.
  4477. @c man end AUDIO FILTERS
  4478. @chapter Audio Sources
  4479. @c man begin AUDIO SOURCES
  4480. Below is a description of the currently available audio sources.
  4481. @section abuffer
  4482. Buffer audio frames, and make them available to the filter chain.
  4483. This source is mainly intended for a programmatic use, in particular
  4484. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4485. It accepts the following parameters:
  4486. @table @option
  4487. @item time_base
  4488. The timebase which will be used for timestamps of submitted frames. It must be
  4489. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4490. @item sample_rate
  4491. The sample rate of the incoming audio buffers.
  4492. @item sample_fmt
  4493. The sample format of the incoming audio buffers.
  4494. Either a sample format name or its corresponding integer representation from
  4495. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4496. @item channel_layout
  4497. The channel layout of the incoming audio buffers.
  4498. Either a channel layout name from channel_layout_map in
  4499. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4500. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4501. @item channels
  4502. The number of channels of the incoming audio buffers.
  4503. If both @var{channels} and @var{channel_layout} are specified, then they
  4504. must be consistent.
  4505. @end table
  4506. @subsection Examples
  4507. @example
  4508. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4509. @end example
  4510. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4511. Since the sample format with name "s16p" corresponds to the number
  4512. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4513. equivalent to:
  4514. @example
  4515. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4516. @end example
  4517. @section aevalsrc
  4518. Generate an audio signal specified by an expression.
  4519. This source accepts in input one or more expressions (one for each
  4520. channel), which are evaluated and used to generate a corresponding
  4521. audio signal.
  4522. This source accepts the following options:
  4523. @table @option
  4524. @item exprs
  4525. Set the '|'-separated expressions list for each separate channel. In case the
  4526. @option{channel_layout} option is not specified, the selected channel layout
  4527. depends on the number of provided expressions. Otherwise the last
  4528. specified expression is applied to the remaining output channels.
  4529. @item channel_layout, c
  4530. Set the channel layout. The number of channels in the specified layout
  4531. must be equal to the number of specified expressions.
  4532. @item duration, d
  4533. Set the minimum duration of the sourced audio. See
  4534. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4535. for the accepted syntax.
  4536. Note that the resulting duration may be greater than the specified
  4537. duration, as the generated audio is always cut at the end of a
  4538. complete frame.
  4539. If not specified, or the expressed duration is negative, the audio is
  4540. supposed to be generated forever.
  4541. @item nb_samples, n
  4542. Set the number of samples per channel per each output frame,
  4543. default to 1024.
  4544. @item sample_rate, s
  4545. Specify the sample rate, default to 44100.
  4546. @end table
  4547. Each expression in @var{exprs} can contain the following constants:
  4548. @table @option
  4549. @item n
  4550. number of the evaluated sample, starting from 0
  4551. @item t
  4552. time of the evaluated sample expressed in seconds, starting from 0
  4553. @item s
  4554. sample rate
  4555. @end table
  4556. @subsection Examples
  4557. @itemize
  4558. @item
  4559. Generate silence:
  4560. @example
  4561. aevalsrc=0
  4562. @end example
  4563. @item
  4564. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4565. 8000 Hz:
  4566. @example
  4567. aevalsrc="sin(440*2*PI*t):s=8000"
  4568. @end example
  4569. @item
  4570. Generate a two channels signal, specify the channel layout (Front
  4571. Center + Back Center) explicitly:
  4572. @example
  4573. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4574. @end example
  4575. @item
  4576. Generate white noise:
  4577. @example
  4578. aevalsrc="-2+random(0)"
  4579. @end example
  4580. @item
  4581. Generate an amplitude modulated signal:
  4582. @example
  4583. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4584. @end example
  4585. @item
  4586. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4587. @example
  4588. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4589. @end example
  4590. @end itemize
  4591. @section afirsrc
  4592. Generate a FIR coefficients using frequency sampling method.
  4593. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4594. The filter accepts the following options:
  4595. @table @option
  4596. @item taps, t
  4597. Set number of filter coefficents in output audio stream.
  4598. Default value is 1025.
  4599. @item frequency, f
  4600. Set frequency points from where magnitude and phase are set.
  4601. This must be in non decreasing order, and first element must be 0, while last element
  4602. must be 1. Elements are separated by white spaces.
  4603. @item magnitude, m
  4604. Set magnitude value for every frequency point set by @option{frequency}.
  4605. Number of values must be same as number of frequency points.
  4606. Values are separated by white spaces.
  4607. @item phase, p
  4608. Set phase value for every frequency point set by @option{frequency}.
  4609. Number of values must be same as number of frequency points.
  4610. Values are separated by white spaces.
  4611. @item sample_rate, r
  4612. Set sample rate, default is 44100.
  4613. @item nb_samples, n
  4614. Set number of samples per each frame. Default is 1024.
  4615. @item win_func, w
  4616. Set window function. Default is blackman.
  4617. @end table
  4618. @section anullsrc
  4619. The null audio source, return unprocessed audio frames. It is mainly useful
  4620. as a template and to be employed in analysis / debugging tools, or as
  4621. the source for filters which ignore the input data (for example the sox
  4622. synth filter).
  4623. This source accepts the following options:
  4624. @table @option
  4625. @item channel_layout, cl
  4626. Specifies the channel layout, and can be either an integer or a string
  4627. representing a channel layout. The default value of @var{channel_layout}
  4628. is "stereo".
  4629. Check the channel_layout_map definition in
  4630. @file{libavutil/channel_layout.c} for the mapping between strings and
  4631. channel layout values.
  4632. @item sample_rate, r
  4633. Specifies the sample rate, and defaults to 44100.
  4634. @item nb_samples, n
  4635. Set the number of samples per requested frames.
  4636. @end table
  4637. @subsection Examples
  4638. @itemize
  4639. @item
  4640. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4641. @example
  4642. anullsrc=r=48000:cl=4
  4643. @end example
  4644. @item
  4645. Do the same operation with a more obvious syntax:
  4646. @example
  4647. anullsrc=r=48000:cl=mono
  4648. @end example
  4649. @end itemize
  4650. All the parameters need to be explicitly defined.
  4651. @section flite
  4652. Synthesize a voice utterance using the libflite library.
  4653. To enable compilation of this filter you need to configure FFmpeg with
  4654. @code{--enable-libflite}.
  4655. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4656. The filter accepts the following options:
  4657. @table @option
  4658. @item list_voices
  4659. If set to 1, list the names of the available voices and exit
  4660. immediately. Default value is 0.
  4661. @item nb_samples, n
  4662. Set the maximum number of samples per frame. Default value is 512.
  4663. @item textfile
  4664. Set the filename containing the text to speak.
  4665. @item text
  4666. Set the text to speak.
  4667. @item voice, v
  4668. Set the voice to use for the speech synthesis. Default value is
  4669. @code{kal}. See also the @var{list_voices} option.
  4670. @end table
  4671. @subsection Examples
  4672. @itemize
  4673. @item
  4674. Read from file @file{speech.txt}, and synthesize the text using the
  4675. standard flite voice:
  4676. @example
  4677. flite=textfile=speech.txt
  4678. @end example
  4679. @item
  4680. Read the specified text selecting the @code{slt} voice:
  4681. @example
  4682. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4683. @end example
  4684. @item
  4685. Input text to ffmpeg:
  4686. @example
  4687. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4688. @end example
  4689. @item
  4690. Make @file{ffplay} speak the specified text, using @code{flite} and
  4691. the @code{lavfi} device:
  4692. @example
  4693. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4694. @end example
  4695. @end itemize
  4696. For more information about libflite, check:
  4697. @url{http://www.festvox.org/flite/}
  4698. @section anoisesrc
  4699. Generate a noise audio signal.
  4700. The filter accepts the following options:
  4701. @table @option
  4702. @item sample_rate, r
  4703. Specify the sample rate. Default value is 48000 Hz.
  4704. @item amplitude, a
  4705. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4706. is 1.0.
  4707. @item duration, d
  4708. Specify the duration of the generated audio stream. Not specifying this option
  4709. results in noise with an infinite length.
  4710. @item color, colour, c
  4711. Specify the color of noise. Available noise colors are white, pink, brown,
  4712. blue, violet and velvet. Default color is white.
  4713. @item seed, s
  4714. Specify a value used to seed the PRNG.
  4715. @item nb_samples, n
  4716. Set the number of samples per each output frame, default is 1024.
  4717. @end table
  4718. @subsection Examples
  4719. @itemize
  4720. @item
  4721. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4722. @example
  4723. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4724. @end example
  4725. @end itemize
  4726. @section hilbert
  4727. Generate odd-tap Hilbert transform FIR coefficients.
  4728. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4729. the signal by 90 degrees.
  4730. This is used in many matrix coding schemes and for analytic signal generation.
  4731. The process is often written as a multiplication by i (or j), the imaginary unit.
  4732. The filter accepts the following options:
  4733. @table @option
  4734. @item sample_rate, s
  4735. Set sample rate, default is 44100.
  4736. @item taps, t
  4737. Set length of FIR filter, default is 22051.
  4738. @item nb_samples, n
  4739. Set number of samples per each frame.
  4740. @item win_func, w
  4741. Set window function to be used when generating FIR coefficients.
  4742. @end table
  4743. @section sinc
  4744. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4745. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4746. The filter accepts the following options:
  4747. @table @option
  4748. @item sample_rate, r
  4749. Set sample rate, default is 44100.
  4750. @item nb_samples, n
  4751. Set number of samples per each frame. Default is 1024.
  4752. @item hp
  4753. Set high-pass frequency. Default is 0.
  4754. @item lp
  4755. Set low-pass frequency. Default is 0.
  4756. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4757. is higher than 0 then filter will create band-pass filter coefficients,
  4758. otherwise band-reject filter coefficients.
  4759. @item phase
  4760. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4761. @item beta
  4762. Set Kaiser window beta.
  4763. @item att
  4764. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4765. @item round
  4766. Enable rounding, by default is disabled.
  4767. @item hptaps
  4768. Set number of taps for high-pass filter.
  4769. @item lptaps
  4770. Set number of taps for low-pass filter.
  4771. @end table
  4772. @section sine
  4773. Generate an audio signal made of a sine wave with amplitude 1/8.
  4774. The audio signal is bit-exact.
  4775. The filter accepts the following options:
  4776. @table @option
  4777. @item frequency, f
  4778. Set the carrier frequency. Default is 440 Hz.
  4779. @item beep_factor, b
  4780. Enable a periodic beep every second with frequency @var{beep_factor} times
  4781. the carrier frequency. Default is 0, meaning the beep is disabled.
  4782. @item sample_rate, r
  4783. Specify the sample rate, default is 44100.
  4784. @item duration, d
  4785. Specify the duration of the generated audio stream.
  4786. @item samples_per_frame
  4787. Set the number of samples per output frame.
  4788. The expression can contain the following constants:
  4789. @table @option
  4790. @item n
  4791. The (sequential) number of the output audio frame, starting from 0.
  4792. @item pts
  4793. The PTS (Presentation TimeStamp) of the output audio frame,
  4794. expressed in @var{TB} units.
  4795. @item t
  4796. The PTS of the output audio frame, expressed in seconds.
  4797. @item TB
  4798. The timebase of the output audio frames.
  4799. @end table
  4800. Default is @code{1024}.
  4801. @end table
  4802. @subsection Examples
  4803. @itemize
  4804. @item
  4805. Generate a simple 440 Hz sine wave:
  4806. @example
  4807. sine
  4808. @end example
  4809. @item
  4810. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4811. @example
  4812. sine=220:4:d=5
  4813. sine=f=220:b=4:d=5
  4814. sine=frequency=220:beep_factor=4:duration=5
  4815. @end example
  4816. @item
  4817. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4818. pattern:
  4819. @example
  4820. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4821. @end example
  4822. @end itemize
  4823. @c man end AUDIO SOURCES
  4824. @chapter Audio Sinks
  4825. @c man begin AUDIO SINKS
  4826. Below is a description of the currently available audio sinks.
  4827. @section abuffersink
  4828. Buffer audio frames, and make them available to the end of filter chain.
  4829. This sink is mainly intended for programmatic use, in particular
  4830. through the interface defined in @file{libavfilter/buffersink.h}
  4831. or the options system.
  4832. It accepts a pointer to an AVABufferSinkContext structure, which
  4833. defines the incoming buffers' formats, to be passed as the opaque
  4834. parameter to @code{avfilter_init_filter} for initialization.
  4835. @section anullsink
  4836. Null audio sink; do absolutely nothing with the input audio. It is
  4837. mainly useful as a template and for use in analysis / debugging
  4838. tools.
  4839. @c man end AUDIO SINKS
  4840. @chapter Video Filters
  4841. @c man begin VIDEO FILTERS
  4842. When you configure your FFmpeg build, you can disable any of the
  4843. existing filters using @code{--disable-filters}.
  4844. The configure output will show the video filters included in your
  4845. build.
  4846. Below is a description of the currently available video filters.
  4847. @section addroi
  4848. Mark a region of interest in a video frame.
  4849. The frame data is passed through unchanged, but metadata is attached
  4850. to the frame indicating regions of interest which can affect the
  4851. behaviour of later encoding. Multiple regions can be marked by
  4852. applying the filter multiple times.
  4853. @table @option
  4854. @item x
  4855. Region distance in pixels from the left edge of the frame.
  4856. @item y
  4857. Region distance in pixels from the top edge of the frame.
  4858. @item w
  4859. Region width in pixels.
  4860. @item h
  4861. Region height in pixels.
  4862. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4863. and may contain the following variables:
  4864. @table @option
  4865. @item iw
  4866. Width of the input frame.
  4867. @item ih
  4868. Height of the input frame.
  4869. @end table
  4870. @item qoffset
  4871. Quantisation offset to apply within the region.
  4872. This must be a real value in the range -1 to +1. A value of zero
  4873. indicates no quality change. A negative value asks for better quality
  4874. (less quantisation), while a positive value asks for worse quality
  4875. (greater quantisation).
  4876. The range is calibrated so that the extreme values indicate the
  4877. largest possible offset - if the rest of the frame is encoded with the
  4878. worst possible quality, an offset of -1 indicates that this region
  4879. should be encoded with the best possible quality anyway. Intermediate
  4880. values are then interpolated in some codec-dependent way.
  4881. For example, in 10-bit H.264 the quantisation parameter varies between
  4882. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4883. this region should be encoded with a QP around one-tenth of the full
  4884. range better than the rest of the frame. So, if most of the frame
  4885. were to be encoded with a QP of around 30, this region would get a QP
  4886. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4887. An extreme value of -1 would indicate that this region should be
  4888. encoded with the best possible quality regardless of the treatment of
  4889. the rest of the frame - that is, should be encoded at a QP of -12.
  4890. @item clear
  4891. If set to true, remove any existing regions of interest marked on the
  4892. frame before adding the new one.
  4893. @end table
  4894. @subsection Examples
  4895. @itemize
  4896. @item
  4897. Mark the centre quarter of the frame as interesting.
  4898. @example
  4899. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4900. @end example
  4901. @item
  4902. Mark the 100-pixel-wide region on the left edge of the frame as very
  4903. uninteresting (to be encoded at much lower quality than the rest of
  4904. the frame).
  4905. @example
  4906. addroi=0:0:100:ih:+1/5
  4907. @end example
  4908. @end itemize
  4909. @section alphaextract
  4910. Extract the alpha component from the input as a grayscale video. This
  4911. is especially useful with the @var{alphamerge} filter.
  4912. @section alphamerge
  4913. Add or replace the alpha component of the primary input with the
  4914. grayscale value of a second input. This is intended for use with
  4915. @var{alphaextract} to allow the transmission or storage of frame
  4916. sequences that have alpha in a format that doesn't support an alpha
  4917. channel.
  4918. For example, to reconstruct full frames from a normal YUV-encoded video
  4919. and a separate video created with @var{alphaextract}, you might use:
  4920. @example
  4921. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4922. @end example
  4923. Since this filter is designed for reconstruction, it operates on frame
  4924. sequences without considering timestamps, and terminates when either
  4925. input reaches end of stream. This will cause problems if your encoding
  4926. pipeline drops frames. If you're trying to apply an image as an
  4927. overlay to a video stream, consider the @var{overlay} filter instead.
  4928. @section amplify
  4929. Amplify differences between current pixel and pixels of adjacent frames in
  4930. same pixel location.
  4931. This filter accepts the following options:
  4932. @table @option
  4933. @item radius
  4934. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4935. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4936. @item factor
  4937. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4938. @item threshold
  4939. Set threshold for difference amplification. Any difference greater or equal to
  4940. this value will not alter source pixel. Default is 10.
  4941. Allowed range is from 0 to 65535.
  4942. @item tolerance
  4943. Set tolerance for difference amplification. Any difference lower to
  4944. this value will not alter source pixel. Default is 0.
  4945. Allowed range is from 0 to 65535.
  4946. @item low
  4947. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4948. This option controls maximum possible value that will decrease source pixel value.
  4949. @item high
  4950. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4951. This option controls maximum possible value that will increase source pixel value.
  4952. @item planes
  4953. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4954. @end table
  4955. @subsection Commands
  4956. This filter supports the following @ref{commands} that corresponds to option of same name:
  4957. @table @option
  4958. @item factor
  4959. @item threshold
  4960. @item tolerance
  4961. @item low
  4962. @item high
  4963. @item planes
  4964. @end table
  4965. @section ass
  4966. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4967. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4968. Substation Alpha) subtitles files.
  4969. This filter accepts the following option in addition to the common options from
  4970. the @ref{subtitles} filter:
  4971. @table @option
  4972. @item shaping
  4973. Set the shaping engine
  4974. Available values are:
  4975. @table @samp
  4976. @item auto
  4977. The default libass shaping engine, which is the best available.
  4978. @item simple
  4979. Fast, font-agnostic shaper that can do only substitutions
  4980. @item complex
  4981. Slower shaper using OpenType for substitutions and positioning
  4982. @end table
  4983. The default is @code{auto}.
  4984. @end table
  4985. @section atadenoise
  4986. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4987. The filter accepts the following options:
  4988. @table @option
  4989. @item 0a
  4990. Set threshold A for 1st plane. Default is 0.02.
  4991. Valid range is 0 to 0.3.
  4992. @item 0b
  4993. Set threshold B for 1st plane. Default is 0.04.
  4994. Valid range is 0 to 5.
  4995. @item 1a
  4996. Set threshold A for 2nd plane. Default is 0.02.
  4997. Valid range is 0 to 0.3.
  4998. @item 1b
  4999. Set threshold B for 2nd plane. Default is 0.04.
  5000. Valid range is 0 to 5.
  5001. @item 2a
  5002. Set threshold A for 3rd plane. Default is 0.02.
  5003. Valid range is 0 to 0.3.
  5004. @item 2b
  5005. Set threshold B for 3rd plane. Default is 0.04.
  5006. Valid range is 0 to 5.
  5007. Threshold A is designed to react on abrupt changes in the input signal and
  5008. threshold B is designed to react on continuous changes in the input signal.
  5009. @item s
  5010. Set number of frames filter will use for averaging. Default is 9. Must be odd
  5011. number in range [5, 129].
  5012. @item p
  5013. Set what planes of frame filter will use for averaging. Default is all.
  5014. @item a
  5015. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  5016. Alternatively can be set to @code{s} serial.
  5017. Parallel can be faster then serial, while other way around is never true.
  5018. Parallel will abort early on first change being greater then thresholds, while serial
  5019. will continue processing other side of frames if they are equal or bellow thresholds.
  5020. @end table
  5021. @subsection Commands
  5022. This filter supports same @ref{commands} as options except option @code{s}.
  5023. The command accepts the same syntax of the corresponding option.
  5024. @section avgblur
  5025. Apply average blur filter.
  5026. The filter accepts the following options:
  5027. @table @option
  5028. @item sizeX
  5029. Set horizontal radius size.
  5030. @item planes
  5031. Set which planes to filter. By default all planes are filtered.
  5032. @item sizeY
  5033. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5034. Default is @code{0}.
  5035. @end table
  5036. @subsection Commands
  5037. This filter supports same commands as options.
  5038. The command accepts the same syntax of the corresponding option.
  5039. If the specified expression is not valid, it is kept at its current
  5040. value.
  5041. @section bbox
  5042. Compute the bounding box for the non-black pixels in the input frame
  5043. luminance plane.
  5044. This filter computes the bounding box containing all the pixels with a
  5045. luminance value greater than the minimum allowed value.
  5046. The parameters describing the bounding box are printed on the filter
  5047. log.
  5048. The filter accepts the following option:
  5049. @table @option
  5050. @item min_val
  5051. Set the minimal luminance value. Default is @code{16}.
  5052. @end table
  5053. @section bilateral
  5054. Apply bilateral filter, spatial smoothing while preserving edges.
  5055. The filter accepts the following options:
  5056. @table @option
  5057. @item sigmaS
  5058. Set sigma of gaussian function to calculate spatial weight.
  5059. Allowed range is 0 to 10. Default is 0.1.
  5060. @item sigmaR
  5061. Set sigma of gaussian function to calculate range weight.
  5062. Allowed range is 0 to 1. Default is 0.1.
  5063. @item planes
  5064. Set planes to filter. Default is first only.
  5065. @end table
  5066. @section bitplanenoise
  5067. Show and measure bit plane noise.
  5068. The filter accepts the following options:
  5069. @table @option
  5070. @item bitplane
  5071. Set which plane to analyze. Default is @code{1}.
  5072. @item filter
  5073. Filter out noisy pixels from @code{bitplane} set above.
  5074. Default is disabled.
  5075. @end table
  5076. @section blackdetect
  5077. Detect video intervals that are (almost) completely black. Can be
  5078. useful to detect chapter transitions, commercials, or invalid
  5079. recordings.
  5080. The filter outputs its detection analysis to both the log as well as
  5081. frame metadata. If a black segment of at least the specified minimum
  5082. duration is found, a line with the start and end timestamps as well
  5083. as duration is printed to the log with level @code{info}. In addition,
  5084. a log line with level @code{debug} is printed per frame showing the
  5085. black amount detected for that frame.
  5086. The filter also attaches metadata to the first frame of a black
  5087. segment with key @code{lavfi.black_start} and to the first frame
  5088. after the black segment ends with key @code{lavfi.black_end}. The
  5089. value is the frame's timestamp. This metadata is added regardless
  5090. of the minimum duration specified.
  5091. The filter accepts the following options:
  5092. @table @option
  5093. @item black_min_duration, d
  5094. Set the minimum detected black duration expressed in seconds. It must
  5095. be a non-negative floating point number.
  5096. Default value is 2.0.
  5097. @item picture_black_ratio_th, pic_th
  5098. Set the threshold for considering a picture "black".
  5099. Express the minimum value for the ratio:
  5100. @example
  5101. @var{nb_black_pixels} / @var{nb_pixels}
  5102. @end example
  5103. for which a picture is considered black.
  5104. Default value is 0.98.
  5105. @item pixel_black_th, pix_th
  5106. Set the threshold for considering a pixel "black".
  5107. The threshold expresses the maximum pixel luminance value for which a
  5108. pixel is considered "black". The provided value is scaled according to
  5109. the following equation:
  5110. @example
  5111. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5112. @end example
  5113. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5114. the input video format, the range is [0-255] for YUV full-range
  5115. formats and [16-235] for YUV non full-range formats.
  5116. Default value is 0.10.
  5117. @end table
  5118. The following example sets the maximum pixel threshold to the minimum
  5119. value, and detects only black intervals of 2 or more seconds:
  5120. @example
  5121. blackdetect=d=2:pix_th=0.00
  5122. @end example
  5123. @section blackframe
  5124. Detect frames that are (almost) completely black. Can be useful to
  5125. detect chapter transitions or commercials. Output lines consist of
  5126. the frame number of the detected frame, the percentage of blackness,
  5127. the position in the file if known or -1 and the timestamp in seconds.
  5128. In order to display the output lines, you need to set the loglevel at
  5129. least to the AV_LOG_INFO value.
  5130. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5131. The value represents the percentage of pixels in the picture that
  5132. are below the threshold value.
  5133. It accepts the following parameters:
  5134. @table @option
  5135. @item amount
  5136. The percentage of the pixels that have to be below the threshold; it defaults to
  5137. @code{98}.
  5138. @item threshold, thresh
  5139. The threshold below which a pixel value is considered black; it defaults to
  5140. @code{32}.
  5141. @end table
  5142. @anchor{blend}
  5143. @section blend
  5144. Blend two video frames into each other.
  5145. The @code{blend} filter takes two input streams and outputs one
  5146. stream, the first input is the "top" layer and second input is
  5147. "bottom" layer. By default, the output terminates when the longest input terminates.
  5148. The @code{tblend} (time blend) filter takes two consecutive frames
  5149. from one single stream, and outputs the result obtained by blending
  5150. the new frame on top of the old frame.
  5151. A description of the accepted options follows.
  5152. @table @option
  5153. @item c0_mode
  5154. @item c1_mode
  5155. @item c2_mode
  5156. @item c3_mode
  5157. @item all_mode
  5158. Set blend mode for specific pixel component or all pixel components in case
  5159. of @var{all_mode}. Default value is @code{normal}.
  5160. Available values for component modes are:
  5161. @table @samp
  5162. @item addition
  5163. @item grainmerge
  5164. @item and
  5165. @item average
  5166. @item burn
  5167. @item darken
  5168. @item difference
  5169. @item grainextract
  5170. @item divide
  5171. @item dodge
  5172. @item freeze
  5173. @item exclusion
  5174. @item extremity
  5175. @item glow
  5176. @item hardlight
  5177. @item hardmix
  5178. @item heat
  5179. @item lighten
  5180. @item linearlight
  5181. @item multiply
  5182. @item multiply128
  5183. @item negation
  5184. @item normal
  5185. @item or
  5186. @item overlay
  5187. @item phoenix
  5188. @item pinlight
  5189. @item reflect
  5190. @item screen
  5191. @item softlight
  5192. @item subtract
  5193. @item vividlight
  5194. @item xor
  5195. @end table
  5196. @item c0_opacity
  5197. @item c1_opacity
  5198. @item c2_opacity
  5199. @item c3_opacity
  5200. @item all_opacity
  5201. Set blend opacity for specific pixel component or all pixel components in case
  5202. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5203. @item c0_expr
  5204. @item c1_expr
  5205. @item c2_expr
  5206. @item c3_expr
  5207. @item all_expr
  5208. Set blend expression for specific pixel component or all pixel components in case
  5209. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5210. The expressions can use the following variables:
  5211. @table @option
  5212. @item N
  5213. The sequential number of the filtered frame, starting from @code{0}.
  5214. @item X
  5215. @item Y
  5216. the coordinates of the current sample
  5217. @item W
  5218. @item H
  5219. the width and height of currently filtered plane
  5220. @item SW
  5221. @item SH
  5222. Width and height scale for the plane being filtered. It is the
  5223. ratio between the dimensions of the current plane to the luma plane,
  5224. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5225. the luma plane and @code{0.5,0.5} for the chroma planes.
  5226. @item T
  5227. Time of the current frame, expressed in seconds.
  5228. @item TOP, A
  5229. Value of pixel component at current location for first video frame (top layer).
  5230. @item BOTTOM, B
  5231. Value of pixel component at current location for second video frame (bottom layer).
  5232. @end table
  5233. @end table
  5234. The @code{blend} filter also supports the @ref{framesync} options.
  5235. @subsection Examples
  5236. @itemize
  5237. @item
  5238. Apply transition from bottom layer to top layer in first 10 seconds:
  5239. @example
  5240. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5241. @end example
  5242. @item
  5243. Apply linear horizontal transition from top layer to bottom layer:
  5244. @example
  5245. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5246. @end example
  5247. @item
  5248. Apply 1x1 checkerboard effect:
  5249. @example
  5250. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5251. @end example
  5252. @item
  5253. Apply uncover left effect:
  5254. @example
  5255. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5256. @end example
  5257. @item
  5258. Apply uncover down effect:
  5259. @example
  5260. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5261. @end example
  5262. @item
  5263. Apply uncover up-left effect:
  5264. @example
  5265. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5266. @end example
  5267. @item
  5268. Split diagonally video and shows top and bottom layer on each side:
  5269. @example
  5270. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5271. @end example
  5272. @item
  5273. Display differences between the current and the previous frame:
  5274. @example
  5275. tblend=all_mode=grainextract
  5276. @end example
  5277. @end itemize
  5278. @section bm3d
  5279. Denoise frames using Block-Matching 3D algorithm.
  5280. The filter accepts the following options.
  5281. @table @option
  5282. @item sigma
  5283. Set denoising strength. Default value is 1.
  5284. Allowed range is from 0 to 999.9.
  5285. The denoising algorithm is very sensitive to sigma, so adjust it
  5286. according to the source.
  5287. @item block
  5288. Set local patch size. This sets dimensions in 2D.
  5289. @item bstep
  5290. Set sliding step for processing blocks. Default value is 4.
  5291. Allowed range is from 1 to 64.
  5292. Smaller values allows processing more reference blocks and is slower.
  5293. @item group
  5294. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5295. When set to 1, no block matching is done. Larger values allows more blocks
  5296. in single group.
  5297. Allowed range is from 1 to 256.
  5298. @item range
  5299. Set radius for search block matching. Default is 9.
  5300. Allowed range is from 1 to INT32_MAX.
  5301. @item mstep
  5302. Set step between two search locations for block matching. Default is 1.
  5303. Allowed range is from 1 to 64. Smaller is slower.
  5304. @item thmse
  5305. Set threshold of mean square error for block matching. Valid range is 0 to
  5306. INT32_MAX.
  5307. @item hdthr
  5308. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5309. Larger values results in stronger hard-thresholding filtering in frequency
  5310. domain.
  5311. @item estim
  5312. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5313. Default is @code{basic}.
  5314. @item ref
  5315. If enabled, filter will use 2nd stream for block matching.
  5316. Default is disabled for @code{basic} value of @var{estim} option,
  5317. and always enabled if value of @var{estim} is @code{final}.
  5318. @item planes
  5319. Set planes to filter. Default is all available except alpha.
  5320. @end table
  5321. @subsection Examples
  5322. @itemize
  5323. @item
  5324. Basic filtering with bm3d:
  5325. @example
  5326. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5327. @end example
  5328. @item
  5329. Same as above, but filtering only luma:
  5330. @example
  5331. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5332. @end example
  5333. @item
  5334. Same as above, but with both estimation modes:
  5335. @example
  5336. 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
  5337. @end example
  5338. @item
  5339. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5340. @example
  5341. 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
  5342. @end example
  5343. @end itemize
  5344. @section boxblur
  5345. Apply a boxblur algorithm to the input video.
  5346. It accepts the following parameters:
  5347. @table @option
  5348. @item luma_radius, lr
  5349. @item luma_power, lp
  5350. @item chroma_radius, cr
  5351. @item chroma_power, cp
  5352. @item alpha_radius, ar
  5353. @item alpha_power, ap
  5354. @end table
  5355. A description of the accepted options follows.
  5356. @table @option
  5357. @item luma_radius, lr
  5358. @item chroma_radius, cr
  5359. @item alpha_radius, ar
  5360. Set an expression for the box radius in pixels used for blurring the
  5361. corresponding input plane.
  5362. The radius value must be a non-negative number, and must not be
  5363. greater than the value of the expression @code{min(w,h)/2} for the
  5364. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5365. planes.
  5366. Default value for @option{luma_radius} is "2". If not specified,
  5367. @option{chroma_radius} and @option{alpha_radius} default to the
  5368. corresponding value set for @option{luma_radius}.
  5369. The expressions can contain the following constants:
  5370. @table @option
  5371. @item w
  5372. @item h
  5373. The input width and height in pixels.
  5374. @item cw
  5375. @item ch
  5376. The input chroma image width and height in pixels.
  5377. @item hsub
  5378. @item vsub
  5379. The horizontal and vertical chroma subsample values. For example, for the
  5380. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5381. @end table
  5382. @item luma_power, lp
  5383. @item chroma_power, cp
  5384. @item alpha_power, ap
  5385. Specify how many times the boxblur filter is applied to the
  5386. corresponding plane.
  5387. Default value for @option{luma_power} is 2. If not specified,
  5388. @option{chroma_power} and @option{alpha_power} default to the
  5389. corresponding value set for @option{luma_power}.
  5390. A value of 0 will disable the effect.
  5391. @end table
  5392. @subsection Examples
  5393. @itemize
  5394. @item
  5395. Apply a boxblur filter with the luma, chroma, and alpha radii
  5396. set to 2:
  5397. @example
  5398. boxblur=luma_radius=2:luma_power=1
  5399. boxblur=2:1
  5400. @end example
  5401. @item
  5402. Set the luma radius to 2, and alpha and chroma radius to 0:
  5403. @example
  5404. boxblur=2:1:cr=0:ar=0
  5405. @end example
  5406. @item
  5407. Set the luma and chroma radii to a fraction of the video dimension:
  5408. @example
  5409. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5410. @end example
  5411. @end itemize
  5412. @section bwdif
  5413. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5414. Deinterlacing Filter").
  5415. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5416. interpolation algorithms.
  5417. It accepts the following parameters:
  5418. @table @option
  5419. @item mode
  5420. The interlacing mode to adopt. It accepts one of the following values:
  5421. @table @option
  5422. @item 0, send_frame
  5423. Output one frame for each frame.
  5424. @item 1, send_field
  5425. Output one frame for each field.
  5426. @end table
  5427. The default value is @code{send_field}.
  5428. @item parity
  5429. The picture field parity assumed for the input interlaced video. It accepts one
  5430. of the following values:
  5431. @table @option
  5432. @item 0, tff
  5433. Assume the top field is first.
  5434. @item 1, bff
  5435. Assume the bottom field is first.
  5436. @item -1, auto
  5437. Enable automatic detection of field parity.
  5438. @end table
  5439. The default value is @code{auto}.
  5440. If the interlacing is unknown or the decoder does not export this information,
  5441. top field first will be assumed.
  5442. @item deint
  5443. Specify which frames to deinterlace. Accepts one of the following
  5444. values:
  5445. @table @option
  5446. @item 0, all
  5447. Deinterlace all frames.
  5448. @item 1, interlaced
  5449. Only deinterlace frames marked as interlaced.
  5450. @end table
  5451. The default value is @code{all}.
  5452. @end table
  5453. @section cas
  5454. Apply Contrast Adaptive Sharpen filter to video stream.
  5455. The filter accepts the following options:
  5456. @table @option
  5457. @item strength
  5458. Set the sharpening strength. Default value is 0.
  5459. @item planes
  5460. Set planes to filter. Default value is to filter all
  5461. planes except alpha plane.
  5462. @end table
  5463. @section chromahold
  5464. Remove all color information for all colors except for certain one.
  5465. The filter accepts the following options:
  5466. @table @option
  5467. @item color
  5468. The color which will not be replaced with neutral chroma.
  5469. @item similarity
  5470. Similarity percentage with the above color.
  5471. 0.01 matches only the exact key color, while 1.0 matches everything.
  5472. @item blend
  5473. Blend percentage.
  5474. 0.0 makes pixels either fully gray, or not gray at all.
  5475. Higher values result in more preserved color.
  5476. @item yuv
  5477. Signals that the color passed is already in YUV instead of RGB.
  5478. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5479. This can be used to pass exact YUV values as hexadecimal numbers.
  5480. @end table
  5481. @subsection Commands
  5482. This filter supports same @ref{commands} as options.
  5483. The command accepts the same syntax of the corresponding option.
  5484. If the specified expression is not valid, it is kept at its current
  5485. value.
  5486. @section chromakey
  5487. YUV colorspace color/chroma keying.
  5488. The filter accepts the following options:
  5489. @table @option
  5490. @item color
  5491. The color which will be replaced with transparency.
  5492. @item similarity
  5493. Similarity percentage with the key color.
  5494. 0.01 matches only the exact key color, while 1.0 matches everything.
  5495. @item blend
  5496. Blend percentage.
  5497. 0.0 makes pixels either fully transparent, or not transparent at all.
  5498. Higher values result in semi-transparent pixels, with a higher transparency
  5499. the more similar the pixels color is to the key color.
  5500. @item yuv
  5501. Signals that the color passed is already in YUV instead of RGB.
  5502. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5503. This can be used to pass exact YUV values as hexadecimal numbers.
  5504. @end table
  5505. @subsection Commands
  5506. This filter supports same @ref{commands} as options.
  5507. The command accepts the same syntax of the corresponding option.
  5508. If the specified expression is not valid, it is kept at its current
  5509. value.
  5510. @subsection Examples
  5511. @itemize
  5512. @item
  5513. Make every green pixel in the input image transparent:
  5514. @example
  5515. ffmpeg -i input.png -vf chromakey=green out.png
  5516. @end example
  5517. @item
  5518. Overlay a greenscreen-video on top of a static black background.
  5519. @example
  5520. 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
  5521. @end example
  5522. @end itemize
  5523. @section chromashift
  5524. Shift chroma pixels horizontally and/or vertically.
  5525. The filter accepts the following options:
  5526. @table @option
  5527. @item cbh
  5528. Set amount to shift chroma-blue horizontally.
  5529. @item cbv
  5530. Set amount to shift chroma-blue vertically.
  5531. @item crh
  5532. Set amount to shift chroma-red horizontally.
  5533. @item crv
  5534. Set amount to shift chroma-red vertically.
  5535. @item edge
  5536. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5537. @end table
  5538. @subsection Commands
  5539. This filter supports the all above options as @ref{commands}.
  5540. @section ciescope
  5541. Display CIE color diagram with pixels overlaid onto it.
  5542. The filter accepts the following options:
  5543. @table @option
  5544. @item system
  5545. Set color system.
  5546. @table @samp
  5547. @item ntsc, 470m
  5548. @item ebu, 470bg
  5549. @item smpte
  5550. @item 240m
  5551. @item apple
  5552. @item widergb
  5553. @item cie1931
  5554. @item rec709, hdtv
  5555. @item uhdtv, rec2020
  5556. @item dcip3
  5557. @end table
  5558. @item cie
  5559. Set CIE system.
  5560. @table @samp
  5561. @item xyy
  5562. @item ucs
  5563. @item luv
  5564. @end table
  5565. @item gamuts
  5566. Set what gamuts to draw.
  5567. See @code{system} option for available values.
  5568. @item size, s
  5569. Set ciescope size, by default set to 512.
  5570. @item intensity, i
  5571. Set intensity used to map input pixel values to CIE diagram.
  5572. @item contrast
  5573. Set contrast used to draw tongue colors that are out of active color system gamut.
  5574. @item corrgamma
  5575. Correct gamma displayed on scope, by default enabled.
  5576. @item showwhite
  5577. Show white point on CIE diagram, by default disabled.
  5578. @item gamma
  5579. Set input gamma. Used only with XYZ input color space.
  5580. @end table
  5581. @section codecview
  5582. Visualize information exported by some codecs.
  5583. Some codecs can export information through frames using side-data or other
  5584. means. For example, some MPEG based codecs export motion vectors through the
  5585. @var{export_mvs} flag in the codec @option{flags2} option.
  5586. The filter accepts the following option:
  5587. @table @option
  5588. @item mv
  5589. Set motion vectors to visualize.
  5590. Available flags for @var{mv} are:
  5591. @table @samp
  5592. @item pf
  5593. forward predicted MVs of P-frames
  5594. @item bf
  5595. forward predicted MVs of B-frames
  5596. @item bb
  5597. backward predicted MVs of B-frames
  5598. @end table
  5599. @item qp
  5600. Display quantization parameters using the chroma planes.
  5601. @item mv_type, mvt
  5602. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5603. Available flags for @var{mv_type} are:
  5604. @table @samp
  5605. @item fp
  5606. forward predicted MVs
  5607. @item bp
  5608. backward predicted MVs
  5609. @end table
  5610. @item frame_type, ft
  5611. Set frame type to visualize motion vectors of.
  5612. Available flags for @var{frame_type} are:
  5613. @table @samp
  5614. @item if
  5615. intra-coded frames (I-frames)
  5616. @item pf
  5617. predicted frames (P-frames)
  5618. @item bf
  5619. bi-directionally predicted frames (B-frames)
  5620. @end table
  5621. @end table
  5622. @subsection Examples
  5623. @itemize
  5624. @item
  5625. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5626. @example
  5627. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5628. @end example
  5629. @item
  5630. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5631. @example
  5632. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5633. @end example
  5634. @end itemize
  5635. @section colorbalance
  5636. Modify intensity of primary colors (red, green and blue) of input frames.
  5637. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5638. regions for the red-cyan, green-magenta or blue-yellow balance.
  5639. A positive adjustment value shifts the balance towards the primary color, a negative
  5640. value towards the complementary color.
  5641. The filter accepts the following options:
  5642. @table @option
  5643. @item rs
  5644. @item gs
  5645. @item bs
  5646. Adjust red, green and blue shadows (darkest pixels).
  5647. @item rm
  5648. @item gm
  5649. @item bm
  5650. Adjust red, green and blue midtones (medium pixels).
  5651. @item rh
  5652. @item gh
  5653. @item bh
  5654. Adjust red, green and blue highlights (brightest pixels).
  5655. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5656. @item pl
  5657. Preserve lightness when changing color balance. Default is disabled.
  5658. @end table
  5659. @subsection Examples
  5660. @itemize
  5661. @item
  5662. Add red color cast to shadows:
  5663. @example
  5664. colorbalance=rs=.3
  5665. @end example
  5666. @end itemize
  5667. @subsection Commands
  5668. This filter supports the all above options as @ref{commands}.
  5669. @section colorchannelmixer
  5670. Adjust video input frames by re-mixing color channels.
  5671. This filter modifies a color channel by adding the values associated to
  5672. the other channels of the same pixels. For example if the value to
  5673. modify is red, the output value will be:
  5674. @example
  5675. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5676. @end example
  5677. The filter accepts the following options:
  5678. @table @option
  5679. @item rr
  5680. @item rg
  5681. @item rb
  5682. @item ra
  5683. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5684. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5685. @item gr
  5686. @item gg
  5687. @item gb
  5688. @item ga
  5689. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5690. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5691. @item br
  5692. @item bg
  5693. @item bb
  5694. @item ba
  5695. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5696. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5697. @item ar
  5698. @item ag
  5699. @item ab
  5700. @item aa
  5701. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5702. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5703. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5704. @end table
  5705. @subsection Examples
  5706. @itemize
  5707. @item
  5708. Convert source to grayscale:
  5709. @example
  5710. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5711. @end example
  5712. @item
  5713. Simulate sepia tones:
  5714. @example
  5715. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5716. @end example
  5717. @end itemize
  5718. @subsection Commands
  5719. This filter supports the all above options as @ref{commands}.
  5720. @section colorkey
  5721. RGB colorspace color keying.
  5722. The filter accepts the following options:
  5723. @table @option
  5724. @item color
  5725. The color which will be replaced with transparency.
  5726. @item similarity
  5727. Similarity percentage with the key color.
  5728. 0.01 matches only the exact key color, while 1.0 matches everything.
  5729. @item blend
  5730. Blend percentage.
  5731. 0.0 makes pixels either fully transparent, or not transparent at all.
  5732. Higher values result in semi-transparent pixels, with a higher transparency
  5733. the more similar the pixels color is to the key color.
  5734. @end table
  5735. @subsection Examples
  5736. @itemize
  5737. @item
  5738. Make every green pixel in the input image transparent:
  5739. @example
  5740. ffmpeg -i input.png -vf colorkey=green out.png
  5741. @end example
  5742. @item
  5743. Overlay a greenscreen-video on top of a static background image.
  5744. @example
  5745. 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
  5746. @end example
  5747. @end itemize
  5748. @subsection Commands
  5749. This filter supports same @ref{commands} as options.
  5750. The command accepts the same syntax of the corresponding option.
  5751. If the specified expression is not valid, it is kept at its current
  5752. value.
  5753. @section colorhold
  5754. Remove all color information for all RGB colors except for certain one.
  5755. The filter accepts the following options:
  5756. @table @option
  5757. @item color
  5758. The color which will not be replaced with neutral gray.
  5759. @item similarity
  5760. Similarity percentage with the above color.
  5761. 0.01 matches only the exact key color, while 1.0 matches everything.
  5762. @item blend
  5763. Blend percentage. 0.0 makes pixels fully gray.
  5764. Higher values result in more preserved color.
  5765. @end table
  5766. @subsection Commands
  5767. This filter supports same @ref{commands} as options.
  5768. The command accepts the same syntax of the corresponding option.
  5769. If the specified expression is not valid, it is kept at its current
  5770. value.
  5771. @section colorlevels
  5772. Adjust video input frames using levels.
  5773. The filter accepts the following options:
  5774. @table @option
  5775. @item rimin
  5776. @item gimin
  5777. @item bimin
  5778. @item aimin
  5779. Adjust red, green, blue and alpha input black point.
  5780. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5781. @item rimax
  5782. @item gimax
  5783. @item bimax
  5784. @item aimax
  5785. Adjust red, green, blue and alpha input white point.
  5786. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5787. Input levels are used to lighten highlights (bright tones), darken shadows
  5788. (dark tones), change the balance of bright and dark tones.
  5789. @item romin
  5790. @item gomin
  5791. @item bomin
  5792. @item aomin
  5793. Adjust red, green, blue and alpha output black point.
  5794. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5795. @item romax
  5796. @item gomax
  5797. @item bomax
  5798. @item aomax
  5799. Adjust red, green, blue and alpha output white point.
  5800. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5801. Output levels allows manual selection of a constrained output level range.
  5802. @end table
  5803. @subsection Examples
  5804. @itemize
  5805. @item
  5806. Make video output darker:
  5807. @example
  5808. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5809. @end example
  5810. @item
  5811. Increase contrast:
  5812. @example
  5813. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5814. @end example
  5815. @item
  5816. Make video output lighter:
  5817. @example
  5818. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5819. @end example
  5820. @item
  5821. Increase brightness:
  5822. @example
  5823. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5824. @end example
  5825. @end itemize
  5826. @subsection Commands
  5827. This filter supports the all above options as @ref{commands}.
  5828. @section colormatrix
  5829. Convert color matrix.
  5830. The filter accepts the following options:
  5831. @table @option
  5832. @item src
  5833. @item dst
  5834. Specify the source and destination color matrix. Both values must be
  5835. specified.
  5836. The accepted values are:
  5837. @table @samp
  5838. @item bt709
  5839. BT.709
  5840. @item fcc
  5841. FCC
  5842. @item bt601
  5843. BT.601
  5844. @item bt470
  5845. BT.470
  5846. @item bt470bg
  5847. BT.470BG
  5848. @item smpte170m
  5849. SMPTE-170M
  5850. @item smpte240m
  5851. SMPTE-240M
  5852. @item bt2020
  5853. BT.2020
  5854. @end table
  5855. @end table
  5856. For example to convert from BT.601 to SMPTE-240M, use the command:
  5857. @example
  5858. colormatrix=bt601:smpte240m
  5859. @end example
  5860. @section colorspace
  5861. Convert colorspace, transfer characteristics or color primaries.
  5862. Input video needs to have an even size.
  5863. The filter accepts the following options:
  5864. @table @option
  5865. @anchor{all}
  5866. @item all
  5867. Specify all color properties at once.
  5868. The accepted values are:
  5869. @table @samp
  5870. @item bt470m
  5871. BT.470M
  5872. @item bt470bg
  5873. BT.470BG
  5874. @item bt601-6-525
  5875. BT.601-6 525
  5876. @item bt601-6-625
  5877. BT.601-6 625
  5878. @item bt709
  5879. BT.709
  5880. @item smpte170m
  5881. SMPTE-170M
  5882. @item smpte240m
  5883. SMPTE-240M
  5884. @item bt2020
  5885. BT.2020
  5886. @end table
  5887. @anchor{space}
  5888. @item space
  5889. Specify output colorspace.
  5890. The accepted values are:
  5891. @table @samp
  5892. @item bt709
  5893. BT.709
  5894. @item fcc
  5895. FCC
  5896. @item bt470bg
  5897. BT.470BG or BT.601-6 625
  5898. @item smpte170m
  5899. SMPTE-170M or BT.601-6 525
  5900. @item smpte240m
  5901. SMPTE-240M
  5902. @item ycgco
  5903. YCgCo
  5904. @item bt2020ncl
  5905. BT.2020 with non-constant luminance
  5906. @end table
  5907. @anchor{trc}
  5908. @item trc
  5909. Specify output transfer characteristics.
  5910. The accepted values are:
  5911. @table @samp
  5912. @item bt709
  5913. BT.709
  5914. @item bt470m
  5915. BT.470M
  5916. @item bt470bg
  5917. BT.470BG
  5918. @item gamma22
  5919. Constant gamma of 2.2
  5920. @item gamma28
  5921. Constant gamma of 2.8
  5922. @item smpte170m
  5923. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5924. @item smpte240m
  5925. SMPTE-240M
  5926. @item srgb
  5927. SRGB
  5928. @item iec61966-2-1
  5929. iec61966-2-1
  5930. @item iec61966-2-4
  5931. iec61966-2-4
  5932. @item xvycc
  5933. xvycc
  5934. @item bt2020-10
  5935. BT.2020 for 10-bits content
  5936. @item bt2020-12
  5937. BT.2020 for 12-bits content
  5938. @end table
  5939. @anchor{primaries}
  5940. @item primaries
  5941. Specify output color primaries.
  5942. The accepted values are:
  5943. @table @samp
  5944. @item bt709
  5945. BT.709
  5946. @item bt470m
  5947. BT.470M
  5948. @item bt470bg
  5949. BT.470BG or BT.601-6 625
  5950. @item smpte170m
  5951. SMPTE-170M or BT.601-6 525
  5952. @item smpte240m
  5953. SMPTE-240M
  5954. @item film
  5955. film
  5956. @item smpte431
  5957. SMPTE-431
  5958. @item smpte432
  5959. SMPTE-432
  5960. @item bt2020
  5961. BT.2020
  5962. @item jedec-p22
  5963. JEDEC P22 phosphors
  5964. @end table
  5965. @anchor{range}
  5966. @item range
  5967. Specify output color range.
  5968. The accepted values are:
  5969. @table @samp
  5970. @item tv
  5971. TV (restricted) range
  5972. @item mpeg
  5973. MPEG (restricted) range
  5974. @item pc
  5975. PC (full) range
  5976. @item jpeg
  5977. JPEG (full) range
  5978. @end table
  5979. @item format
  5980. Specify output color format.
  5981. The accepted values are:
  5982. @table @samp
  5983. @item yuv420p
  5984. YUV 4:2:0 planar 8-bits
  5985. @item yuv420p10
  5986. YUV 4:2:0 planar 10-bits
  5987. @item yuv420p12
  5988. YUV 4:2:0 planar 12-bits
  5989. @item yuv422p
  5990. YUV 4:2:2 planar 8-bits
  5991. @item yuv422p10
  5992. YUV 4:2:2 planar 10-bits
  5993. @item yuv422p12
  5994. YUV 4:2:2 planar 12-bits
  5995. @item yuv444p
  5996. YUV 4:4:4 planar 8-bits
  5997. @item yuv444p10
  5998. YUV 4:4:4 planar 10-bits
  5999. @item yuv444p12
  6000. YUV 4:4:4 planar 12-bits
  6001. @end table
  6002. @item fast
  6003. Do a fast conversion, which skips gamma/primary correction. This will take
  6004. significantly less CPU, but will be mathematically incorrect. To get output
  6005. compatible with that produced by the colormatrix filter, use fast=1.
  6006. @item dither
  6007. Specify dithering mode.
  6008. The accepted values are:
  6009. @table @samp
  6010. @item none
  6011. No dithering
  6012. @item fsb
  6013. Floyd-Steinberg dithering
  6014. @end table
  6015. @item wpadapt
  6016. Whitepoint adaptation mode.
  6017. The accepted values are:
  6018. @table @samp
  6019. @item bradford
  6020. Bradford whitepoint adaptation
  6021. @item vonkries
  6022. von Kries whitepoint adaptation
  6023. @item identity
  6024. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  6025. @end table
  6026. @item iall
  6027. Override all input properties at once. Same accepted values as @ref{all}.
  6028. @item ispace
  6029. Override input colorspace. Same accepted values as @ref{space}.
  6030. @item iprimaries
  6031. Override input color primaries. Same accepted values as @ref{primaries}.
  6032. @item itrc
  6033. Override input transfer characteristics. Same accepted values as @ref{trc}.
  6034. @item irange
  6035. Override input color range. Same accepted values as @ref{range}.
  6036. @end table
  6037. The filter converts the transfer characteristics, color space and color
  6038. primaries to the specified user values. The output value, if not specified,
  6039. is set to a default value based on the "all" property. If that property is
  6040. also not specified, the filter will log an error. The output color range and
  6041. format default to the same value as the input color range and format. The
  6042. input transfer characteristics, color space, color primaries and color range
  6043. should be set on the input data. If any of these are missing, the filter will
  6044. log an error and no conversion will take place.
  6045. For example to convert the input to SMPTE-240M, use the command:
  6046. @example
  6047. colorspace=smpte240m
  6048. @end example
  6049. @section convolution
  6050. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  6051. The filter accepts the following options:
  6052. @table @option
  6053. @item 0m
  6054. @item 1m
  6055. @item 2m
  6056. @item 3m
  6057. Set matrix for each plane.
  6058. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  6059. and from 1 to 49 odd number of signed integers in @var{row} mode.
  6060. @item 0rdiv
  6061. @item 1rdiv
  6062. @item 2rdiv
  6063. @item 3rdiv
  6064. Set multiplier for calculated value for each plane.
  6065. If unset or 0, it will be sum of all matrix elements.
  6066. @item 0bias
  6067. @item 1bias
  6068. @item 2bias
  6069. @item 3bias
  6070. Set bias for each plane. This value is added to the result of the multiplication.
  6071. Useful for making the overall image brighter or darker. Default is 0.0.
  6072. @item 0mode
  6073. @item 1mode
  6074. @item 2mode
  6075. @item 3mode
  6076. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  6077. Default is @var{square}.
  6078. @end table
  6079. @subsection Examples
  6080. @itemize
  6081. @item
  6082. Apply sharpen:
  6083. @example
  6084. 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"
  6085. @end example
  6086. @item
  6087. Apply blur:
  6088. @example
  6089. 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"
  6090. @end example
  6091. @item
  6092. Apply edge enhance:
  6093. @example
  6094. 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"
  6095. @end example
  6096. @item
  6097. Apply edge detect:
  6098. @example
  6099. 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"
  6100. @end example
  6101. @item
  6102. Apply laplacian edge detector which includes diagonals:
  6103. @example
  6104. 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"
  6105. @end example
  6106. @item
  6107. Apply emboss:
  6108. @example
  6109. 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"
  6110. @end example
  6111. @end itemize
  6112. @section convolve
  6113. Apply 2D convolution of video stream in frequency domain using second stream
  6114. as impulse.
  6115. The filter accepts the following options:
  6116. @table @option
  6117. @item planes
  6118. Set which planes to process.
  6119. @item impulse
  6120. Set which impulse video frames will be processed, can be @var{first}
  6121. or @var{all}. Default is @var{all}.
  6122. @end table
  6123. The @code{convolve} filter also supports the @ref{framesync} options.
  6124. @section copy
  6125. Copy the input video source unchanged to the output. This is mainly useful for
  6126. testing purposes.
  6127. @anchor{coreimage}
  6128. @section coreimage
  6129. Video filtering on GPU using Apple's CoreImage API on OSX.
  6130. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6131. processed by video hardware. However, software-based OpenGL implementations
  6132. exist which means there is no guarantee for hardware processing. It depends on
  6133. the respective OSX.
  6134. There are many filters and image generators provided by Apple that come with a
  6135. large variety of options. The filter has to be referenced by its name along
  6136. with its options.
  6137. The coreimage filter accepts the following options:
  6138. @table @option
  6139. @item list_filters
  6140. List all available filters and generators along with all their respective
  6141. options as well as possible minimum and maximum values along with the default
  6142. values.
  6143. @example
  6144. list_filters=true
  6145. @end example
  6146. @item filter
  6147. Specify all filters by their respective name and options.
  6148. Use @var{list_filters} to determine all valid filter names and options.
  6149. Numerical options are specified by a float value and are automatically clamped
  6150. to their respective value range. Vector and color options have to be specified
  6151. by a list of space separated float values. Character escaping has to be done.
  6152. A special option name @code{default} is available to use default options for a
  6153. filter.
  6154. It is required to specify either @code{default} or at least one of the filter options.
  6155. All omitted options are used with their default values.
  6156. The syntax of the filter string is as follows:
  6157. @example
  6158. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6159. @end example
  6160. @item output_rect
  6161. Specify a rectangle where the output of the filter chain is copied into the
  6162. input image. It is given by a list of space separated float values:
  6163. @example
  6164. output_rect=x\ y\ width\ height
  6165. @end example
  6166. If not given, the output rectangle equals the dimensions of the input image.
  6167. The output rectangle is automatically cropped at the borders of the input
  6168. image. Negative values are valid for each component.
  6169. @example
  6170. output_rect=25\ 25\ 100\ 100
  6171. @end example
  6172. @end table
  6173. Several filters can be chained for successive processing without GPU-HOST
  6174. transfers allowing for fast processing of complex filter chains.
  6175. Currently, only filters with zero (generators) or exactly one (filters) input
  6176. image and one output image are supported. Also, transition filters are not yet
  6177. usable as intended.
  6178. Some filters generate output images with additional padding depending on the
  6179. respective filter kernel. The padding is automatically removed to ensure the
  6180. filter output has the same size as the input image.
  6181. For image generators, the size of the output image is determined by the
  6182. previous output image of the filter chain or the input image of the whole
  6183. filterchain, respectively. The generators do not use the pixel information of
  6184. this image to generate their output. However, the generated output is
  6185. blended onto this image, resulting in partial or complete coverage of the
  6186. output image.
  6187. The @ref{coreimagesrc} video source can be used for generating input images
  6188. which are directly fed into the filter chain. By using it, providing input
  6189. images by another video source or an input video is not required.
  6190. @subsection Examples
  6191. @itemize
  6192. @item
  6193. List all filters available:
  6194. @example
  6195. coreimage=list_filters=true
  6196. @end example
  6197. @item
  6198. Use the CIBoxBlur filter with default options to blur an image:
  6199. @example
  6200. coreimage=filter=CIBoxBlur@@default
  6201. @end example
  6202. @item
  6203. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6204. its center at 100x100 and a radius of 50 pixels:
  6205. @example
  6206. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6207. @end example
  6208. @item
  6209. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6210. given as complete and escaped command-line for Apple's standard bash shell:
  6211. @example
  6212. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6213. @end example
  6214. @end itemize
  6215. @section cover_rect
  6216. Cover a rectangular object
  6217. It accepts the following options:
  6218. @table @option
  6219. @item cover
  6220. Filepath of the optional cover image, needs to be in yuv420.
  6221. @item mode
  6222. Set covering mode.
  6223. It accepts the following values:
  6224. @table @samp
  6225. @item cover
  6226. cover it by the supplied image
  6227. @item blur
  6228. cover it by interpolating the surrounding pixels
  6229. @end table
  6230. Default value is @var{blur}.
  6231. @end table
  6232. @subsection Examples
  6233. @itemize
  6234. @item
  6235. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6236. @example
  6237. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6238. @end example
  6239. @end itemize
  6240. @section crop
  6241. Crop the input video to given dimensions.
  6242. It accepts the following parameters:
  6243. @table @option
  6244. @item w, out_w
  6245. The width of the output video. It defaults to @code{iw}.
  6246. This expression is evaluated only once during the filter
  6247. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6248. @item h, out_h
  6249. The height of the output video. It defaults to @code{ih}.
  6250. This expression is evaluated only once during the filter
  6251. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6252. @item x
  6253. The horizontal position, in the input video, of the left edge of the output
  6254. video. It defaults to @code{(in_w-out_w)/2}.
  6255. This expression is evaluated per-frame.
  6256. @item y
  6257. The vertical position, in the input video, of the top edge of the output video.
  6258. It defaults to @code{(in_h-out_h)/2}.
  6259. This expression is evaluated per-frame.
  6260. @item keep_aspect
  6261. If set to 1 will force the output display aspect ratio
  6262. to be the same of the input, by changing the output sample aspect
  6263. ratio. It defaults to 0.
  6264. @item exact
  6265. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6266. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6267. It defaults to 0.
  6268. @end table
  6269. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6270. expressions containing the following constants:
  6271. @table @option
  6272. @item x
  6273. @item y
  6274. The computed values for @var{x} and @var{y}. They are evaluated for
  6275. each new frame.
  6276. @item in_w
  6277. @item in_h
  6278. The input width and height.
  6279. @item iw
  6280. @item ih
  6281. These are the same as @var{in_w} and @var{in_h}.
  6282. @item out_w
  6283. @item out_h
  6284. The output (cropped) width and height.
  6285. @item ow
  6286. @item oh
  6287. These are the same as @var{out_w} and @var{out_h}.
  6288. @item a
  6289. same as @var{iw} / @var{ih}
  6290. @item sar
  6291. input sample aspect ratio
  6292. @item dar
  6293. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6294. @item hsub
  6295. @item vsub
  6296. horizontal and vertical chroma subsample values. For example for the
  6297. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6298. @item n
  6299. The number of the input frame, starting from 0.
  6300. @item pos
  6301. the position in the file of the input frame, NAN if unknown
  6302. @item t
  6303. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6304. @end table
  6305. The expression for @var{out_w} may depend on the value of @var{out_h},
  6306. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6307. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6308. evaluated after @var{out_w} and @var{out_h}.
  6309. The @var{x} and @var{y} parameters specify the expressions for the
  6310. position of the top-left corner of the output (non-cropped) area. They
  6311. are evaluated for each frame. If the evaluated value is not valid, it
  6312. is approximated to the nearest valid value.
  6313. The expression for @var{x} may depend on @var{y}, and the expression
  6314. for @var{y} may depend on @var{x}.
  6315. @subsection Examples
  6316. @itemize
  6317. @item
  6318. Crop area with size 100x100 at position (12,34).
  6319. @example
  6320. crop=100:100:12:34
  6321. @end example
  6322. Using named options, the example above becomes:
  6323. @example
  6324. crop=w=100:h=100:x=12:y=34
  6325. @end example
  6326. @item
  6327. Crop the central input area with size 100x100:
  6328. @example
  6329. crop=100:100
  6330. @end example
  6331. @item
  6332. Crop the central input area with size 2/3 of the input video:
  6333. @example
  6334. crop=2/3*in_w:2/3*in_h
  6335. @end example
  6336. @item
  6337. Crop the input video central square:
  6338. @example
  6339. crop=out_w=in_h
  6340. crop=in_h
  6341. @end example
  6342. @item
  6343. Delimit the rectangle with the top-left corner placed at position
  6344. 100:100 and the right-bottom corner corresponding to the right-bottom
  6345. corner of the input image.
  6346. @example
  6347. crop=in_w-100:in_h-100:100:100
  6348. @end example
  6349. @item
  6350. Crop 10 pixels from the left and right borders, and 20 pixels from
  6351. the top and bottom borders
  6352. @example
  6353. crop=in_w-2*10:in_h-2*20
  6354. @end example
  6355. @item
  6356. Keep only the bottom right quarter of the input image:
  6357. @example
  6358. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6359. @end example
  6360. @item
  6361. Crop height for getting Greek harmony:
  6362. @example
  6363. crop=in_w:1/PHI*in_w
  6364. @end example
  6365. @item
  6366. Apply trembling effect:
  6367. @example
  6368. 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)
  6369. @end example
  6370. @item
  6371. Apply erratic camera effect depending on timestamp:
  6372. @example
  6373. 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)"
  6374. @end example
  6375. @item
  6376. Set x depending on the value of y:
  6377. @example
  6378. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6379. @end example
  6380. @end itemize
  6381. @subsection Commands
  6382. This filter supports the following commands:
  6383. @table @option
  6384. @item w, out_w
  6385. @item h, out_h
  6386. @item x
  6387. @item y
  6388. Set width/height of the output video and the horizontal/vertical position
  6389. in the input video.
  6390. The command accepts the same syntax of the corresponding option.
  6391. If the specified expression is not valid, it is kept at its current
  6392. value.
  6393. @end table
  6394. @section cropdetect
  6395. Auto-detect the crop size.
  6396. It calculates the necessary cropping parameters and prints the
  6397. recommended parameters via the logging system. The detected dimensions
  6398. correspond to the non-black area of the input video.
  6399. It accepts the following parameters:
  6400. @table @option
  6401. @item limit
  6402. Set higher black value threshold, which can be optionally specified
  6403. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6404. value greater to the set value is considered non-black. It defaults to 24.
  6405. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6406. on the bitdepth of the pixel format.
  6407. @item round
  6408. The value which the width/height should be divisible by. It defaults to
  6409. 16. The offset is automatically adjusted to center the video. Use 2 to
  6410. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6411. encoding to most video codecs.
  6412. @item reset_count, reset
  6413. Set the counter that determines after how many frames cropdetect will
  6414. reset the previously detected largest video area and start over to
  6415. detect the current optimal crop area. Default value is 0.
  6416. This can be useful when channel logos distort the video area. 0
  6417. indicates 'never reset', and returns the largest area encountered during
  6418. playback.
  6419. @end table
  6420. @anchor{cue}
  6421. @section cue
  6422. Delay video filtering until a given wallclock timestamp. The filter first
  6423. passes on @option{preroll} amount of frames, then it buffers at most
  6424. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6425. it forwards the buffered frames and also any subsequent frames coming in its
  6426. input.
  6427. The filter can be used synchronize the output of multiple ffmpeg processes for
  6428. realtime output devices like decklink. By putting the delay in the filtering
  6429. chain and pre-buffering frames the process can pass on data to output almost
  6430. immediately after the target wallclock timestamp is reached.
  6431. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6432. some use cases.
  6433. @table @option
  6434. @item cue
  6435. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6436. @item preroll
  6437. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6438. @item buffer
  6439. The maximum duration of content to buffer before waiting for the cue expressed
  6440. in seconds. Default is 0.
  6441. @end table
  6442. @anchor{curves}
  6443. @section curves
  6444. Apply color adjustments using curves.
  6445. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6446. component (red, green and blue) has its values defined by @var{N} key points
  6447. tied from each other using a smooth curve. The x-axis represents the pixel
  6448. values from the input frame, and the y-axis the new pixel values to be set for
  6449. the output frame.
  6450. By default, a component curve is defined by the two points @var{(0;0)} and
  6451. @var{(1;1)}. This creates a straight line where each original pixel value is
  6452. "adjusted" to its own value, which means no change to the image.
  6453. The filter allows you to redefine these two points and add some more. A new
  6454. curve (using a natural cubic spline interpolation) will be define to pass
  6455. smoothly through all these new coordinates. The new defined points needs to be
  6456. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6457. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6458. the vector spaces, the values will be clipped accordingly.
  6459. The filter accepts the following options:
  6460. @table @option
  6461. @item preset
  6462. Select one of the available color presets. This option can be used in addition
  6463. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6464. options takes priority on the preset values.
  6465. Available presets are:
  6466. @table @samp
  6467. @item none
  6468. @item color_negative
  6469. @item cross_process
  6470. @item darker
  6471. @item increase_contrast
  6472. @item lighter
  6473. @item linear_contrast
  6474. @item medium_contrast
  6475. @item negative
  6476. @item strong_contrast
  6477. @item vintage
  6478. @end table
  6479. Default is @code{none}.
  6480. @item master, m
  6481. Set the master key points. These points will define a second pass mapping. It
  6482. is sometimes called a "luminance" or "value" mapping. It can be used with
  6483. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6484. post-processing LUT.
  6485. @item red, r
  6486. Set the key points for the red component.
  6487. @item green, g
  6488. Set the key points for the green component.
  6489. @item blue, b
  6490. Set the key points for the blue component.
  6491. @item all
  6492. Set the key points for all components (not including master).
  6493. Can be used in addition to the other key points component
  6494. options. In this case, the unset component(s) will fallback on this
  6495. @option{all} setting.
  6496. @item psfile
  6497. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6498. @item plot
  6499. Save Gnuplot script of the curves in specified file.
  6500. @end table
  6501. To avoid some filtergraph syntax conflicts, each key points list need to be
  6502. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6503. @subsection Examples
  6504. @itemize
  6505. @item
  6506. Increase slightly the middle level of blue:
  6507. @example
  6508. curves=blue='0/0 0.5/0.58 1/1'
  6509. @end example
  6510. @item
  6511. Vintage effect:
  6512. @example
  6513. 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'
  6514. @end example
  6515. Here we obtain the following coordinates for each components:
  6516. @table @var
  6517. @item red
  6518. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6519. @item green
  6520. @code{(0;0) (0.50;0.48) (1;1)}
  6521. @item blue
  6522. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6523. @end table
  6524. @item
  6525. The previous example can also be achieved with the associated built-in preset:
  6526. @example
  6527. curves=preset=vintage
  6528. @end example
  6529. @item
  6530. Or simply:
  6531. @example
  6532. curves=vintage
  6533. @end example
  6534. @item
  6535. Use a Photoshop preset and redefine the points of the green component:
  6536. @example
  6537. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6538. @end example
  6539. @item
  6540. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6541. and @command{gnuplot}:
  6542. @example
  6543. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6544. gnuplot -p /tmp/curves.plt
  6545. @end example
  6546. @end itemize
  6547. @section datascope
  6548. Video data analysis filter.
  6549. This filter shows hexadecimal pixel values of part of video.
  6550. The filter accepts the following options:
  6551. @table @option
  6552. @item size, s
  6553. Set output video size.
  6554. @item x
  6555. Set x offset from where to pick pixels.
  6556. @item y
  6557. Set y offset from where to pick pixels.
  6558. @item mode
  6559. Set scope mode, can be one of the following:
  6560. @table @samp
  6561. @item mono
  6562. Draw hexadecimal pixel values with white color on black background.
  6563. @item color
  6564. Draw hexadecimal pixel values with input video pixel color on black
  6565. background.
  6566. @item color2
  6567. Draw hexadecimal pixel values on color background picked from input video,
  6568. the text color is picked in such way so its always visible.
  6569. @end table
  6570. @item axis
  6571. Draw rows and columns numbers on left and top of video.
  6572. @item opacity
  6573. Set background opacity.
  6574. @item format
  6575. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  6576. @end table
  6577. @section dctdnoiz
  6578. Denoise frames using 2D DCT (frequency domain filtering).
  6579. This filter is not designed for real time.
  6580. The filter accepts the following options:
  6581. @table @option
  6582. @item sigma, s
  6583. Set the noise sigma constant.
  6584. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6585. coefficient (absolute value) below this threshold with be dropped.
  6586. If you need a more advanced filtering, see @option{expr}.
  6587. Default is @code{0}.
  6588. @item overlap
  6589. Set number overlapping pixels for each block. Since the filter can be slow, you
  6590. may want to reduce this value, at the cost of a less effective filter and the
  6591. risk of various artefacts.
  6592. If the overlapping value doesn't permit processing the whole input width or
  6593. height, a warning will be displayed and according borders won't be denoised.
  6594. Default value is @var{blocksize}-1, which is the best possible setting.
  6595. @item expr, e
  6596. Set the coefficient factor expression.
  6597. For each coefficient of a DCT block, this expression will be evaluated as a
  6598. multiplier value for the coefficient.
  6599. If this is option is set, the @option{sigma} option will be ignored.
  6600. The absolute value of the coefficient can be accessed through the @var{c}
  6601. variable.
  6602. @item n
  6603. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6604. @var{blocksize}, which is the width and height of the processed blocks.
  6605. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6606. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6607. on the speed processing. Also, a larger block size does not necessarily means a
  6608. better de-noising.
  6609. @end table
  6610. @subsection Examples
  6611. Apply a denoise with a @option{sigma} of @code{4.5}:
  6612. @example
  6613. dctdnoiz=4.5
  6614. @end example
  6615. The same operation can be achieved using the expression system:
  6616. @example
  6617. dctdnoiz=e='gte(c, 4.5*3)'
  6618. @end example
  6619. Violent denoise using a block size of @code{16x16}:
  6620. @example
  6621. dctdnoiz=15:n=4
  6622. @end example
  6623. @section deband
  6624. Remove banding artifacts from input video.
  6625. It works by replacing banded pixels with average value of referenced pixels.
  6626. The filter accepts the following options:
  6627. @table @option
  6628. @item 1thr
  6629. @item 2thr
  6630. @item 3thr
  6631. @item 4thr
  6632. Set banding detection threshold for each plane. Default is 0.02.
  6633. Valid range is 0.00003 to 0.5.
  6634. If difference between current pixel and reference pixel is less than threshold,
  6635. it will be considered as banded.
  6636. @item range, r
  6637. Banding detection range in pixels. Default is 16. If positive, random number
  6638. in range 0 to set value will be used. If negative, exact absolute value
  6639. will be used.
  6640. The range defines square of four pixels around current pixel.
  6641. @item direction, d
  6642. Set direction in radians from which four pixel will be compared. If positive,
  6643. random direction from 0 to set direction will be picked. If negative, exact of
  6644. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6645. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6646. column.
  6647. @item blur, b
  6648. If enabled, current pixel is compared with average value of all four
  6649. surrounding pixels. The default is enabled. If disabled current pixel is
  6650. compared with all four surrounding pixels. The pixel is considered banded
  6651. if only all four differences with surrounding pixels are less than threshold.
  6652. @item coupling, c
  6653. If enabled, current pixel is changed if and only if all pixel components are banded,
  6654. e.g. banding detection threshold is triggered for all color components.
  6655. The default is disabled.
  6656. @end table
  6657. @section deblock
  6658. Remove blocking artifacts from input video.
  6659. The filter accepts the following options:
  6660. @table @option
  6661. @item filter
  6662. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6663. This controls what kind of deblocking is applied.
  6664. @item block
  6665. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6666. @item alpha
  6667. @item beta
  6668. @item gamma
  6669. @item delta
  6670. Set blocking detection thresholds. Allowed range is 0 to 1.
  6671. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6672. Using higher threshold gives more deblocking strength.
  6673. Setting @var{alpha} controls threshold detection at exact edge of block.
  6674. Remaining options controls threshold detection near the edge. Each one for
  6675. below/above or left/right. Setting any of those to @var{0} disables
  6676. deblocking.
  6677. @item planes
  6678. Set planes to filter. Default is to filter all available planes.
  6679. @end table
  6680. @subsection Examples
  6681. @itemize
  6682. @item
  6683. Deblock using weak filter and block size of 4 pixels.
  6684. @example
  6685. deblock=filter=weak:block=4
  6686. @end example
  6687. @item
  6688. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6689. deblocking more edges.
  6690. @example
  6691. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6692. @end example
  6693. @item
  6694. Similar as above, but filter only first plane.
  6695. @example
  6696. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6697. @end example
  6698. @item
  6699. Similar as above, but filter only second and third plane.
  6700. @example
  6701. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6702. @end example
  6703. @end itemize
  6704. @anchor{decimate}
  6705. @section decimate
  6706. Drop duplicated frames at regular intervals.
  6707. The filter accepts the following options:
  6708. @table @option
  6709. @item cycle
  6710. Set the number of frames from which one will be dropped. Setting this to
  6711. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6712. Default is @code{5}.
  6713. @item dupthresh
  6714. Set the threshold for duplicate detection. If the difference metric for a frame
  6715. is less than or equal to this value, then it is declared as duplicate. Default
  6716. is @code{1.1}
  6717. @item scthresh
  6718. Set scene change threshold. Default is @code{15}.
  6719. @item blockx
  6720. @item blocky
  6721. Set the size of the x and y-axis blocks used during metric calculations.
  6722. Larger blocks give better noise suppression, but also give worse detection of
  6723. small movements. Must be a power of two. Default is @code{32}.
  6724. @item ppsrc
  6725. Mark main input as a pre-processed input and activate clean source input
  6726. stream. This allows the input to be pre-processed with various filters to help
  6727. the metrics calculation while keeping the frame selection lossless. When set to
  6728. @code{1}, the first stream is for the pre-processed input, and the second
  6729. stream is the clean source from where the kept frames are chosen. Default is
  6730. @code{0}.
  6731. @item chroma
  6732. Set whether or not chroma is considered in the metric calculations. Default is
  6733. @code{1}.
  6734. @end table
  6735. @section deconvolve
  6736. Apply 2D deconvolution of video stream in frequency domain using second stream
  6737. as impulse.
  6738. The filter accepts the following options:
  6739. @table @option
  6740. @item planes
  6741. Set which planes to process.
  6742. @item impulse
  6743. Set which impulse video frames will be processed, can be @var{first}
  6744. or @var{all}. Default is @var{all}.
  6745. @item noise
  6746. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6747. and height are not same and not power of 2 or if stream prior to convolving
  6748. had noise.
  6749. @end table
  6750. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6751. @section dedot
  6752. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6753. It accepts the following options:
  6754. @table @option
  6755. @item m
  6756. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6757. @var{rainbows} for cross-color reduction.
  6758. @item lt
  6759. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6760. @item tl
  6761. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6762. @item tc
  6763. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6764. @item ct
  6765. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6766. @end table
  6767. @section deflate
  6768. Apply deflate effect to the video.
  6769. This filter replaces the pixel by the local(3x3) average by taking into account
  6770. only values lower than the pixel.
  6771. It accepts the following options:
  6772. @table @option
  6773. @item threshold0
  6774. @item threshold1
  6775. @item threshold2
  6776. @item threshold3
  6777. Limit the maximum change for each plane, default is 65535.
  6778. If 0, plane will remain unchanged.
  6779. @end table
  6780. @subsection Commands
  6781. This filter supports the all above options as @ref{commands}.
  6782. @section deflicker
  6783. Remove temporal frame luminance variations.
  6784. It accepts the following options:
  6785. @table @option
  6786. @item size, s
  6787. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6788. @item mode, m
  6789. Set averaging mode to smooth temporal luminance variations.
  6790. Available values are:
  6791. @table @samp
  6792. @item am
  6793. Arithmetic mean
  6794. @item gm
  6795. Geometric mean
  6796. @item hm
  6797. Harmonic mean
  6798. @item qm
  6799. Quadratic mean
  6800. @item cm
  6801. Cubic mean
  6802. @item pm
  6803. Power mean
  6804. @item median
  6805. Median
  6806. @end table
  6807. @item bypass
  6808. Do not actually modify frame. Useful when one only wants metadata.
  6809. @end table
  6810. @section dejudder
  6811. Remove judder produced by partially interlaced telecined content.
  6812. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6813. source was partially telecined content then the output of @code{pullup,dejudder}
  6814. will have a variable frame rate. May change the recorded frame rate of the
  6815. container. Aside from that change, this filter will not affect constant frame
  6816. rate video.
  6817. The option available in this filter is:
  6818. @table @option
  6819. @item cycle
  6820. Specify the length of the window over which the judder repeats.
  6821. Accepts any integer greater than 1. Useful values are:
  6822. @table @samp
  6823. @item 4
  6824. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6825. @item 5
  6826. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6827. @item 20
  6828. If a mixture of the two.
  6829. @end table
  6830. The default is @samp{4}.
  6831. @end table
  6832. @section delogo
  6833. Suppress a TV station logo by a simple interpolation of the surrounding
  6834. pixels. Just set a rectangle covering the logo and watch it disappear
  6835. (and sometimes something even uglier appear - your mileage may vary).
  6836. It accepts the following parameters:
  6837. @table @option
  6838. @item x
  6839. @item y
  6840. Specify the top left corner coordinates of the logo. They must be
  6841. specified.
  6842. @item w
  6843. @item h
  6844. Specify the width and height of the logo to clear. They must be
  6845. specified.
  6846. @item band, t
  6847. Specify the thickness of the fuzzy edge of the rectangle (added to
  6848. @var{w} and @var{h}). The default value is 1. This option is
  6849. deprecated, setting higher values should no longer be necessary and
  6850. is not recommended.
  6851. @item show
  6852. When set to 1, a green rectangle is drawn on the screen to simplify
  6853. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6854. The default value is 0.
  6855. The rectangle is drawn on the outermost pixels which will be (partly)
  6856. replaced with interpolated values. The values of the next pixels
  6857. immediately outside this rectangle in each direction will be used to
  6858. compute the interpolated pixel values inside the rectangle.
  6859. @end table
  6860. @subsection Examples
  6861. @itemize
  6862. @item
  6863. Set a rectangle covering the area with top left corner coordinates 0,0
  6864. and size 100x77, and a band of size 10:
  6865. @example
  6866. delogo=x=0:y=0:w=100:h=77:band=10
  6867. @end example
  6868. @end itemize
  6869. @anchor{derain}
  6870. @section derain
  6871. Remove the rain in the input image/video by applying the derain methods based on
  6872. convolutional neural networks. Supported models:
  6873. @itemize
  6874. @item
  6875. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6876. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6877. @end itemize
  6878. Training as well as model generation scripts are provided in
  6879. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6880. Native model files (.model) can be generated from TensorFlow model
  6881. files (.pb) by using tools/python/convert.py
  6882. The filter accepts the following options:
  6883. @table @option
  6884. @item filter_type
  6885. Specify which filter to use. This option accepts the following values:
  6886. @table @samp
  6887. @item derain
  6888. Derain filter. To conduct derain filter, you need to use a derain model.
  6889. @item dehaze
  6890. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  6891. @end table
  6892. Default value is @samp{derain}.
  6893. @item dnn_backend
  6894. Specify which DNN backend to use for model loading and execution. This option accepts
  6895. the following values:
  6896. @table @samp
  6897. @item native
  6898. Native implementation of DNN loading and execution.
  6899. @item tensorflow
  6900. TensorFlow backend. To enable this backend you
  6901. need to install the TensorFlow for C library (see
  6902. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6903. @code{--enable-libtensorflow}
  6904. @end table
  6905. Default value is @samp{native}.
  6906. @item model
  6907. Set path to model file specifying network architecture and its parameters.
  6908. Note that different backends use different file formats. TensorFlow and native
  6909. backend can load files for only its format.
  6910. @end table
  6911. It can also be finished with @ref{dnn_processing} filter.
  6912. @section deshake
  6913. Attempt to fix small changes in horizontal and/or vertical shift. This
  6914. filter helps remove camera shake from hand-holding a camera, bumping a
  6915. tripod, moving on a vehicle, etc.
  6916. The filter accepts the following options:
  6917. @table @option
  6918. @item x
  6919. @item y
  6920. @item w
  6921. @item h
  6922. Specify a rectangular area where to limit the search for motion
  6923. vectors.
  6924. If desired the search for motion vectors can be limited to a
  6925. rectangular area of the frame defined by its top left corner, width
  6926. and height. These parameters have the same meaning as the drawbox
  6927. filter which can be used to visualise the position of the bounding
  6928. box.
  6929. This is useful when simultaneous movement of subjects within the frame
  6930. might be confused for camera motion by the motion vector search.
  6931. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6932. then the full frame is used. This allows later options to be set
  6933. without specifying the bounding box for the motion vector search.
  6934. Default - search the whole frame.
  6935. @item rx
  6936. @item ry
  6937. Specify the maximum extent of movement in x and y directions in the
  6938. range 0-64 pixels. Default 16.
  6939. @item edge
  6940. Specify how to generate pixels to fill blanks at the edge of the
  6941. frame. Available values are:
  6942. @table @samp
  6943. @item blank, 0
  6944. Fill zeroes at blank locations
  6945. @item original, 1
  6946. Original image at blank locations
  6947. @item clamp, 2
  6948. Extruded edge value at blank locations
  6949. @item mirror, 3
  6950. Mirrored edge at blank locations
  6951. @end table
  6952. Default value is @samp{mirror}.
  6953. @item blocksize
  6954. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6955. default 8.
  6956. @item contrast
  6957. Specify the contrast threshold for blocks. Only blocks with more than
  6958. the specified contrast (difference between darkest and lightest
  6959. pixels) will be considered. Range 1-255, default 125.
  6960. @item search
  6961. Specify the search strategy. Available values are:
  6962. @table @samp
  6963. @item exhaustive, 0
  6964. Set exhaustive search
  6965. @item less, 1
  6966. Set less exhaustive search.
  6967. @end table
  6968. Default value is @samp{exhaustive}.
  6969. @item filename
  6970. If set then a detailed log of the motion search is written to the
  6971. specified file.
  6972. @end table
  6973. @section despill
  6974. Remove unwanted contamination of foreground colors, caused by reflected color of
  6975. greenscreen or bluescreen.
  6976. This filter accepts the following options:
  6977. @table @option
  6978. @item type
  6979. Set what type of despill to use.
  6980. @item mix
  6981. Set how spillmap will be generated.
  6982. @item expand
  6983. Set how much to get rid of still remaining spill.
  6984. @item red
  6985. Controls amount of red in spill area.
  6986. @item green
  6987. Controls amount of green in spill area.
  6988. Should be -1 for greenscreen.
  6989. @item blue
  6990. Controls amount of blue in spill area.
  6991. Should be -1 for bluescreen.
  6992. @item brightness
  6993. Controls brightness of spill area, preserving colors.
  6994. @item alpha
  6995. Modify alpha from generated spillmap.
  6996. @end table
  6997. @section detelecine
  6998. Apply an exact inverse of the telecine operation. It requires a predefined
  6999. pattern specified using the pattern option which must be the same as that passed
  7000. to the telecine filter.
  7001. This filter accepts the following options:
  7002. @table @option
  7003. @item first_field
  7004. @table @samp
  7005. @item top, t
  7006. top field first
  7007. @item bottom, b
  7008. bottom field first
  7009. The default value is @code{top}.
  7010. @end table
  7011. @item pattern
  7012. A string of numbers representing the pulldown pattern you wish to apply.
  7013. The default value is @code{23}.
  7014. @item start_frame
  7015. A number representing position of the first frame with respect to the telecine
  7016. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  7017. @end table
  7018. @section dilation
  7019. Apply dilation effect to the video.
  7020. This filter replaces the pixel by the local(3x3) maximum.
  7021. It accepts the following options:
  7022. @table @option
  7023. @item threshold0
  7024. @item threshold1
  7025. @item threshold2
  7026. @item threshold3
  7027. Limit the maximum change for each plane, default is 65535.
  7028. If 0, plane will remain unchanged.
  7029. @item coordinates
  7030. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7031. pixels are used.
  7032. Flags to local 3x3 coordinates maps like this:
  7033. 1 2 3
  7034. 4 5
  7035. 6 7 8
  7036. @end table
  7037. @subsection Commands
  7038. This filter supports the all above options as @ref{commands}.
  7039. @section displace
  7040. Displace pixels as indicated by second and third input stream.
  7041. It takes three input streams and outputs one stream, the first input is the
  7042. source, and second and third input are displacement maps.
  7043. The second input specifies how much to displace pixels along the
  7044. x-axis, while the third input specifies how much to displace pixels
  7045. along the y-axis.
  7046. If one of displacement map streams terminates, last frame from that
  7047. displacement map will be used.
  7048. Note that once generated, displacements maps can be reused over and over again.
  7049. A description of the accepted options follows.
  7050. @table @option
  7051. @item edge
  7052. Set displace behavior for pixels that are out of range.
  7053. Available values are:
  7054. @table @samp
  7055. @item blank
  7056. Missing pixels are replaced by black pixels.
  7057. @item smear
  7058. Adjacent pixels will spread out to replace missing pixels.
  7059. @item wrap
  7060. Out of range pixels are wrapped so they point to pixels of other side.
  7061. @item mirror
  7062. Out of range pixels will be replaced with mirrored pixels.
  7063. @end table
  7064. Default is @samp{smear}.
  7065. @end table
  7066. @subsection Examples
  7067. @itemize
  7068. @item
  7069. Add ripple effect to rgb input of video size hd720:
  7070. @example
  7071. 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
  7072. @end example
  7073. @item
  7074. Add wave effect to rgb input of video size hd720:
  7075. @example
  7076. 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
  7077. @end example
  7078. @end itemize
  7079. @anchor{dnn_processing}
  7080. @section dnn_processing
  7081. Do image processing with deep neural networks. It works together with another filter
  7082. which converts the pixel format of the Frame to what the dnn network requires.
  7083. The filter accepts the following options:
  7084. @table @option
  7085. @item dnn_backend
  7086. Specify which DNN backend to use for model loading and execution. This option accepts
  7087. the following values:
  7088. @table @samp
  7089. @item native
  7090. Native implementation of DNN loading and execution.
  7091. @item tensorflow
  7092. TensorFlow backend. To enable this backend you
  7093. need to install the TensorFlow for C library (see
  7094. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7095. @code{--enable-libtensorflow}
  7096. @end table
  7097. Default value is @samp{native}.
  7098. @item model
  7099. Set path to model file specifying network architecture and its parameters.
  7100. Note that different backends use different file formats. TensorFlow and native
  7101. backend can load files for only its format.
  7102. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7103. @item input
  7104. Set the input name of the dnn network.
  7105. @item output
  7106. Set the output name of the dnn network.
  7107. @end table
  7108. @subsection Examples
  7109. @itemize
  7110. @item
  7111. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7112. @example
  7113. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7114. @end example
  7115. @item
  7116. Halve the pixel value of the frame with format gray32f:
  7117. @example
  7118. 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
  7119. @end example
  7120. @item
  7121. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7122. @example
  7123. ./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
  7124. @end example
  7125. @item
  7126. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7127. @example
  7128. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7129. @end example
  7130. @end itemize
  7131. @section drawbox
  7132. Draw a colored box on the input image.
  7133. It accepts the following parameters:
  7134. @table @option
  7135. @item x
  7136. @item y
  7137. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7138. @item width, w
  7139. @item height, h
  7140. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7141. the input width and height. It defaults to 0.
  7142. @item color, c
  7143. Specify the color of the box to write. For the general syntax of this option,
  7144. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7145. value @code{invert} is used, the box edge color is the same as the
  7146. video with inverted luma.
  7147. @item thickness, t
  7148. The expression which sets the thickness of the box edge.
  7149. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7150. See below for the list of accepted constants.
  7151. @item replace
  7152. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7153. will overwrite the video's color and alpha pixels.
  7154. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7155. @end table
  7156. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7157. following constants:
  7158. @table @option
  7159. @item dar
  7160. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7161. @item hsub
  7162. @item vsub
  7163. horizontal and vertical chroma subsample values. For example for the
  7164. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7165. @item in_h, ih
  7166. @item in_w, iw
  7167. The input width and height.
  7168. @item sar
  7169. The input sample aspect ratio.
  7170. @item x
  7171. @item y
  7172. The x and y offset coordinates where the box is drawn.
  7173. @item w
  7174. @item h
  7175. The width and height of the drawn box.
  7176. @item t
  7177. The thickness of the drawn box.
  7178. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7179. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7180. @end table
  7181. @subsection Examples
  7182. @itemize
  7183. @item
  7184. Draw a black box around the edge of the input image:
  7185. @example
  7186. drawbox
  7187. @end example
  7188. @item
  7189. Draw a box with color red and an opacity of 50%:
  7190. @example
  7191. drawbox=10:20:200:60:red@@0.5
  7192. @end example
  7193. The previous example can be specified as:
  7194. @example
  7195. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7196. @end example
  7197. @item
  7198. Fill the box with pink color:
  7199. @example
  7200. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7201. @end example
  7202. @item
  7203. Draw a 2-pixel red 2.40:1 mask:
  7204. @example
  7205. 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
  7206. @end example
  7207. @end itemize
  7208. @subsection Commands
  7209. This filter supports same commands as options.
  7210. The command accepts the same syntax of the corresponding option.
  7211. If the specified expression is not valid, it is kept at its current
  7212. value.
  7213. @anchor{drawgraph}
  7214. @section drawgraph
  7215. Draw a graph using input video metadata.
  7216. It accepts the following parameters:
  7217. @table @option
  7218. @item m1
  7219. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7220. @item fg1
  7221. Set 1st foreground color expression.
  7222. @item m2
  7223. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7224. @item fg2
  7225. Set 2nd foreground color expression.
  7226. @item m3
  7227. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7228. @item fg3
  7229. Set 3rd foreground color expression.
  7230. @item m4
  7231. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7232. @item fg4
  7233. Set 4th foreground color expression.
  7234. @item min
  7235. Set minimal value of metadata value.
  7236. @item max
  7237. Set maximal value of metadata value.
  7238. @item bg
  7239. Set graph background color. Default is white.
  7240. @item mode
  7241. Set graph mode.
  7242. Available values for mode is:
  7243. @table @samp
  7244. @item bar
  7245. @item dot
  7246. @item line
  7247. @end table
  7248. Default is @code{line}.
  7249. @item slide
  7250. Set slide mode.
  7251. Available values for slide is:
  7252. @table @samp
  7253. @item frame
  7254. Draw new frame when right border is reached.
  7255. @item replace
  7256. Replace old columns with new ones.
  7257. @item scroll
  7258. Scroll from right to left.
  7259. @item rscroll
  7260. Scroll from left to right.
  7261. @item picture
  7262. Draw single picture.
  7263. @end table
  7264. Default is @code{frame}.
  7265. @item size
  7266. Set size of graph video. For the syntax of this option, check the
  7267. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7268. The default value is @code{900x256}.
  7269. @item rate, r
  7270. Set the output frame rate. Default value is @code{25}.
  7271. The foreground color expressions can use the following variables:
  7272. @table @option
  7273. @item MIN
  7274. Minimal value of metadata value.
  7275. @item MAX
  7276. Maximal value of metadata value.
  7277. @item VAL
  7278. Current metadata key value.
  7279. @end table
  7280. The color is defined as 0xAABBGGRR.
  7281. @end table
  7282. Example using metadata from @ref{signalstats} filter:
  7283. @example
  7284. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7285. @end example
  7286. Example using metadata from @ref{ebur128} filter:
  7287. @example
  7288. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7289. @end example
  7290. @section drawgrid
  7291. Draw a grid on the input image.
  7292. It accepts the following parameters:
  7293. @table @option
  7294. @item x
  7295. @item y
  7296. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7297. @item width, w
  7298. @item height, h
  7299. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7300. input width and height, respectively, minus @code{thickness}, so image gets
  7301. framed. Default to 0.
  7302. @item color, c
  7303. Specify the color of the grid. For the general syntax of this option,
  7304. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7305. value @code{invert} is used, the grid color is the same as the
  7306. video with inverted luma.
  7307. @item thickness, t
  7308. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7309. See below for the list of accepted constants.
  7310. @item replace
  7311. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7312. will overwrite the video's color and alpha pixels.
  7313. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7314. @end table
  7315. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7316. following constants:
  7317. @table @option
  7318. @item dar
  7319. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7320. @item hsub
  7321. @item vsub
  7322. horizontal and vertical chroma subsample values. For example for the
  7323. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7324. @item in_h, ih
  7325. @item in_w, iw
  7326. The input grid cell width and height.
  7327. @item sar
  7328. The input sample aspect ratio.
  7329. @item x
  7330. @item y
  7331. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7332. @item w
  7333. @item h
  7334. The width and height of the drawn cell.
  7335. @item t
  7336. The thickness of the drawn cell.
  7337. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7338. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7339. @end table
  7340. @subsection Examples
  7341. @itemize
  7342. @item
  7343. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7344. @example
  7345. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7346. @end example
  7347. @item
  7348. Draw a white 3x3 grid with an opacity of 50%:
  7349. @example
  7350. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7351. @end example
  7352. @end itemize
  7353. @subsection Commands
  7354. This filter supports same commands as options.
  7355. The command accepts the same syntax of the corresponding option.
  7356. If the specified expression is not valid, it is kept at its current
  7357. value.
  7358. @anchor{drawtext}
  7359. @section drawtext
  7360. Draw a text string or text from a specified file on top of a video, using the
  7361. libfreetype library.
  7362. To enable compilation of this filter, you need to configure FFmpeg with
  7363. @code{--enable-libfreetype}.
  7364. To enable default font fallback and the @var{font} option you need to
  7365. configure FFmpeg with @code{--enable-libfontconfig}.
  7366. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7367. @code{--enable-libfribidi}.
  7368. @subsection Syntax
  7369. It accepts the following parameters:
  7370. @table @option
  7371. @item box
  7372. Used to draw a box around text using the background color.
  7373. The value must be either 1 (enable) or 0 (disable).
  7374. The default value of @var{box} is 0.
  7375. @item boxborderw
  7376. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7377. The default value of @var{boxborderw} is 0.
  7378. @item boxcolor
  7379. The color to be used for drawing box around text. For the syntax of this
  7380. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7381. The default value of @var{boxcolor} is "white".
  7382. @item line_spacing
  7383. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7384. The default value of @var{line_spacing} is 0.
  7385. @item borderw
  7386. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7387. The default value of @var{borderw} is 0.
  7388. @item bordercolor
  7389. Set the color to be used for drawing border around text. For the syntax of this
  7390. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7391. The default value of @var{bordercolor} is "black".
  7392. @item expansion
  7393. Select how the @var{text} is expanded. Can be either @code{none},
  7394. @code{strftime} (deprecated) or
  7395. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7396. below for details.
  7397. @item basetime
  7398. Set a start time for the count. Value is in microseconds. Only applied
  7399. in the deprecated strftime expansion mode. To emulate in normal expansion
  7400. mode use the @code{pts} function, supplying the start time (in seconds)
  7401. as the second argument.
  7402. @item fix_bounds
  7403. If true, check and fix text coords to avoid clipping.
  7404. @item fontcolor
  7405. The color to be used for drawing fonts. For the syntax of this option, check
  7406. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7407. The default value of @var{fontcolor} is "black".
  7408. @item fontcolor_expr
  7409. String which is expanded the same way as @var{text} to obtain dynamic
  7410. @var{fontcolor} value. By default this option has empty value and is not
  7411. processed. When this option is set, it overrides @var{fontcolor} option.
  7412. @item font
  7413. The font family to be used for drawing text. By default Sans.
  7414. @item fontfile
  7415. The font file to be used for drawing text. The path must be included.
  7416. This parameter is mandatory if the fontconfig support is disabled.
  7417. @item alpha
  7418. Draw the text applying alpha blending. The value can
  7419. be a number between 0.0 and 1.0.
  7420. The expression accepts the same variables @var{x, y} as well.
  7421. The default value is 1.
  7422. Please see @var{fontcolor_expr}.
  7423. @item fontsize
  7424. The font size to be used for drawing text.
  7425. The default value of @var{fontsize} is 16.
  7426. @item text_shaping
  7427. If set to 1, attempt to shape the text (for example, reverse the order of
  7428. right-to-left text and join Arabic characters) before drawing it.
  7429. Otherwise, just draw the text exactly as given.
  7430. By default 1 (if supported).
  7431. @item ft_load_flags
  7432. The flags to be used for loading the fonts.
  7433. The flags map the corresponding flags supported by libfreetype, and are
  7434. a combination of the following values:
  7435. @table @var
  7436. @item default
  7437. @item no_scale
  7438. @item no_hinting
  7439. @item render
  7440. @item no_bitmap
  7441. @item vertical_layout
  7442. @item force_autohint
  7443. @item crop_bitmap
  7444. @item pedantic
  7445. @item ignore_global_advance_width
  7446. @item no_recurse
  7447. @item ignore_transform
  7448. @item monochrome
  7449. @item linear_design
  7450. @item no_autohint
  7451. @end table
  7452. Default value is "default".
  7453. For more information consult the documentation for the FT_LOAD_*
  7454. libfreetype flags.
  7455. @item shadowcolor
  7456. The color to be used for drawing a shadow behind the drawn text. For the
  7457. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7458. ffmpeg-utils manual,ffmpeg-utils}.
  7459. The default value of @var{shadowcolor} is "black".
  7460. @item shadowx
  7461. @item shadowy
  7462. The x and y offsets for the text shadow position with respect to the
  7463. position of the text. They can be either positive or negative
  7464. values. The default value for both is "0".
  7465. @item start_number
  7466. The starting frame number for the n/frame_num variable. The default value
  7467. is "0".
  7468. @item tabsize
  7469. The size in number of spaces to use for rendering the tab.
  7470. Default value is 4.
  7471. @item timecode
  7472. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7473. format. It can be used with or without text parameter. @var{timecode_rate}
  7474. option must be specified.
  7475. @item timecode_rate, rate, r
  7476. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7477. integer. Minimum value is "1".
  7478. Drop-frame timecode is supported for frame rates 30 & 60.
  7479. @item tc24hmax
  7480. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7481. Default is 0 (disabled).
  7482. @item text
  7483. The text string to be drawn. The text must be a sequence of UTF-8
  7484. encoded characters.
  7485. This parameter is mandatory if no file is specified with the parameter
  7486. @var{textfile}.
  7487. @item textfile
  7488. A text file containing text to be drawn. The text must be a sequence
  7489. of UTF-8 encoded characters.
  7490. This parameter is mandatory if no text string is specified with the
  7491. parameter @var{text}.
  7492. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7493. @item reload
  7494. If set to 1, the @var{textfile} will be reloaded before each frame.
  7495. Be sure to update it atomically, or it may be read partially, or even fail.
  7496. @item x
  7497. @item y
  7498. The expressions which specify the offsets where text will be drawn
  7499. within the video frame. They are relative to the top/left border of the
  7500. output image.
  7501. The default value of @var{x} and @var{y} is "0".
  7502. See below for the list of accepted constants and functions.
  7503. @end table
  7504. The parameters for @var{x} and @var{y} are expressions containing the
  7505. following constants and functions:
  7506. @table @option
  7507. @item dar
  7508. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7509. @item hsub
  7510. @item vsub
  7511. horizontal and vertical chroma subsample values. For example for the
  7512. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7513. @item line_h, lh
  7514. the height of each text line
  7515. @item main_h, h, H
  7516. the input height
  7517. @item main_w, w, W
  7518. the input width
  7519. @item max_glyph_a, ascent
  7520. the maximum distance from the baseline to the highest/upper grid
  7521. coordinate used to place a glyph outline point, for all the rendered
  7522. glyphs.
  7523. It is a positive value, due to the grid's orientation with the Y axis
  7524. upwards.
  7525. @item max_glyph_d, descent
  7526. the maximum distance from the baseline to the lowest grid coordinate
  7527. used to place a glyph outline point, for all the rendered glyphs.
  7528. This is a negative value, due to the grid's orientation, with the Y axis
  7529. upwards.
  7530. @item max_glyph_h
  7531. maximum glyph height, that is the maximum height for all the glyphs
  7532. contained in the rendered text, it is equivalent to @var{ascent} -
  7533. @var{descent}.
  7534. @item max_glyph_w
  7535. maximum glyph width, that is the maximum width for all the glyphs
  7536. contained in the rendered text
  7537. @item n
  7538. the number of input frame, starting from 0
  7539. @item rand(min, max)
  7540. return a random number included between @var{min} and @var{max}
  7541. @item sar
  7542. The input sample aspect ratio.
  7543. @item t
  7544. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7545. @item text_h, th
  7546. the height of the rendered text
  7547. @item text_w, tw
  7548. the width of the rendered text
  7549. @item x
  7550. @item y
  7551. the x and y offset coordinates where the text is drawn.
  7552. These parameters allow the @var{x} and @var{y} expressions to refer
  7553. to each other, so you can for example specify @code{y=x/dar}.
  7554. @item pict_type
  7555. A one character description of the current frame's picture type.
  7556. @item pkt_pos
  7557. The current packet's position in the input file or stream
  7558. (in bytes, from the start of the input). A value of -1 indicates
  7559. this info is not available.
  7560. @item pkt_duration
  7561. The current packet's duration, in seconds.
  7562. @item pkt_size
  7563. The current packet's size (in bytes).
  7564. @end table
  7565. @anchor{drawtext_expansion}
  7566. @subsection Text expansion
  7567. If @option{expansion} is set to @code{strftime},
  7568. the filter recognizes strftime() sequences in the provided text and
  7569. expands them accordingly. Check the documentation of strftime(). This
  7570. feature is deprecated.
  7571. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7572. If @option{expansion} is set to @code{normal} (which is the default),
  7573. the following expansion mechanism is used.
  7574. The backslash character @samp{\}, followed by any character, always expands to
  7575. the second character.
  7576. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7577. braces is a function name, possibly followed by arguments separated by ':'.
  7578. If the arguments contain special characters or delimiters (':' or '@}'),
  7579. they should be escaped.
  7580. Note that they probably must also be escaped as the value for the
  7581. @option{text} option in the filter argument string and as the filter
  7582. argument in the filtergraph description, and possibly also for the shell,
  7583. that makes up to four levels of escaping; using a text file avoids these
  7584. problems.
  7585. The following functions are available:
  7586. @table @command
  7587. @item expr, e
  7588. The expression evaluation result.
  7589. It must take one argument specifying the expression to be evaluated,
  7590. which accepts the same constants and functions as the @var{x} and
  7591. @var{y} values. Note that not all constants should be used, for
  7592. example the text size is not known when evaluating the expression, so
  7593. the constants @var{text_w} and @var{text_h} will have an undefined
  7594. value.
  7595. @item expr_int_format, eif
  7596. Evaluate the expression's value and output as formatted integer.
  7597. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7598. The second argument specifies the output format. Allowed values are @samp{x},
  7599. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7600. @code{printf} function.
  7601. The third parameter is optional and sets the number of positions taken by the output.
  7602. It can be used to add padding with zeros from the left.
  7603. @item gmtime
  7604. The time at which the filter is running, expressed in UTC.
  7605. It can accept an argument: a strftime() format string.
  7606. @item localtime
  7607. The time at which the filter is running, expressed in the local time zone.
  7608. It can accept an argument: a strftime() format string.
  7609. @item metadata
  7610. Frame metadata. Takes one or two arguments.
  7611. The first argument is mandatory and specifies the metadata key.
  7612. The second argument is optional and specifies a default value, used when the
  7613. metadata key is not found or empty.
  7614. Available metadata can be identified by inspecting entries
  7615. starting with TAG included within each frame section
  7616. printed by running @code{ffprobe -show_frames}.
  7617. String metadata generated in filters leading to
  7618. the drawtext filter are also available.
  7619. @item n, frame_num
  7620. The frame number, starting from 0.
  7621. @item pict_type
  7622. A one character description of the current picture type.
  7623. @item pts
  7624. The timestamp of the current frame.
  7625. It can take up to three arguments.
  7626. The first argument is the format of the timestamp; it defaults to @code{flt}
  7627. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7628. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7629. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7630. @code{localtime} stands for the timestamp of the frame formatted as
  7631. local time zone time.
  7632. The second argument is an offset added to the timestamp.
  7633. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7634. supplied to present the hour part of the formatted timestamp in 24h format
  7635. (00-23).
  7636. If the format is set to @code{localtime} or @code{gmtime},
  7637. a third argument may be supplied: a strftime() format string.
  7638. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7639. @end table
  7640. @subsection Commands
  7641. This filter supports altering parameters via commands:
  7642. @table @option
  7643. @item reinit
  7644. Alter existing filter parameters.
  7645. Syntax for the argument is the same as for filter invocation, e.g.
  7646. @example
  7647. fontsize=56:fontcolor=green:text='Hello World'
  7648. @end example
  7649. Full filter invocation with sendcmd would look like this:
  7650. @example
  7651. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7652. @end example
  7653. @end table
  7654. If the entire argument can't be parsed or applied as valid values then the filter will
  7655. continue with its existing parameters.
  7656. @subsection Examples
  7657. @itemize
  7658. @item
  7659. Draw "Test Text" with font FreeSerif, using the default values for the
  7660. optional parameters.
  7661. @example
  7662. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7663. @end example
  7664. @item
  7665. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7666. and y=50 (counting from the top-left corner of the screen), text is
  7667. yellow with a red box around it. Both the text and the box have an
  7668. opacity of 20%.
  7669. @example
  7670. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7671. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7672. @end example
  7673. Note that the double quotes are not necessary if spaces are not used
  7674. within the parameter list.
  7675. @item
  7676. Show the text at the center of the video frame:
  7677. @example
  7678. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7679. @end example
  7680. @item
  7681. Show the text at a random position, switching to a new position every 30 seconds:
  7682. @example
  7683. 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)"
  7684. @end example
  7685. @item
  7686. Show a text line sliding from right to left in the last row of the video
  7687. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7688. with no newlines.
  7689. @example
  7690. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7691. @end example
  7692. @item
  7693. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7694. @example
  7695. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7696. @end example
  7697. @item
  7698. Draw a single green letter "g", at the center of the input video.
  7699. The glyph baseline is placed at half screen height.
  7700. @example
  7701. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7702. @end example
  7703. @item
  7704. Show text for 1 second every 3 seconds:
  7705. @example
  7706. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7707. @end example
  7708. @item
  7709. Use fontconfig to set the font. Note that the colons need to be escaped.
  7710. @example
  7711. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7712. @end example
  7713. @item
  7714. Print the date of a real-time encoding (see strftime(3)):
  7715. @example
  7716. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7717. @end example
  7718. @item
  7719. Show text fading in and out (appearing/disappearing):
  7720. @example
  7721. #!/bin/sh
  7722. DS=1.0 # display start
  7723. DE=10.0 # display end
  7724. FID=1.5 # fade in duration
  7725. FOD=5 # fade out duration
  7726. 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 @}"
  7727. @end example
  7728. @item
  7729. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7730. and the @option{fontsize} value are included in the @option{y} offset.
  7731. @example
  7732. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7733. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7734. @end example
  7735. @item
  7736. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  7737. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  7738. must have option @option{-export_path_metadata 1} for the special metadata fields
  7739. to be available for filters.
  7740. @example
  7741. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  7742. @end example
  7743. @end itemize
  7744. For more information about libfreetype, check:
  7745. @url{http://www.freetype.org/}.
  7746. For more information about fontconfig, check:
  7747. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7748. For more information about libfribidi, check:
  7749. @url{http://fribidi.org/}.
  7750. @section edgedetect
  7751. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7752. The filter accepts the following options:
  7753. @table @option
  7754. @item low
  7755. @item high
  7756. Set low and high threshold values used by the Canny thresholding
  7757. algorithm.
  7758. The high threshold selects the "strong" edge pixels, which are then
  7759. connected through 8-connectivity with the "weak" edge pixels selected
  7760. by the low threshold.
  7761. @var{low} and @var{high} threshold values must be chosen in the range
  7762. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7763. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7764. is @code{50/255}.
  7765. @item mode
  7766. Define the drawing mode.
  7767. @table @samp
  7768. @item wires
  7769. Draw white/gray wires on black background.
  7770. @item colormix
  7771. Mix the colors to create a paint/cartoon effect.
  7772. @item canny
  7773. Apply Canny edge detector on all selected planes.
  7774. @end table
  7775. Default value is @var{wires}.
  7776. @item planes
  7777. Select planes for filtering. By default all available planes are filtered.
  7778. @end table
  7779. @subsection Examples
  7780. @itemize
  7781. @item
  7782. Standard edge detection with custom values for the hysteresis thresholding:
  7783. @example
  7784. edgedetect=low=0.1:high=0.4
  7785. @end example
  7786. @item
  7787. Painting effect without thresholding:
  7788. @example
  7789. edgedetect=mode=colormix:high=0
  7790. @end example
  7791. @end itemize
  7792. @section elbg
  7793. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7794. For each input image, the filter will compute the optimal mapping from
  7795. the input to the output given the codebook length, that is the number
  7796. of distinct output colors.
  7797. This filter accepts the following options.
  7798. @table @option
  7799. @item codebook_length, l
  7800. Set codebook length. The value must be a positive integer, and
  7801. represents the number of distinct output colors. Default value is 256.
  7802. @item nb_steps, n
  7803. Set the maximum number of iterations to apply for computing the optimal
  7804. mapping. The higher the value the better the result and the higher the
  7805. computation time. Default value is 1.
  7806. @item seed, s
  7807. Set a random seed, must be an integer included between 0 and
  7808. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7809. will try to use a good random seed on a best effort basis.
  7810. @item pal8
  7811. Set pal8 output pixel format. This option does not work with codebook
  7812. length greater than 256.
  7813. @end table
  7814. @section entropy
  7815. Measure graylevel entropy in histogram of color channels of video frames.
  7816. It accepts the following parameters:
  7817. @table @option
  7818. @item mode
  7819. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7820. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7821. between neighbour histogram values.
  7822. @end table
  7823. @section eq
  7824. Set brightness, contrast, saturation and approximate gamma adjustment.
  7825. The filter accepts the following options:
  7826. @table @option
  7827. @item contrast
  7828. Set the contrast expression. The value must be a float value in range
  7829. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7830. @item brightness
  7831. Set the brightness expression. The value must be a float value in
  7832. range @code{-1.0} to @code{1.0}. The default value is "0".
  7833. @item saturation
  7834. Set the saturation expression. The value must be a float in
  7835. range @code{0.0} to @code{3.0}. The default value is "1".
  7836. @item gamma
  7837. Set the gamma expression. The value must be a float in range
  7838. @code{0.1} to @code{10.0}. The default value is "1".
  7839. @item gamma_r
  7840. Set the gamma expression for red. The value must be a float in
  7841. range @code{0.1} to @code{10.0}. The default value is "1".
  7842. @item gamma_g
  7843. Set the gamma expression for green. The value must be a float in range
  7844. @code{0.1} to @code{10.0}. The default value is "1".
  7845. @item gamma_b
  7846. Set the gamma expression for blue. The value must be a float in range
  7847. @code{0.1} to @code{10.0}. The default value is "1".
  7848. @item gamma_weight
  7849. Set the gamma weight expression. It can be used to reduce the effect
  7850. of a high gamma value on bright image areas, e.g. keep them from
  7851. getting overamplified and just plain white. The value must be a float
  7852. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7853. gamma correction all the way down while @code{1.0} leaves it at its
  7854. full strength. Default is "1".
  7855. @item eval
  7856. Set when the expressions for brightness, contrast, saturation and
  7857. gamma expressions are evaluated.
  7858. It accepts the following values:
  7859. @table @samp
  7860. @item init
  7861. only evaluate expressions once during the filter initialization or
  7862. when a command is processed
  7863. @item frame
  7864. evaluate expressions for each incoming frame
  7865. @end table
  7866. Default value is @samp{init}.
  7867. @end table
  7868. The expressions accept the following parameters:
  7869. @table @option
  7870. @item n
  7871. frame count of the input frame starting from 0
  7872. @item pos
  7873. byte position of the corresponding packet in the input file, NAN if
  7874. unspecified
  7875. @item r
  7876. frame rate of the input video, NAN if the input frame rate is unknown
  7877. @item t
  7878. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7879. @end table
  7880. @subsection Commands
  7881. The filter supports the following commands:
  7882. @table @option
  7883. @item contrast
  7884. Set the contrast expression.
  7885. @item brightness
  7886. Set the brightness expression.
  7887. @item saturation
  7888. Set the saturation expression.
  7889. @item gamma
  7890. Set the gamma expression.
  7891. @item gamma_r
  7892. Set the gamma_r expression.
  7893. @item gamma_g
  7894. Set gamma_g expression.
  7895. @item gamma_b
  7896. Set gamma_b expression.
  7897. @item gamma_weight
  7898. Set gamma_weight expression.
  7899. The command accepts the same syntax of the corresponding option.
  7900. If the specified expression is not valid, it is kept at its current
  7901. value.
  7902. @end table
  7903. @section erosion
  7904. Apply erosion effect to the video.
  7905. This filter replaces the pixel by the local(3x3) minimum.
  7906. It accepts the following options:
  7907. @table @option
  7908. @item threshold0
  7909. @item threshold1
  7910. @item threshold2
  7911. @item threshold3
  7912. Limit the maximum change for each plane, default is 65535.
  7913. If 0, plane will remain unchanged.
  7914. @item coordinates
  7915. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7916. pixels are used.
  7917. Flags to local 3x3 coordinates maps like this:
  7918. 1 2 3
  7919. 4 5
  7920. 6 7 8
  7921. @end table
  7922. @subsection Commands
  7923. This filter supports the all above options as @ref{commands}.
  7924. @section extractplanes
  7925. Extract color channel components from input video stream into
  7926. separate grayscale video streams.
  7927. The filter accepts the following option:
  7928. @table @option
  7929. @item planes
  7930. Set plane(s) to extract.
  7931. Available values for planes are:
  7932. @table @samp
  7933. @item y
  7934. @item u
  7935. @item v
  7936. @item a
  7937. @item r
  7938. @item g
  7939. @item b
  7940. @end table
  7941. Choosing planes not available in the input will result in an error.
  7942. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7943. with @code{y}, @code{u}, @code{v} planes at same time.
  7944. @end table
  7945. @subsection Examples
  7946. @itemize
  7947. @item
  7948. Extract luma, u and v color channel component from input video frame
  7949. into 3 grayscale outputs:
  7950. @example
  7951. 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
  7952. @end example
  7953. @end itemize
  7954. @section fade
  7955. Apply a fade-in/out effect to the input video.
  7956. It accepts the following parameters:
  7957. @table @option
  7958. @item type, t
  7959. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7960. effect.
  7961. Default is @code{in}.
  7962. @item start_frame, s
  7963. Specify the number of the frame to start applying the fade
  7964. effect at. Default is 0.
  7965. @item nb_frames, n
  7966. The number of frames that the fade effect lasts. At the end of the
  7967. fade-in effect, the output video will have the same intensity as the input video.
  7968. At the end of the fade-out transition, the output video will be filled with the
  7969. selected @option{color}.
  7970. Default is 25.
  7971. @item alpha
  7972. If set to 1, fade only alpha channel, if one exists on the input.
  7973. Default value is 0.
  7974. @item start_time, st
  7975. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7976. effect. If both start_frame and start_time are specified, the fade will start at
  7977. whichever comes last. Default is 0.
  7978. @item duration, d
  7979. The number of seconds for which the fade effect has to last. At the end of the
  7980. fade-in effect the output video will have the same intensity as the input video,
  7981. at the end of the fade-out transition the output video will be filled with the
  7982. selected @option{color}.
  7983. If both duration and nb_frames are specified, duration is used. Default is 0
  7984. (nb_frames is used by default).
  7985. @item color, c
  7986. Specify the color of the fade. Default is "black".
  7987. @end table
  7988. @subsection Examples
  7989. @itemize
  7990. @item
  7991. Fade in the first 30 frames of video:
  7992. @example
  7993. fade=in:0:30
  7994. @end example
  7995. The command above is equivalent to:
  7996. @example
  7997. fade=t=in:s=0:n=30
  7998. @end example
  7999. @item
  8000. Fade out the last 45 frames of a 200-frame video:
  8001. @example
  8002. fade=out:155:45
  8003. fade=type=out:start_frame=155:nb_frames=45
  8004. @end example
  8005. @item
  8006. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  8007. @example
  8008. fade=in:0:25, fade=out:975:25
  8009. @end example
  8010. @item
  8011. Make the first 5 frames yellow, then fade in from frame 5-24:
  8012. @example
  8013. fade=in:5:20:color=yellow
  8014. @end example
  8015. @item
  8016. Fade in alpha over first 25 frames of video:
  8017. @example
  8018. fade=in:0:25:alpha=1
  8019. @end example
  8020. @item
  8021. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  8022. @example
  8023. fade=t=in:st=5.5:d=0.5
  8024. @end example
  8025. @end itemize
  8026. @section fftdnoiz
  8027. Denoise frames using 3D FFT (frequency domain filtering).
  8028. The filter accepts the following options:
  8029. @table @option
  8030. @item sigma
  8031. Set the noise sigma constant. This sets denoising strength.
  8032. Default value is 1. Allowed range is from 0 to 30.
  8033. Using very high sigma with low overlap may give blocking artifacts.
  8034. @item amount
  8035. Set amount of denoising. By default all detected noise is reduced.
  8036. Default value is 1. Allowed range is from 0 to 1.
  8037. @item block
  8038. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  8039. Actual size of block in pixels is 2 to power of @var{block}, so by default
  8040. block size in pixels is 2^4 which is 16.
  8041. @item overlap
  8042. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  8043. @item prev
  8044. Set number of previous frames to use for denoising. By default is set to 0.
  8045. @item next
  8046. Set number of next frames to to use for denoising. By default is set to 0.
  8047. @item planes
  8048. Set planes which will be filtered, by default are all available filtered
  8049. except alpha.
  8050. @end table
  8051. @section fftfilt
  8052. Apply arbitrary expressions to samples in frequency domain
  8053. @table @option
  8054. @item dc_Y
  8055. Adjust the dc value (gain) of the luma plane of the image. The filter
  8056. accepts an integer value in range @code{0} to @code{1000}. The default
  8057. value is set to @code{0}.
  8058. @item dc_U
  8059. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8060. filter accepts an integer value in range @code{0} to @code{1000}. The
  8061. default value is set to @code{0}.
  8062. @item dc_V
  8063. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8064. filter accepts an integer value in range @code{0} to @code{1000}. The
  8065. default value is set to @code{0}.
  8066. @item weight_Y
  8067. Set the frequency domain weight expression for the luma plane.
  8068. @item weight_U
  8069. Set the frequency domain weight expression for the 1st chroma plane.
  8070. @item weight_V
  8071. Set the frequency domain weight expression for the 2nd chroma plane.
  8072. @item eval
  8073. Set when the expressions are evaluated.
  8074. It accepts the following values:
  8075. @table @samp
  8076. @item init
  8077. Only evaluate expressions once during the filter initialization.
  8078. @item frame
  8079. Evaluate expressions for each incoming frame.
  8080. @end table
  8081. Default value is @samp{init}.
  8082. The filter accepts the following variables:
  8083. @item X
  8084. @item Y
  8085. The coordinates of the current sample.
  8086. @item W
  8087. @item H
  8088. The width and height of the image.
  8089. @item N
  8090. The number of input frame, starting from 0.
  8091. @end table
  8092. @subsection Examples
  8093. @itemize
  8094. @item
  8095. High-pass:
  8096. @example
  8097. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8098. @end example
  8099. @item
  8100. Low-pass:
  8101. @example
  8102. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8103. @end example
  8104. @item
  8105. Sharpen:
  8106. @example
  8107. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8108. @end example
  8109. @item
  8110. Blur:
  8111. @example
  8112. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8113. @end example
  8114. @end itemize
  8115. @section field
  8116. Extract a single field from an interlaced image using stride
  8117. arithmetic to avoid wasting CPU time. The output frames are marked as
  8118. non-interlaced.
  8119. The filter accepts the following options:
  8120. @table @option
  8121. @item type
  8122. Specify whether to extract the top (if the value is @code{0} or
  8123. @code{top}) or the bottom field (if the value is @code{1} or
  8124. @code{bottom}).
  8125. @end table
  8126. @section fieldhint
  8127. Create new frames by copying the top and bottom fields from surrounding frames
  8128. supplied as numbers by the hint file.
  8129. @table @option
  8130. @item hint
  8131. Set file containing hints: absolute/relative frame numbers.
  8132. There must be one line for each frame in a clip. Each line must contain two
  8133. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8134. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8135. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8136. for @code{relative} mode. First number tells from which frame to pick up top
  8137. field and second number tells from which frame to pick up bottom field.
  8138. If optionally followed by @code{+} output frame will be marked as interlaced,
  8139. else if followed by @code{-} output frame will be marked as progressive, else
  8140. it will be marked same as input frame.
  8141. If optionally followed by @code{t} output frame will use only top field, or in
  8142. case of @code{b} it will use only bottom field.
  8143. If line starts with @code{#} or @code{;} that line is skipped.
  8144. @item mode
  8145. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8146. @end table
  8147. Example of first several lines of @code{hint} file for @code{relative} mode:
  8148. @example
  8149. 0,0 - # first frame
  8150. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8151. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8152. 1,0 -
  8153. 0,0 -
  8154. 0,0 -
  8155. 1,0 -
  8156. 1,0 -
  8157. 1,0 -
  8158. 0,0 -
  8159. 0,0 -
  8160. 1,0 -
  8161. 1,0 -
  8162. 1,0 -
  8163. 0,0 -
  8164. @end example
  8165. @section fieldmatch
  8166. Field matching filter for inverse telecine. It is meant to reconstruct the
  8167. progressive frames from a telecined stream. The filter does not drop duplicated
  8168. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8169. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8170. The separation of the field matching and the decimation is notably motivated by
  8171. the possibility of inserting a de-interlacing filter fallback between the two.
  8172. If the source has mixed telecined and real interlaced content,
  8173. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8174. But these remaining combed frames will be marked as interlaced, and thus can be
  8175. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8176. In addition to the various configuration options, @code{fieldmatch} can take an
  8177. optional second stream, activated through the @option{ppsrc} option. If
  8178. enabled, the frames reconstruction will be based on the fields and frames from
  8179. this second stream. This allows the first input to be pre-processed in order to
  8180. help the various algorithms of the filter, while keeping the output lossless
  8181. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8182. or brightness/contrast adjustments can help.
  8183. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8184. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8185. which @code{fieldmatch} is based on. While the semantic and usage are very
  8186. close, some behaviour and options names can differ.
  8187. The @ref{decimate} filter currently only works for constant frame rate input.
  8188. If your input has mixed telecined (30fps) and progressive content with a lower
  8189. framerate like 24fps use the following filterchain to produce the necessary cfr
  8190. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8191. The filter accepts the following options:
  8192. @table @option
  8193. @item order
  8194. Specify the assumed field order of the input stream. Available values are:
  8195. @table @samp
  8196. @item auto
  8197. Auto detect parity (use FFmpeg's internal parity value).
  8198. @item bff
  8199. Assume bottom field first.
  8200. @item tff
  8201. Assume top field first.
  8202. @end table
  8203. Note that it is sometimes recommended not to trust the parity announced by the
  8204. stream.
  8205. Default value is @var{auto}.
  8206. @item mode
  8207. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8208. sense that it won't risk creating jerkiness due to duplicate frames when
  8209. possible, but if there are bad edits or blended fields it will end up
  8210. outputting combed frames when a good match might actually exist. On the other
  8211. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8212. but will almost always find a good frame if there is one. The other values are
  8213. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8214. jerkiness and creating duplicate frames versus finding good matches in sections
  8215. with bad edits, orphaned fields, blended fields, etc.
  8216. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8217. Available values are:
  8218. @table @samp
  8219. @item pc
  8220. 2-way matching (p/c)
  8221. @item pc_n
  8222. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8223. @item pc_u
  8224. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8225. @item pc_n_ub
  8226. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8227. still combed (p/c + n + u/b)
  8228. @item pcn
  8229. 3-way matching (p/c/n)
  8230. @item pcn_ub
  8231. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8232. detected as combed (p/c/n + u/b)
  8233. @end table
  8234. The parenthesis at the end indicate the matches that would be used for that
  8235. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8236. @var{top}).
  8237. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8238. the slowest.
  8239. Default value is @var{pc_n}.
  8240. @item ppsrc
  8241. Mark the main input stream as a pre-processed input, and enable the secondary
  8242. input stream as the clean source to pick the fields from. See the filter
  8243. introduction for more details. It is similar to the @option{clip2} feature from
  8244. VFM/TFM.
  8245. Default value is @code{0} (disabled).
  8246. @item field
  8247. Set the field to match from. It is recommended to set this to the same value as
  8248. @option{order} unless you experience matching failures with that setting. In
  8249. certain circumstances changing the field that is used to match from can have a
  8250. large impact on matching performance. Available values are:
  8251. @table @samp
  8252. @item auto
  8253. Automatic (same value as @option{order}).
  8254. @item bottom
  8255. Match from the bottom field.
  8256. @item top
  8257. Match from the top field.
  8258. @end table
  8259. Default value is @var{auto}.
  8260. @item mchroma
  8261. Set whether or not chroma is included during the match comparisons. In most
  8262. cases it is recommended to leave this enabled. You should set this to @code{0}
  8263. only if your clip has bad chroma problems such as heavy rainbowing or other
  8264. artifacts. Setting this to @code{0} could also be used to speed things up at
  8265. the cost of some accuracy.
  8266. Default value is @code{1}.
  8267. @item y0
  8268. @item y1
  8269. These define an exclusion band which excludes the lines between @option{y0} and
  8270. @option{y1} from being included in the field matching decision. An exclusion
  8271. band can be used to ignore subtitles, a logo, or other things that may
  8272. interfere with the matching. @option{y0} sets the starting scan line and
  8273. @option{y1} sets the ending line; all lines in between @option{y0} and
  8274. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8275. @option{y0} and @option{y1} to the same value will disable the feature.
  8276. @option{y0} and @option{y1} defaults to @code{0}.
  8277. @item scthresh
  8278. Set the scene change detection threshold as a percentage of maximum change on
  8279. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8280. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8281. @option{scthresh} is @code{[0.0, 100.0]}.
  8282. Default value is @code{12.0}.
  8283. @item combmatch
  8284. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8285. account the combed scores of matches when deciding what match to use as the
  8286. final match. Available values are:
  8287. @table @samp
  8288. @item none
  8289. No final matching based on combed scores.
  8290. @item sc
  8291. Combed scores are only used when a scene change is detected.
  8292. @item full
  8293. Use combed scores all the time.
  8294. @end table
  8295. Default is @var{sc}.
  8296. @item combdbg
  8297. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8298. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8299. Available values are:
  8300. @table @samp
  8301. @item none
  8302. No forced calculation.
  8303. @item pcn
  8304. Force p/c/n calculations.
  8305. @item pcnub
  8306. Force p/c/n/u/b calculations.
  8307. @end table
  8308. Default value is @var{none}.
  8309. @item cthresh
  8310. This is the area combing threshold used for combed frame detection. This
  8311. essentially controls how "strong" or "visible" combing must be to be detected.
  8312. Larger values mean combing must be more visible and smaller values mean combing
  8313. can be less visible or strong and still be detected. Valid settings are from
  8314. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8315. be detected as combed). This is basically a pixel difference value. A good
  8316. range is @code{[8, 12]}.
  8317. Default value is @code{9}.
  8318. @item chroma
  8319. Sets whether or not chroma is considered in the combed frame decision. Only
  8320. disable this if your source has chroma problems (rainbowing, etc.) that are
  8321. causing problems for the combed frame detection with chroma enabled. Actually,
  8322. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8323. where there is chroma only combing in the source.
  8324. Default value is @code{0}.
  8325. @item blockx
  8326. @item blocky
  8327. Respectively set the x-axis and y-axis size of the window used during combed
  8328. frame detection. This has to do with the size of the area in which
  8329. @option{combpel} pixels are required to be detected as combed for a frame to be
  8330. declared combed. See the @option{combpel} parameter description for more info.
  8331. Possible values are any number that is a power of 2 starting at 4 and going up
  8332. to 512.
  8333. Default value is @code{16}.
  8334. @item combpel
  8335. The number of combed pixels inside any of the @option{blocky} by
  8336. @option{blockx} size blocks on the frame for the frame to be detected as
  8337. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8338. setting controls "how much" combing there must be in any localized area (a
  8339. window defined by the @option{blockx} and @option{blocky} settings) on the
  8340. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8341. which point no frames will ever be detected as combed). This setting is known
  8342. as @option{MI} in TFM/VFM vocabulary.
  8343. Default value is @code{80}.
  8344. @end table
  8345. @anchor{p/c/n/u/b meaning}
  8346. @subsection p/c/n/u/b meaning
  8347. @subsubsection p/c/n
  8348. We assume the following telecined stream:
  8349. @example
  8350. Top fields: 1 2 2 3 4
  8351. Bottom fields: 1 2 3 4 4
  8352. @end example
  8353. The numbers correspond to the progressive frame the fields relate to. Here, the
  8354. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8355. When @code{fieldmatch} is configured to run a matching from bottom
  8356. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8357. @example
  8358. Input stream:
  8359. T 1 2 2 3 4
  8360. B 1 2 3 4 4 <-- matching reference
  8361. Matches: c c n n c
  8362. Output stream:
  8363. T 1 2 3 4 4
  8364. B 1 2 3 4 4
  8365. @end example
  8366. As a result of the field matching, we can see that some frames get duplicated.
  8367. To perform a complete inverse telecine, you need to rely on a decimation filter
  8368. after this operation. See for instance the @ref{decimate} filter.
  8369. The same operation now matching from top fields (@option{field}=@var{top})
  8370. looks like this:
  8371. @example
  8372. Input stream:
  8373. T 1 2 2 3 4 <-- matching reference
  8374. B 1 2 3 4 4
  8375. Matches: c c p p c
  8376. Output stream:
  8377. T 1 2 2 3 4
  8378. B 1 2 2 3 4
  8379. @end example
  8380. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8381. basically, they refer to the frame and field of the opposite parity:
  8382. @itemize
  8383. @item @var{p} matches the field of the opposite parity in the previous frame
  8384. @item @var{c} matches the field of the opposite parity in the current frame
  8385. @item @var{n} matches the field of the opposite parity in the next frame
  8386. @end itemize
  8387. @subsubsection u/b
  8388. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8389. from the opposite parity flag. In the following examples, we assume that we are
  8390. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8391. 'x' is placed above and below each matched fields.
  8392. With bottom matching (@option{field}=@var{bottom}):
  8393. @example
  8394. Match: c p n b u
  8395. x x x x x
  8396. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8397. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8398. x x x x x
  8399. Output frames:
  8400. 2 1 2 2 2
  8401. 2 2 2 1 3
  8402. @end example
  8403. With top matching (@option{field}=@var{top}):
  8404. @example
  8405. Match: c p n b u
  8406. x x x x x
  8407. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8408. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8409. x x x x x
  8410. Output frames:
  8411. 2 2 2 1 2
  8412. 2 1 3 2 2
  8413. @end example
  8414. @subsection Examples
  8415. Simple IVTC of a top field first telecined stream:
  8416. @example
  8417. fieldmatch=order=tff:combmatch=none, decimate
  8418. @end example
  8419. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8420. @example
  8421. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8422. @end example
  8423. @section fieldorder
  8424. Transform the field order of the input video.
  8425. It accepts the following parameters:
  8426. @table @option
  8427. @item order
  8428. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8429. for bottom field first.
  8430. @end table
  8431. The default value is @samp{tff}.
  8432. The transformation is done by shifting the picture content up or down
  8433. by one line, and filling the remaining line with appropriate picture content.
  8434. This method is consistent with most broadcast field order converters.
  8435. If the input video is not flagged as being interlaced, or it is already
  8436. flagged as being of the required output field order, then this filter does
  8437. not alter the incoming video.
  8438. It is very useful when converting to or from PAL DV material,
  8439. which is bottom field first.
  8440. For example:
  8441. @example
  8442. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8443. @end example
  8444. @section fifo, afifo
  8445. Buffer input images and send them when they are requested.
  8446. It is mainly useful when auto-inserted by the libavfilter
  8447. framework.
  8448. It does not take parameters.
  8449. @section fillborders
  8450. Fill borders of the input video, without changing video stream dimensions.
  8451. Sometimes video can have garbage at the four edges and you may not want to
  8452. crop video input to keep size multiple of some number.
  8453. This filter accepts the following options:
  8454. @table @option
  8455. @item left
  8456. Number of pixels to fill from left border.
  8457. @item right
  8458. Number of pixels to fill from right border.
  8459. @item top
  8460. Number of pixels to fill from top border.
  8461. @item bottom
  8462. Number of pixels to fill from bottom border.
  8463. @item mode
  8464. Set fill mode.
  8465. It accepts the following values:
  8466. @table @samp
  8467. @item smear
  8468. fill pixels using outermost pixels
  8469. @item mirror
  8470. fill pixels using mirroring
  8471. @item fixed
  8472. fill pixels with constant value
  8473. @end table
  8474. Default is @var{smear}.
  8475. @item color
  8476. Set color for pixels in fixed mode. Default is @var{black}.
  8477. @end table
  8478. @subsection Commands
  8479. This filter supports same @ref{commands} as options.
  8480. The command accepts the same syntax of the corresponding option.
  8481. If the specified expression is not valid, it is kept at its current
  8482. value.
  8483. @section find_rect
  8484. Find a rectangular object
  8485. It accepts the following options:
  8486. @table @option
  8487. @item object
  8488. Filepath of the object image, needs to be in gray8.
  8489. @item threshold
  8490. Detection threshold, default is 0.5.
  8491. @item mipmaps
  8492. Number of mipmaps, default is 3.
  8493. @item xmin, ymin, xmax, ymax
  8494. Specifies the rectangle in which to search.
  8495. @end table
  8496. @subsection Examples
  8497. @itemize
  8498. @item
  8499. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8500. @example
  8501. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8502. @end example
  8503. @end itemize
  8504. @section floodfill
  8505. Flood area with values of same pixel components with another values.
  8506. It accepts the following options:
  8507. @table @option
  8508. @item x
  8509. Set pixel x coordinate.
  8510. @item y
  8511. Set pixel y coordinate.
  8512. @item s0
  8513. Set source #0 component value.
  8514. @item s1
  8515. Set source #1 component value.
  8516. @item s2
  8517. Set source #2 component value.
  8518. @item s3
  8519. Set source #3 component value.
  8520. @item d0
  8521. Set destination #0 component value.
  8522. @item d1
  8523. Set destination #1 component value.
  8524. @item d2
  8525. Set destination #2 component value.
  8526. @item d3
  8527. Set destination #3 component value.
  8528. @end table
  8529. @anchor{format}
  8530. @section format
  8531. Convert the input video to one of the specified pixel formats.
  8532. Libavfilter will try to pick one that is suitable as input to
  8533. the next filter.
  8534. It accepts the following parameters:
  8535. @table @option
  8536. @item pix_fmts
  8537. A '|'-separated list of pixel format names, such as
  8538. "pix_fmts=yuv420p|monow|rgb24".
  8539. @end table
  8540. @subsection Examples
  8541. @itemize
  8542. @item
  8543. Convert the input video to the @var{yuv420p} format
  8544. @example
  8545. format=pix_fmts=yuv420p
  8546. @end example
  8547. Convert the input video to any of the formats in the list
  8548. @example
  8549. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8550. @end example
  8551. @end itemize
  8552. @anchor{fps}
  8553. @section fps
  8554. Convert the video to specified constant frame rate by duplicating or dropping
  8555. frames as necessary.
  8556. It accepts the following parameters:
  8557. @table @option
  8558. @item fps
  8559. The desired output frame rate. The default is @code{25}.
  8560. @item start_time
  8561. Assume the first PTS should be the given value, in seconds. This allows for
  8562. padding/trimming at the start of stream. By default, no assumption is made
  8563. about the first frame's expected PTS, so no padding or trimming is done.
  8564. For example, this could be set to 0 to pad the beginning with duplicates of
  8565. the first frame if a video stream starts after the audio stream or to trim any
  8566. frames with a negative PTS.
  8567. @item round
  8568. Timestamp (PTS) rounding method.
  8569. Possible values are:
  8570. @table @option
  8571. @item zero
  8572. round towards 0
  8573. @item inf
  8574. round away from 0
  8575. @item down
  8576. round towards -infinity
  8577. @item up
  8578. round towards +infinity
  8579. @item near
  8580. round to nearest
  8581. @end table
  8582. The default is @code{near}.
  8583. @item eof_action
  8584. Action performed when reading the last frame.
  8585. Possible values are:
  8586. @table @option
  8587. @item round
  8588. Use same timestamp rounding method as used for other frames.
  8589. @item pass
  8590. Pass through last frame if input duration has not been reached yet.
  8591. @end table
  8592. The default is @code{round}.
  8593. @end table
  8594. Alternatively, the options can be specified as a flat string:
  8595. @var{fps}[:@var{start_time}[:@var{round}]].
  8596. See also the @ref{setpts} filter.
  8597. @subsection Examples
  8598. @itemize
  8599. @item
  8600. A typical usage in order to set the fps to 25:
  8601. @example
  8602. fps=fps=25
  8603. @end example
  8604. @item
  8605. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8606. @example
  8607. fps=fps=film:round=near
  8608. @end example
  8609. @end itemize
  8610. @section framepack
  8611. Pack two different video streams into a stereoscopic video, setting proper
  8612. metadata on supported codecs. The two views should have the same size and
  8613. framerate and processing will stop when the shorter video ends. Please note
  8614. that you may conveniently adjust view properties with the @ref{scale} and
  8615. @ref{fps} filters.
  8616. It accepts the following parameters:
  8617. @table @option
  8618. @item format
  8619. The desired packing format. Supported values are:
  8620. @table @option
  8621. @item sbs
  8622. The views are next to each other (default).
  8623. @item tab
  8624. The views are on top of each other.
  8625. @item lines
  8626. The views are packed by line.
  8627. @item columns
  8628. The views are packed by column.
  8629. @item frameseq
  8630. The views are temporally interleaved.
  8631. @end table
  8632. @end table
  8633. Some examples:
  8634. @example
  8635. # Convert left and right views into a frame-sequential video
  8636. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8637. # Convert views into a side-by-side video with the same output resolution as the input
  8638. 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
  8639. @end example
  8640. @section framerate
  8641. Change the frame rate by interpolating new video output frames from the source
  8642. frames.
  8643. This filter is not designed to function correctly with interlaced media. If
  8644. you wish to change the frame rate of interlaced media then you are required
  8645. to deinterlace before this filter and re-interlace after this filter.
  8646. A description of the accepted options follows.
  8647. @table @option
  8648. @item fps
  8649. Specify the output frames per second. This option can also be specified
  8650. as a value alone. The default is @code{50}.
  8651. @item interp_start
  8652. Specify the start of a range where the output frame will be created as a
  8653. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8654. the default is @code{15}.
  8655. @item interp_end
  8656. Specify the end of a range where the output frame will be created as a
  8657. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8658. the default is @code{240}.
  8659. @item scene
  8660. Specify the level at which a scene change is detected as a value between
  8661. 0 and 100 to indicate a new scene; a low value reflects a low
  8662. probability for the current frame to introduce a new scene, while a higher
  8663. value means the current frame is more likely to be one.
  8664. The default is @code{8.2}.
  8665. @item flags
  8666. Specify flags influencing the filter process.
  8667. Available value for @var{flags} is:
  8668. @table @option
  8669. @item scene_change_detect, scd
  8670. Enable scene change detection using the value of the option @var{scene}.
  8671. This flag is enabled by default.
  8672. @end table
  8673. @end table
  8674. @section framestep
  8675. Select one frame every N-th frame.
  8676. This filter accepts the following option:
  8677. @table @option
  8678. @item step
  8679. Select frame after every @code{step} frames.
  8680. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8681. @end table
  8682. @section freezedetect
  8683. Detect frozen video.
  8684. This filter logs a message and sets frame metadata when it detects that the
  8685. input video has no significant change in content during a specified duration.
  8686. Video freeze detection calculates the mean average absolute difference of all
  8687. the components of video frames and compares it to a noise floor.
  8688. The printed times and duration are expressed in seconds. The
  8689. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8690. whose timestamp equals or exceeds the detection duration and it contains the
  8691. timestamp of the first frame of the freeze. The
  8692. @code{lavfi.freezedetect.freeze_duration} and
  8693. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8694. after the freeze.
  8695. The filter accepts the following options:
  8696. @table @option
  8697. @item noise, n
  8698. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8699. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8700. 0.001.
  8701. @item duration, d
  8702. Set freeze duration until notification (default is 2 seconds).
  8703. @end table
  8704. @section freezeframes
  8705. Freeze video frames.
  8706. This filter freezes video frames using frame from 2nd input.
  8707. The filter accepts the following options:
  8708. @table @option
  8709. @item first
  8710. Set number of first frame from which to start freeze.
  8711. @item last
  8712. Set number of last frame from which to end freeze.
  8713. @item replace
  8714. Set number of frame from 2nd input which will be used instead of replaced frames.
  8715. @end table
  8716. @anchor{frei0r}
  8717. @section frei0r
  8718. Apply a frei0r effect to the input video.
  8719. To enable the compilation of this filter, you need to install the frei0r
  8720. header and configure FFmpeg with @code{--enable-frei0r}.
  8721. It accepts the following parameters:
  8722. @table @option
  8723. @item filter_name
  8724. The name of the frei0r effect to load. If the environment variable
  8725. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8726. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8727. Otherwise, the standard frei0r paths are searched, in this order:
  8728. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8729. @file{/usr/lib/frei0r-1/}.
  8730. @item filter_params
  8731. A '|'-separated list of parameters to pass to the frei0r effect.
  8732. @end table
  8733. A frei0r effect parameter can be a boolean (its value is either
  8734. "y" or "n"), a double, a color (specified as
  8735. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8736. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8737. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8738. a position (specified as @var{X}/@var{Y}, where
  8739. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8740. The number and types of parameters depend on the loaded effect. If an
  8741. effect parameter is not specified, the default value is set.
  8742. @subsection Examples
  8743. @itemize
  8744. @item
  8745. Apply the distort0r effect, setting the first two double parameters:
  8746. @example
  8747. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8748. @end example
  8749. @item
  8750. Apply the colordistance effect, taking a color as the first parameter:
  8751. @example
  8752. frei0r=colordistance:0.2/0.3/0.4
  8753. frei0r=colordistance:violet
  8754. frei0r=colordistance:0x112233
  8755. @end example
  8756. @item
  8757. Apply the perspective effect, specifying the top left and top right image
  8758. positions:
  8759. @example
  8760. frei0r=perspective:0.2/0.2|0.8/0.2
  8761. @end example
  8762. @end itemize
  8763. For more information, see
  8764. @url{http://frei0r.dyne.org}
  8765. @section fspp
  8766. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8767. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8768. processing filter, one of them is performed once per block, not per pixel.
  8769. This allows for much higher speed.
  8770. The filter accepts the following options:
  8771. @table @option
  8772. @item quality
  8773. Set quality. This option defines the number of levels for averaging. It accepts
  8774. an integer in the range 4-5. Default value is @code{4}.
  8775. @item qp
  8776. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8777. If not set, the filter will use the QP from the video stream (if available).
  8778. @item strength
  8779. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8780. more details but also more artifacts, while higher values make the image smoother
  8781. but also blurrier. Default value is @code{0} − PSNR optimal.
  8782. @item use_bframe_qp
  8783. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8784. option may cause flicker since the B-Frames have often larger QP. Default is
  8785. @code{0} (not enabled).
  8786. @end table
  8787. @section gblur
  8788. Apply Gaussian blur filter.
  8789. The filter accepts the following options:
  8790. @table @option
  8791. @item sigma
  8792. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8793. @item steps
  8794. Set number of steps for Gaussian approximation. Default is @code{1}.
  8795. @item planes
  8796. Set which planes to filter. By default all planes are filtered.
  8797. @item sigmaV
  8798. Set vertical sigma, if negative it will be same as @code{sigma}.
  8799. Default is @code{-1}.
  8800. @end table
  8801. @subsection Commands
  8802. This filter supports same commands as options.
  8803. The command accepts the same syntax of the corresponding option.
  8804. If the specified expression is not valid, it is kept at its current
  8805. value.
  8806. @section geq
  8807. Apply generic equation to each pixel.
  8808. The filter accepts the following options:
  8809. @table @option
  8810. @item lum_expr, lum
  8811. Set the luminance expression.
  8812. @item cb_expr, cb
  8813. Set the chrominance blue expression.
  8814. @item cr_expr, cr
  8815. Set the chrominance red expression.
  8816. @item alpha_expr, a
  8817. Set the alpha expression.
  8818. @item red_expr, r
  8819. Set the red expression.
  8820. @item green_expr, g
  8821. Set the green expression.
  8822. @item blue_expr, b
  8823. Set the blue expression.
  8824. @end table
  8825. The colorspace is selected according to the specified options. If one
  8826. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8827. options is specified, the filter will automatically select a YCbCr
  8828. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8829. @option{blue_expr} options is specified, it will select an RGB
  8830. colorspace.
  8831. If one of the chrominance expression is not defined, it falls back on the other
  8832. one. If no alpha expression is specified it will evaluate to opaque value.
  8833. If none of chrominance expressions are specified, they will evaluate
  8834. to the luminance expression.
  8835. The expressions can use the following variables and functions:
  8836. @table @option
  8837. @item N
  8838. The sequential number of the filtered frame, starting from @code{0}.
  8839. @item X
  8840. @item Y
  8841. The coordinates of the current sample.
  8842. @item W
  8843. @item H
  8844. The width and height of the image.
  8845. @item SW
  8846. @item SH
  8847. Width and height scale depending on the currently filtered plane. It is the
  8848. ratio between the corresponding luma plane number of pixels and the current
  8849. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8850. @code{0.5,0.5} for chroma planes.
  8851. @item T
  8852. Time of the current frame, expressed in seconds.
  8853. @item p(x, y)
  8854. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8855. plane.
  8856. @item lum(x, y)
  8857. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8858. plane.
  8859. @item cb(x, y)
  8860. Return the value of the pixel at location (@var{x},@var{y}) of the
  8861. blue-difference chroma plane. Return 0 if there is no such plane.
  8862. @item cr(x, y)
  8863. Return the value of the pixel at location (@var{x},@var{y}) of the
  8864. red-difference chroma plane. Return 0 if there is no such plane.
  8865. @item r(x, y)
  8866. @item g(x, y)
  8867. @item b(x, y)
  8868. Return the value of the pixel at location (@var{x},@var{y}) of the
  8869. red/green/blue component. Return 0 if there is no such component.
  8870. @item alpha(x, y)
  8871. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8872. plane. Return 0 if there is no such plane.
  8873. @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)
  8874. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  8875. sums of samples within a rectangle. See the functions without the sum postfix.
  8876. @item interpolation
  8877. Set one of interpolation methods:
  8878. @table @option
  8879. @item nearest, n
  8880. @item bilinear, b
  8881. @end table
  8882. Default is bilinear.
  8883. @end table
  8884. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8885. automatically clipped to the closer edge.
  8886. Please note that this filter can use multiple threads in which case each slice
  8887. will have its own expression state. If you want to use only a single expression
  8888. state because your expressions depend on previous state then you should limit
  8889. the number of filter threads to 1.
  8890. @subsection Examples
  8891. @itemize
  8892. @item
  8893. Flip the image horizontally:
  8894. @example
  8895. geq=p(W-X\,Y)
  8896. @end example
  8897. @item
  8898. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8899. wavelength of 100 pixels:
  8900. @example
  8901. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8902. @end example
  8903. @item
  8904. Generate a fancy enigmatic moving light:
  8905. @example
  8906. 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
  8907. @end example
  8908. @item
  8909. Generate a quick emboss effect:
  8910. @example
  8911. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8912. @end example
  8913. @item
  8914. Modify RGB components depending on pixel position:
  8915. @example
  8916. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8917. @end example
  8918. @item
  8919. Create a radial gradient that is the same size as the input (also see
  8920. the @ref{vignette} filter):
  8921. @example
  8922. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8923. @end example
  8924. @end itemize
  8925. @section gradfun
  8926. Fix the banding artifacts that are sometimes introduced into nearly flat
  8927. regions by truncation to 8-bit color depth.
  8928. Interpolate the gradients that should go where the bands are, and
  8929. dither them.
  8930. It is designed for playback only. Do not use it prior to
  8931. lossy compression, because compression tends to lose the dither and
  8932. bring back the bands.
  8933. It accepts the following parameters:
  8934. @table @option
  8935. @item strength
  8936. The maximum amount by which the filter will change any one pixel. This is also
  8937. the threshold for detecting nearly flat regions. Acceptable values range from
  8938. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8939. valid range.
  8940. @item radius
  8941. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8942. gradients, but also prevents the filter from modifying the pixels near detailed
  8943. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8944. values will be clipped to the valid range.
  8945. @end table
  8946. Alternatively, the options can be specified as a flat string:
  8947. @var{strength}[:@var{radius}]
  8948. @subsection Examples
  8949. @itemize
  8950. @item
  8951. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8952. @example
  8953. gradfun=3.5:8
  8954. @end example
  8955. @item
  8956. Specify radius, omitting the strength (which will fall-back to the default
  8957. value):
  8958. @example
  8959. gradfun=radius=8
  8960. @end example
  8961. @end itemize
  8962. @anchor{graphmonitor}
  8963. @section graphmonitor
  8964. Show various filtergraph stats.
  8965. With this filter one can debug complete filtergraph.
  8966. Especially issues with links filling with queued frames.
  8967. The filter accepts the following options:
  8968. @table @option
  8969. @item size, s
  8970. Set video output size. Default is @var{hd720}.
  8971. @item opacity, o
  8972. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8973. @item mode, m
  8974. Set output mode, can be @var{fulll} or @var{compact}.
  8975. In @var{compact} mode only filters with some queued frames have displayed stats.
  8976. @item flags, f
  8977. Set flags which enable which stats are shown in video.
  8978. Available values for flags are:
  8979. @table @samp
  8980. @item queue
  8981. Display number of queued frames in each link.
  8982. @item frame_count_in
  8983. Display number of frames taken from filter.
  8984. @item frame_count_out
  8985. Display number of frames given out from filter.
  8986. @item pts
  8987. Display current filtered frame pts.
  8988. @item time
  8989. Display current filtered frame time.
  8990. @item timebase
  8991. Display time base for filter link.
  8992. @item format
  8993. Display used format for filter link.
  8994. @item size
  8995. Display video size or number of audio channels in case of audio used by filter link.
  8996. @item rate
  8997. Display video frame rate or sample rate in case of audio used by filter link.
  8998. @end table
  8999. @item rate, r
  9000. Set upper limit for video rate of output stream, Default value is @var{25}.
  9001. This guarantee that output video frame rate will not be higher than this value.
  9002. @end table
  9003. @section greyedge
  9004. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  9005. and corrects the scene colors accordingly.
  9006. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  9007. The filter accepts the following options:
  9008. @table @option
  9009. @item difford
  9010. The order of differentiation to be applied on the scene. Must be chosen in the range
  9011. [0,2] and default value is 1.
  9012. @item minknorm
  9013. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  9014. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  9015. max value instead of calculating Minkowski distance.
  9016. @item sigma
  9017. The standard deviation of Gaussian blur to be applied on the scene. Must be
  9018. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  9019. can't be equal to 0 if @var{difford} is greater than 0.
  9020. @end table
  9021. @subsection Examples
  9022. @itemize
  9023. @item
  9024. Grey Edge:
  9025. @example
  9026. greyedge=difford=1:minknorm=5:sigma=2
  9027. @end example
  9028. @item
  9029. Max Edge:
  9030. @example
  9031. greyedge=difford=1:minknorm=0:sigma=2
  9032. @end example
  9033. @end itemize
  9034. @anchor{haldclut}
  9035. @section haldclut
  9036. Apply a Hald CLUT to a video stream.
  9037. First input is the video stream to process, and second one is the Hald CLUT.
  9038. The Hald CLUT input can be a simple picture or a complete video stream.
  9039. The filter accepts the following options:
  9040. @table @option
  9041. @item shortest
  9042. Force termination when the shortest input terminates. Default is @code{0}.
  9043. @item repeatlast
  9044. Continue applying the last CLUT after the end of the stream. A value of
  9045. @code{0} disable the filter after the last frame of the CLUT is reached.
  9046. Default is @code{1}.
  9047. @end table
  9048. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9049. filters share the same internals).
  9050. This filter also supports the @ref{framesync} options.
  9051. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9052. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9053. @subsection Workflow examples
  9054. @subsubsection Hald CLUT video stream
  9055. Generate an identity Hald CLUT stream altered with various effects:
  9056. @example
  9057. 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
  9058. @end example
  9059. Note: make sure you use a lossless codec.
  9060. Then use it with @code{haldclut} to apply it on some random stream:
  9061. @example
  9062. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9063. @end example
  9064. The Hald CLUT will be applied to the 10 first seconds (duration of
  9065. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9066. to the remaining frames of the @code{mandelbrot} stream.
  9067. @subsubsection Hald CLUT with preview
  9068. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9069. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9070. biggest possible square starting at the top left of the picture. The remaining
  9071. padding pixels (bottom or right) will be ignored. This area can be used to add
  9072. a preview of the Hald CLUT.
  9073. Typically, the following generated Hald CLUT will be supported by the
  9074. @code{haldclut} filter:
  9075. @example
  9076. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9077. pad=iw+320 [padded_clut];
  9078. smptebars=s=320x256, split [a][b];
  9079. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9080. [main][b] overlay=W-320" -frames:v 1 clut.png
  9081. @end example
  9082. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9083. bars are displayed on the right-top, and below the same color bars processed by
  9084. the color changes.
  9085. Then, the effect of this Hald CLUT can be visualized with:
  9086. @example
  9087. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9088. @end example
  9089. @section hflip
  9090. Flip the input video horizontally.
  9091. For example, to horizontally flip the input video with @command{ffmpeg}:
  9092. @example
  9093. ffmpeg -i in.avi -vf "hflip" out.avi
  9094. @end example
  9095. @section histeq
  9096. This filter applies a global color histogram equalization on a
  9097. per-frame basis.
  9098. It can be used to correct video that has a compressed range of pixel
  9099. intensities. The filter redistributes the pixel intensities to
  9100. equalize their distribution across the intensity range. It may be
  9101. viewed as an "automatically adjusting contrast filter". This filter is
  9102. useful only for correcting degraded or poorly captured source
  9103. video.
  9104. The filter accepts the following options:
  9105. @table @option
  9106. @item strength
  9107. Determine the amount of equalization to be applied. As the strength
  9108. is reduced, the distribution of pixel intensities more-and-more
  9109. approaches that of the input frame. The value must be a float number
  9110. in the range [0,1] and defaults to 0.200.
  9111. @item intensity
  9112. Set the maximum intensity that can generated and scale the output
  9113. values appropriately. The strength should be set as desired and then
  9114. the intensity can be limited if needed to avoid washing-out. The value
  9115. must be a float number in the range [0,1] and defaults to 0.210.
  9116. @item antibanding
  9117. Set the antibanding level. If enabled the filter will randomly vary
  9118. the luminance of output pixels by a small amount to avoid banding of
  9119. the histogram. Possible values are @code{none}, @code{weak} or
  9120. @code{strong}. It defaults to @code{none}.
  9121. @end table
  9122. @anchor{histogram}
  9123. @section histogram
  9124. Compute and draw a color distribution histogram for the input video.
  9125. The computed histogram is a representation of the color component
  9126. distribution in an image.
  9127. Standard histogram displays the color components distribution in an image.
  9128. Displays color graph for each color component. Shows distribution of
  9129. the Y, U, V, A or R, G, B components, depending on input format, in the
  9130. current frame. Below each graph a color component scale meter is shown.
  9131. The filter accepts the following options:
  9132. @table @option
  9133. @item level_height
  9134. Set height of level. Default value is @code{200}.
  9135. Allowed range is [50, 2048].
  9136. @item scale_height
  9137. Set height of color scale. Default value is @code{12}.
  9138. Allowed range is [0, 40].
  9139. @item display_mode
  9140. Set display mode.
  9141. It accepts the following values:
  9142. @table @samp
  9143. @item stack
  9144. Per color component graphs are placed below each other.
  9145. @item parade
  9146. Per color component graphs are placed side by side.
  9147. @item overlay
  9148. Presents information identical to that in the @code{parade}, except
  9149. that the graphs representing color components are superimposed directly
  9150. over one another.
  9151. @end table
  9152. Default is @code{stack}.
  9153. @item levels_mode
  9154. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9155. Default is @code{linear}.
  9156. @item components
  9157. Set what color components to display.
  9158. Default is @code{7}.
  9159. @item fgopacity
  9160. Set foreground opacity. Default is @code{0.7}.
  9161. @item bgopacity
  9162. Set background opacity. Default is @code{0.5}.
  9163. @end table
  9164. @subsection Examples
  9165. @itemize
  9166. @item
  9167. Calculate and draw histogram:
  9168. @example
  9169. ffplay -i input -vf histogram
  9170. @end example
  9171. @end itemize
  9172. @anchor{hqdn3d}
  9173. @section hqdn3d
  9174. This is a high precision/quality 3d denoise filter. It aims to reduce
  9175. image noise, producing smooth images and making still images really
  9176. still. It should enhance compressibility.
  9177. It accepts the following optional parameters:
  9178. @table @option
  9179. @item luma_spatial
  9180. A non-negative floating point number which specifies spatial luma strength.
  9181. It defaults to 4.0.
  9182. @item chroma_spatial
  9183. A non-negative floating point number which specifies spatial chroma strength.
  9184. It defaults to 3.0*@var{luma_spatial}/4.0.
  9185. @item luma_tmp
  9186. A floating point number which specifies luma temporal strength. It defaults to
  9187. 6.0*@var{luma_spatial}/4.0.
  9188. @item chroma_tmp
  9189. A floating point number which specifies chroma temporal strength. It defaults to
  9190. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9191. @end table
  9192. @subsection Commands
  9193. This filter supports same @ref{commands} as options.
  9194. The command accepts the same syntax of the corresponding option.
  9195. If the specified expression is not valid, it is kept at its current
  9196. value.
  9197. @anchor{hwdownload}
  9198. @section hwdownload
  9199. Download hardware frames to system memory.
  9200. The input must be in hardware frames, and the output a non-hardware format.
  9201. Not all formats will be supported on the output - it may be necessary to insert
  9202. an additional @option{format} filter immediately following in the graph to get
  9203. the output in a supported format.
  9204. @section hwmap
  9205. Map hardware frames to system memory or to another device.
  9206. This filter has several different modes of operation; which one is used depends
  9207. on the input and output formats:
  9208. @itemize
  9209. @item
  9210. Hardware frame input, normal frame output
  9211. Map the input frames to system memory and pass them to the output. If the
  9212. original hardware frame is later required (for example, after overlaying
  9213. something else on part of it), the @option{hwmap} filter can be used again
  9214. in the next mode to retrieve it.
  9215. @item
  9216. Normal frame input, hardware frame output
  9217. If the input is actually a software-mapped hardware frame, then unmap it -
  9218. that is, return the original hardware frame.
  9219. Otherwise, a device must be provided. Create new hardware surfaces on that
  9220. device for the output, then map them back to the software format at the input
  9221. and give those frames to the preceding filter. This will then act like the
  9222. @option{hwupload} filter, but may be able to avoid an additional copy when
  9223. the input is already in a compatible format.
  9224. @item
  9225. Hardware frame input and output
  9226. A device must be supplied for the output, either directly or with the
  9227. @option{derive_device} option. The input and output devices must be of
  9228. different types and compatible - the exact meaning of this is
  9229. system-dependent, but typically it means that they must refer to the same
  9230. underlying hardware context (for example, refer to the same graphics card).
  9231. If the input frames were originally created on the output device, then unmap
  9232. to retrieve the original frames.
  9233. Otherwise, map the frames to the output device - create new hardware frames
  9234. on the output corresponding to the frames on the input.
  9235. @end itemize
  9236. The following additional parameters are accepted:
  9237. @table @option
  9238. @item mode
  9239. Set the frame mapping mode. Some combination of:
  9240. @table @var
  9241. @item read
  9242. The mapped frame should be readable.
  9243. @item write
  9244. The mapped frame should be writeable.
  9245. @item overwrite
  9246. The mapping will always overwrite the entire frame.
  9247. This may improve performance in some cases, as the original contents of the
  9248. frame need not be loaded.
  9249. @item direct
  9250. The mapping must not involve any copying.
  9251. Indirect mappings to copies of frames are created in some cases where either
  9252. direct mapping is not possible or it would have unexpected properties.
  9253. Setting this flag ensures that the mapping is direct and will fail if that is
  9254. not possible.
  9255. @end table
  9256. Defaults to @var{read+write} if not specified.
  9257. @item derive_device @var{type}
  9258. Rather than using the device supplied at initialisation, instead derive a new
  9259. device of type @var{type} from the device the input frames exist on.
  9260. @item reverse
  9261. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9262. and map them back to the source. This may be necessary in some cases where
  9263. a mapping in one direction is required but only the opposite direction is
  9264. supported by the devices being used.
  9265. This option is dangerous - it may break the preceding filter in undefined
  9266. ways if there are any additional constraints on that filter's output.
  9267. Do not use it without fully understanding the implications of its use.
  9268. @end table
  9269. @anchor{hwupload}
  9270. @section hwupload
  9271. Upload system memory frames to hardware surfaces.
  9272. The device to upload to must be supplied when the filter is initialised. If
  9273. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9274. option or with the @option{derive_device} option. The input and output devices
  9275. must be of different types and compatible - the exact meaning of this is
  9276. system-dependent, but typically it means that they must refer to the same
  9277. underlying hardware context (for example, refer to the same graphics card).
  9278. The following additional parameters are accepted:
  9279. @table @option
  9280. @item derive_device @var{type}
  9281. Rather than using the device supplied at initialisation, instead derive a new
  9282. device of type @var{type} from the device the input frames exist on.
  9283. @end table
  9284. @anchor{hwupload_cuda}
  9285. @section hwupload_cuda
  9286. Upload system memory frames to a CUDA device.
  9287. It accepts the following optional parameters:
  9288. @table @option
  9289. @item device
  9290. The number of the CUDA device to use
  9291. @end table
  9292. @section hqx
  9293. Apply a high-quality magnification filter designed for pixel art. This filter
  9294. was originally created by Maxim Stepin.
  9295. It accepts the following option:
  9296. @table @option
  9297. @item n
  9298. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9299. @code{hq3x} and @code{4} for @code{hq4x}.
  9300. Default is @code{3}.
  9301. @end table
  9302. @section hstack
  9303. Stack input videos horizontally.
  9304. All streams must be of same pixel format and of same height.
  9305. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9306. to create same output.
  9307. The filter accepts the following option:
  9308. @table @option
  9309. @item inputs
  9310. Set number of input streams. Default is 2.
  9311. @item shortest
  9312. If set to 1, force the output to terminate when the shortest input
  9313. terminates. Default value is 0.
  9314. @end table
  9315. @section hue
  9316. Modify the hue and/or the saturation of the input.
  9317. It accepts the following parameters:
  9318. @table @option
  9319. @item h
  9320. Specify the hue angle as a number of degrees. It accepts an expression,
  9321. and defaults to "0".
  9322. @item s
  9323. Specify the saturation in the [-10,10] range. It accepts an expression and
  9324. defaults to "1".
  9325. @item H
  9326. Specify the hue angle as a number of radians. It accepts an
  9327. expression, and defaults to "0".
  9328. @item b
  9329. Specify the brightness in the [-10,10] range. It accepts an expression and
  9330. defaults to "0".
  9331. @end table
  9332. @option{h} and @option{H} are mutually exclusive, and can't be
  9333. specified at the same time.
  9334. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9335. expressions containing the following constants:
  9336. @table @option
  9337. @item n
  9338. frame count of the input frame starting from 0
  9339. @item pts
  9340. presentation timestamp of the input frame expressed in time base units
  9341. @item r
  9342. frame rate of the input video, NAN if the input frame rate is unknown
  9343. @item t
  9344. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9345. @item tb
  9346. time base of the input video
  9347. @end table
  9348. @subsection Examples
  9349. @itemize
  9350. @item
  9351. Set the hue to 90 degrees and the saturation to 1.0:
  9352. @example
  9353. hue=h=90:s=1
  9354. @end example
  9355. @item
  9356. Same command but expressing the hue in radians:
  9357. @example
  9358. hue=H=PI/2:s=1
  9359. @end example
  9360. @item
  9361. Rotate hue and make the saturation swing between 0
  9362. and 2 over a period of 1 second:
  9363. @example
  9364. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9365. @end example
  9366. @item
  9367. Apply a 3 seconds saturation fade-in effect starting at 0:
  9368. @example
  9369. hue="s=min(t/3\,1)"
  9370. @end example
  9371. The general fade-in expression can be written as:
  9372. @example
  9373. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9374. @end example
  9375. @item
  9376. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9377. @example
  9378. hue="s=max(0\, min(1\, (8-t)/3))"
  9379. @end example
  9380. The general fade-out expression can be written as:
  9381. @example
  9382. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9383. @end example
  9384. @end itemize
  9385. @subsection Commands
  9386. This filter supports the following commands:
  9387. @table @option
  9388. @item b
  9389. @item s
  9390. @item h
  9391. @item H
  9392. Modify the hue and/or the saturation and/or brightness of the input video.
  9393. The command accepts the same syntax of the corresponding option.
  9394. If the specified expression is not valid, it is kept at its current
  9395. value.
  9396. @end table
  9397. @section hysteresis
  9398. Grow first stream into second stream by connecting components.
  9399. This makes it possible to build more robust edge masks.
  9400. This filter accepts the following options:
  9401. @table @option
  9402. @item planes
  9403. Set which planes will be processed as bitmap, unprocessed planes will be
  9404. copied from first stream.
  9405. By default value 0xf, all planes will be processed.
  9406. @item threshold
  9407. Set threshold which is used in filtering. If pixel component value is higher than
  9408. this value filter algorithm for connecting components is activated.
  9409. By default value is 0.
  9410. @end table
  9411. The @code{hysteresis} filter also supports the @ref{framesync} options.
  9412. @section idet
  9413. Detect video interlacing type.
  9414. This filter tries to detect if the input frames are interlaced, progressive,
  9415. top or bottom field first. It will also try to detect fields that are
  9416. repeated between adjacent frames (a sign of telecine).
  9417. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9418. Multiple frame detection incorporates the classification history of previous frames.
  9419. The filter will log these metadata values:
  9420. @table @option
  9421. @item single.current_frame
  9422. Detected type of current frame using single-frame detection. One of:
  9423. ``tff'' (top field first), ``bff'' (bottom field first),
  9424. ``progressive'', or ``undetermined''
  9425. @item single.tff
  9426. Cumulative number of frames detected as top field first using single-frame detection.
  9427. @item multiple.tff
  9428. Cumulative number of frames detected as top field first using multiple-frame detection.
  9429. @item single.bff
  9430. Cumulative number of frames detected as bottom field first using single-frame detection.
  9431. @item multiple.current_frame
  9432. Detected type of current frame using multiple-frame detection. One of:
  9433. ``tff'' (top field first), ``bff'' (bottom field first),
  9434. ``progressive'', or ``undetermined''
  9435. @item multiple.bff
  9436. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9437. @item single.progressive
  9438. Cumulative number of frames detected as progressive using single-frame detection.
  9439. @item multiple.progressive
  9440. Cumulative number of frames detected as progressive using multiple-frame detection.
  9441. @item single.undetermined
  9442. Cumulative number of frames that could not be classified using single-frame detection.
  9443. @item multiple.undetermined
  9444. Cumulative number of frames that could not be classified using multiple-frame detection.
  9445. @item repeated.current_frame
  9446. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9447. @item repeated.neither
  9448. Cumulative number of frames with no repeated field.
  9449. @item repeated.top
  9450. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9451. @item repeated.bottom
  9452. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9453. @end table
  9454. The filter accepts the following options:
  9455. @table @option
  9456. @item intl_thres
  9457. Set interlacing threshold.
  9458. @item prog_thres
  9459. Set progressive threshold.
  9460. @item rep_thres
  9461. Threshold for repeated field detection.
  9462. @item half_life
  9463. Number of frames after which a given frame's contribution to the
  9464. statistics is halved (i.e., it contributes only 0.5 to its
  9465. classification). The default of 0 means that all frames seen are given
  9466. full weight of 1.0 forever.
  9467. @item analyze_interlaced_flag
  9468. When this is not 0 then idet will use the specified number of frames to determine
  9469. if the interlaced flag is accurate, it will not count undetermined frames.
  9470. If the flag is found to be accurate it will be used without any further
  9471. computations, if it is found to be inaccurate it will be cleared without any
  9472. further computations. This allows inserting the idet filter as a low computational
  9473. method to clean up the interlaced flag
  9474. @end table
  9475. @section il
  9476. Deinterleave or interleave fields.
  9477. This filter allows one to process interlaced images fields without
  9478. deinterlacing them. Deinterleaving splits the input frame into 2
  9479. fields (so called half pictures). Odd lines are moved to the top
  9480. half of the output image, even lines to the bottom half.
  9481. You can process (filter) them independently and then re-interleave them.
  9482. The filter accepts the following options:
  9483. @table @option
  9484. @item luma_mode, l
  9485. @item chroma_mode, c
  9486. @item alpha_mode, a
  9487. Available values for @var{luma_mode}, @var{chroma_mode} and
  9488. @var{alpha_mode} are:
  9489. @table @samp
  9490. @item none
  9491. Do nothing.
  9492. @item deinterleave, d
  9493. Deinterleave fields, placing one above the other.
  9494. @item interleave, i
  9495. Interleave fields. Reverse the effect of deinterleaving.
  9496. @end table
  9497. Default value is @code{none}.
  9498. @item luma_swap, ls
  9499. @item chroma_swap, cs
  9500. @item alpha_swap, as
  9501. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9502. @end table
  9503. @subsection Commands
  9504. This filter supports the all above options as @ref{commands}.
  9505. @section inflate
  9506. Apply inflate effect to the video.
  9507. This filter replaces the pixel by the local(3x3) average by taking into account
  9508. only values higher than the pixel.
  9509. It accepts the following options:
  9510. @table @option
  9511. @item threshold0
  9512. @item threshold1
  9513. @item threshold2
  9514. @item threshold3
  9515. Limit the maximum change for each plane, default is 65535.
  9516. If 0, plane will remain unchanged.
  9517. @end table
  9518. @subsection Commands
  9519. This filter supports the all above options as @ref{commands}.
  9520. @section interlace
  9521. Simple interlacing filter from progressive contents. This interleaves upper (or
  9522. lower) lines from odd frames with lower (or upper) lines from even frames,
  9523. halving the frame rate and preserving image height.
  9524. @example
  9525. Original Original New Frame
  9526. Frame 'j' Frame 'j+1' (tff)
  9527. ========== =========== ==================
  9528. Line 0 --------------------> Frame 'j' Line 0
  9529. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9530. Line 2 ---------------------> Frame 'j' Line 2
  9531. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9532. ... ... ...
  9533. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9534. @end example
  9535. It accepts the following optional parameters:
  9536. @table @option
  9537. @item scan
  9538. This determines whether the interlaced frame is taken from the even
  9539. (tff - default) or odd (bff) lines of the progressive frame.
  9540. @item lowpass
  9541. Vertical lowpass filter to avoid twitter interlacing and
  9542. reduce moire patterns.
  9543. @table @samp
  9544. @item 0, off
  9545. Disable vertical lowpass filter
  9546. @item 1, linear
  9547. Enable linear filter (default)
  9548. @item 2, complex
  9549. Enable complex filter. This will slightly less reduce twitter and moire
  9550. but better retain detail and subjective sharpness impression.
  9551. @end table
  9552. @end table
  9553. @section kerndeint
  9554. Deinterlace input video by applying Donald Graft's adaptive kernel
  9555. deinterling. Work on interlaced parts of a video to produce
  9556. progressive frames.
  9557. The description of the accepted parameters follows.
  9558. @table @option
  9559. @item thresh
  9560. Set the threshold which affects the filter's tolerance when
  9561. determining if a pixel line must be processed. It must be an integer
  9562. in the range [0,255] and defaults to 10. A value of 0 will result in
  9563. applying the process on every pixels.
  9564. @item map
  9565. Paint pixels exceeding the threshold value to white if set to 1.
  9566. Default is 0.
  9567. @item order
  9568. Set the fields order. Swap fields if set to 1, leave fields alone if
  9569. 0. Default is 0.
  9570. @item sharp
  9571. Enable additional sharpening if set to 1. Default is 0.
  9572. @item twoway
  9573. Enable twoway sharpening if set to 1. Default is 0.
  9574. @end table
  9575. @subsection Examples
  9576. @itemize
  9577. @item
  9578. Apply default values:
  9579. @example
  9580. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9581. @end example
  9582. @item
  9583. Enable additional sharpening:
  9584. @example
  9585. kerndeint=sharp=1
  9586. @end example
  9587. @item
  9588. Paint processed pixels in white:
  9589. @example
  9590. kerndeint=map=1
  9591. @end example
  9592. @end itemize
  9593. @section lagfun
  9594. Slowly update darker pixels.
  9595. This filter makes short flashes of light appear longer.
  9596. This filter accepts the following options:
  9597. @table @option
  9598. @item decay
  9599. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9600. @item planes
  9601. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9602. @end table
  9603. @section lenscorrection
  9604. Correct radial lens distortion
  9605. This filter can be used to correct for radial distortion as can result from the use
  9606. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9607. one can use tools available for example as part of opencv or simply trial-and-error.
  9608. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9609. and extract the k1 and k2 coefficients from the resulting matrix.
  9610. Note that effectively the same filter is available in the open-source tools Krita and
  9611. Digikam from the KDE project.
  9612. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9613. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9614. brightness distribution, so you may want to use both filters together in certain
  9615. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9616. be applied before or after lens correction.
  9617. @subsection Options
  9618. The filter accepts the following options:
  9619. @table @option
  9620. @item cx
  9621. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9622. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9623. width. Default is 0.5.
  9624. @item cy
  9625. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9626. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9627. height. Default is 0.5.
  9628. @item k1
  9629. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9630. no correction. Default is 0.
  9631. @item k2
  9632. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9633. 0 means no correction. Default is 0.
  9634. @end table
  9635. The formula that generates the correction is:
  9636. @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)
  9637. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9638. distances from the focal point in the source and target images, respectively.
  9639. @section lensfun
  9640. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9641. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9642. to apply the lens correction. The filter will load the lensfun database and
  9643. query it to find the corresponding camera and lens entries in the database. As
  9644. long as these entries can be found with the given options, the filter can
  9645. perform corrections on frames. Note that incomplete strings will result in the
  9646. filter choosing the best match with the given options, and the filter will
  9647. output the chosen camera and lens models (logged with level "info"). You must
  9648. provide the make, camera model, and lens model as they are required.
  9649. The filter accepts the following options:
  9650. @table @option
  9651. @item make
  9652. The make of the camera (for example, "Canon"). This option is required.
  9653. @item model
  9654. The model of the camera (for example, "Canon EOS 100D"). This option is
  9655. required.
  9656. @item lens_model
  9657. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9658. option is required.
  9659. @item mode
  9660. The type of correction to apply. The following values are valid options:
  9661. @table @samp
  9662. @item vignetting
  9663. Enables fixing lens vignetting.
  9664. @item geometry
  9665. Enables fixing lens geometry. This is the default.
  9666. @item subpixel
  9667. Enables fixing chromatic aberrations.
  9668. @item vig_geo
  9669. Enables fixing lens vignetting and lens geometry.
  9670. @item vig_subpixel
  9671. Enables fixing lens vignetting and chromatic aberrations.
  9672. @item distortion
  9673. Enables fixing both lens geometry and chromatic aberrations.
  9674. @item all
  9675. Enables all possible corrections.
  9676. @end table
  9677. @item focal_length
  9678. The focal length of the image/video (zoom; expected constant for video). For
  9679. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9680. range should be chosen when using that lens. Default 18.
  9681. @item aperture
  9682. The aperture of the image/video (expected constant for video). Note that
  9683. aperture is only used for vignetting correction. Default 3.5.
  9684. @item focus_distance
  9685. The focus distance of the image/video (expected constant for video). Note that
  9686. focus distance is only used for vignetting and only slightly affects the
  9687. vignetting correction process. If unknown, leave it at the default value (which
  9688. is 1000).
  9689. @item scale
  9690. The scale factor which is applied after transformation. After correction the
  9691. video is no longer necessarily rectangular. This parameter controls how much of
  9692. the resulting image is visible. The value 0 means that a value will be chosen
  9693. automatically such that there is little or no unmapped area in the output
  9694. image. 1.0 means that no additional scaling is done. Lower values may result
  9695. in more of the corrected image being visible, while higher values may avoid
  9696. unmapped areas in the output.
  9697. @item target_geometry
  9698. The target geometry of the output image/video. The following values are valid
  9699. options:
  9700. @table @samp
  9701. @item rectilinear (default)
  9702. @item fisheye
  9703. @item panoramic
  9704. @item equirectangular
  9705. @item fisheye_orthographic
  9706. @item fisheye_stereographic
  9707. @item fisheye_equisolid
  9708. @item fisheye_thoby
  9709. @end table
  9710. @item reverse
  9711. Apply the reverse of image correction (instead of correcting distortion, apply
  9712. it).
  9713. @item interpolation
  9714. The type of interpolation used when correcting distortion. The following values
  9715. are valid options:
  9716. @table @samp
  9717. @item nearest
  9718. @item linear (default)
  9719. @item lanczos
  9720. @end table
  9721. @end table
  9722. @subsection Examples
  9723. @itemize
  9724. @item
  9725. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9726. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9727. aperture of "8.0".
  9728. @example
  9729. 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
  9730. @end example
  9731. @item
  9732. Apply the same as before, but only for the first 5 seconds of video.
  9733. @example
  9734. 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
  9735. @end example
  9736. @end itemize
  9737. @section libvmaf
  9738. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9739. score between two input videos.
  9740. The obtained VMAF score is printed through the logging system.
  9741. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9742. After installing the library it can be enabled using:
  9743. @code{./configure --enable-libvmaf --enable-version3}.
  9744. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9745. The filter has following options:
  9746. @table @option
  9747. @item model_path
  9748. Set the model path which is to be used for SVM.
  9749. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  9750. @item log_path
  9751. Set the file path to be used to store logs.
  9752. @item log_fmt
  9753. Set the format of the log file (xml or json).
  9754. @item enable_transform
  9755. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9756. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9757. Default value: @code{false}
  9758. @item phone_model
  9759. Invokes the phone model which will generate VMAF scores higher than in the
  9760. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9761. Default value: @code{false}
  9762. @item psnr
  9763. Enables computing psnr along with vmaf.
  9764. Default value: @code{false}
  9765. @item ssim
  9766. Enables computing ssim along with vmaf.
  9767. Default value: @code{false}
  9768. @item ms_ssim
  9769. Enables computing ms_ssim along with vmaf.
  9770. Default value: @code{false}
  9771. @item pool
  9772. Set the pool method to be used for computing vmaf.
  9773. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  9774. @item n_threads
  9775. Set number of threads to be used when computing vmaf.
  9776. Default value: @code{0}, which makes use of all available logical processors.
  9777. @item n_subsample
  9778. Set interval for frame subsampling used when computing vmaf.
  9779. Default value: @code{1}
  9780. @item enable_conf_interval
  9781. Enables confidence interval.
  9782. Default value: @code{false}
  9783. @end table
  9784. This filter also supports the @ref{framesync} options.
  9785. @subsection Examples
  9786. @itemize
  9787. @item
  9788. On the below examples the input file @file{main.mpg} being processed is
  9789. compared with the reference file @file{ref.mpg}.
  9790. @example
  9791. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9792. @end example
  9793. @item
  9794. Example with options:
  9795. @example
  9796. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9797. @end example
  9798. @item
  9799. Example with options and different containers:
  9800. @example
  9801. 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 -
  9802. @end example
  9803. @end itemize
  9804. @section limiter
  9805. Limits the pixel components values to the specified range [min, max].
  9806. The filter accepts the following options:
  9807. @table @option
  9808. @item min
  9809. Lower bound. Defaults to the lowest allowed value for the input.
  9810. @item max
  9811. Upper bound. Defaults to the highest allowed value for the input.
  9812. @item planes
  9813. Specify which planes will be processed. Defaults to all available.
  9814. @end table
  9815. @section loop
  9816. Loop video frames.
  9817. The filter accepts the following options:
  9818. @table @option
  9819. @item loop
  9820. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9821. Default is 0.
  9822. @item size
  9823. Set maximal size in number of frames. Default is 0.
  9824. @item start
  9825. Set first frame of loop. Default is 0.
  9826. @end table
  9827. @subsection Examples
  9828. @itemize
  9829. @item
  9830. Loop single first frame infinitely:
  9831. @example
  9832. loop=loop=-1:size=1:start=0
  9833. @end example
  9834. @item
  9835. Loop single first frame 10 times:
  9836. @example
  9837. loop=loop=10:size=1:start=0
  9838. @end example
  9839. @item
  9840. Loop 10 first frames 5 times:
  9841. @example
  9842. loop=loop=5:size=10:start=0
  9843. @end example
  9844. @end itemize
  9845. @section lut1d
  9846. Apply a 1D LUT to an input video.
  9847. The filter accepts the following options:
  9848. @table @option
  9849. @item file
  9850. Set the 1D LUT file name.
  9851. Currently supported formats:
  9852. @table @samp
  9853. @item cube
  9854. Iridas
  9855. @item csp
  9856. cineSpace
  9857. @end table
  9858. @item interp
  9859. Select interpolation mode.
  9860. Available values are:
  9861. @table @samp
  9862. @item nearest
  9863. Use values from the nearest defined point.
  9864. @item linear
  9865. Interpolate values using the linear interpolation.
  9866. @item cosine
  9867. Interpolate values using the cosine interpolation.
  9868. @item cubic
  9869. Interpolate values using the cubic interpolation.
  9870. @item spline
  9871. Interpolate values using the spline interpolation.
  9872. @end table
  9873. @end table
  9874. @anchor{lut3d}
  9875. @section lut3d
  9876. Apply a 3D LUT to an input video.
  9877. The filter accepts the following options:
  9878. @table @option
  9879. @item file
  9880. Set the 3D LUT file name.
  9881. Currently supported formats:
  9882. @table @samp
  9883. @item 3dl
  9884. AfterEffects
  9885. @item cube
  9886. Iridas
  9887. @item dat
  9888. DaVinci
  9889. @item m3d
  9890. Pandora
  9891. @item csp
  9892. cineSpace
  9893. @end table
  9894. @item interp
  9895. Select interpolation mode.
  9896. Available values are:
  9897. @table @samp
  9898. @item nearest
  9899. Use values from the nearest defined point.
  9900. @item trilinear
  9901. Interpolate values using the 8 points defining a cube.
  9902. @item tetrahedral
  9903. Interpolate values using a tetrahedron.
  9904. @end table
  9905. @end table
  9906. @section lumakey
  9907. Turn certain luma values into transparency.
  9908. The filter accepts the following options:
  9909. @table @option
  9910. @item threshold
  9911. Set the luma which will be used as base for transparency.
  9912. Default value is @code{0}.
  9913. @item tolerance
  9914. Set the range of luma values to be keyed out.
  9915. Default value is @code{0.01}.
  9916. @item softness
  9917. Set the range of softness. Default value is @code{0}.
  9918. Use this to control gradual transition from zero to full transparency.
  9919. @end table
  9920. @subsection Commands
  9921. This filter supports same @ref{commands} as options.
  9922. The command accepts the same syntax of the corresponding option.
  9923. If the specified expression is not valid, it is kept at its current
  9924. value.
  9925. @section lut, lutrgb, lutyuv
  9926. Compute a look-up table for binding each pixel component input value
  9927. to an output value, and apply it to the input video.
  9928. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9929. to an RGB input video.
  9930. These filters accept the following parameters:
  9931. @table @option
  9932. @item c0
  9933. set first pixel component expression
  9934. @item c1
  9935. set second pixel component expression
  9936. @item c2
  9937. set third pixel component expression
  9938. @item c3
  9939. set fourth pixel component expression, corresponds to the alpha component
  9940. @item r
  9941. set red component expression
  9942. @item g
  9943. set green component expression
  9944. @item b
  9945. set blue component expression
  9946. @item a
  9947. alpha component expression
  9948. @item y
  9949. set Y/luminance component expression
  9950. @item u
  9951. set U/Cb component expression
  9952. @item v
  9953. set V/Cr component expression
  9954. @end table
  9955. Each of them specifies the expression to use for computing the lookup table for
  9956. the corresponding pixel component values.
  9957. The exact component associated to each of the @var{c*} options depends on the
  9958. format in input.
  9959. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9960. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9961. The expressions can contain the following constants and functions:
  9962. @table @option
  9963. @item w
  9964. @item h
  9965. The input width and height.
  9966. @item val
  9967. The input value for the pixel component.
  9968. @item clipval
  9969. The input value, clipped to the @var{minval}-@var{maxval} range.
  9970. @item maxval
  9971. The maximum value for the pixel component.
  9972. @item minval
  9973. The minimum value for the pixel component.
  9974. @item negval
  9975. The negated value for the pixel component value, clipped to the
  9976. @var{minval}-@var{maxval} range; it corresponds to the expression
  9977. "maxval-clipval+minval".
  9978. @item clip(val)
  9979. The computed value in @var{val}, clipped to the
  9980. @var{minval}-@var{maxval} range.
  9981. @item gammaval(gamma)
  9982. The computed gamma correction value of the pixel component value,
  9983. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9984. expression
  9985. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9986. @end table
  9987. All expressions default to "val".
  9988. @subsection Examples
  9989. @itemize
  9990. @item
  9991. Negate input video:
  9992. @example
  9993. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9994. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9995. @end example
  9996. The above is the same as:
  9997. @example
  9998. lutrgb="r=negval:g=negval:b=negval"
  9999. lutyuv="y=negval:u=negval:v=negval"
  10000. @end example
  10001. @item
  10002. Negate luminance:
  10003. @example
  10004. lutyuv=y=negval
  10005. @end example
  10006. @item
  10007. Remove chroma components, turning the video into a graytone image:
  10008. @example
  10009. lutyuv="u=128:v=128"
  10010. @end example
  10011. @item
  10012. Apply a luma burning effect:
  10013. @example
  10014. lutyuv="y=2*val"
  10015. @end example
  10016. @item
  10017. Remove green and blue components:
  10018. @example
  10019. lutrgb="g=0:b=0"
  10020. @end example
  10021. @item
  10022. Set a constant alpha channel value on input:
  10023. @example
  10024. format=rgba,lutrgb=a="maxval-minval/2"
  10025. @end example
  10026. @item
  10027. Correct luminance gamma by a factor of 0.5:
  10028. @example
  10029. lutyuv=y=gammaval(0.5)
  10030. @end example
  10031. @item
  10032. Discard least significant bits of luma:
  10033. @example
  10034. lutyuv=y='bitand(val, 128+64+32)'
  10035. @end example
  10036. @item
  10037. Technicolor like effect:
  10038. @example
  10039. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  10040. @end example
  10041. @end itemize
  10042. @section lut2, tlut2
  10043. The @code{lut2} filter takes two input streams and outputs one
  10044. stream.
  10045. The @code{tlut2} (time lut2) filter takes two consecutive frames
  10046. from one single stream.
  10047. This filter accepts the following parameters:
  10048. @table @option
  10049. @item c0
  10050. set first pixel component expression
  10051. @item c1
  10052. set second pixel component expression
  10053. @item c2
  10054. set third pixel component expression
  10055. @item c3
  10056. set fourth pixel component expression, corresponds to the alpha component
  10057. @item d
  10058. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10059. which means bit depth is automatically picked from first input format.
  10060. @end table
  10061. The @code{lut2} filter also supports the @ref{framesync} options.
  10062. Each of them specifies the expression to use for computing the lookup table for
  10063. the corresponding pixel component values.
  10064. The exact component associated to each of the @var{c*} options depends on the
  10065. format in inputs.
  10066. The expressions can contain the following constants:
  10067. @table @option
  10068. @item w
  10069. @item h
  10070. The input width and height.
  10071. @item x
  10072. The first input value for the pixel component.
  10073. @item y
  10074. The second input value for the pixel component.
  10075. @item bdx
  10076. The first input video bit depth.
  10077. @item bdy
  10078. The second input video bit depth.
  10079. @end table
  10080. All expressions default to "x".
  10081. @subsection Examples
  10082. @itemize
  10083. @item
  10084. Highlight differences between two RGB video streams:
  10085. @example
  10086. 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)'
  10087. @end example
  10088. @item
  10089. Highlight differences between two YUV video streams:
  10090. @example
  10091. 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)'
  10092. @end example
  10093. @item
  10094. Show max difference between two video streams:
  10095. @example
  10096. 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)))'
  10097. @end example
  10098. @end itemize
  10099. @section maskedclamp
  10100. Clamp the first input stream with the second input and third input stream.
  10101. Returns the value of first stream to be between second input
  10102. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10103. This filter accepts the following options:
  10104. @table @option
  10105. @item undershoot
  10106. Default value is @code{0}.
  10107. @item overshoot
  10108. Default value is @code{0}.
  10109. @item planes
  10110. Set which planes will be processed as bitmap, unprocessed planes will be
  10111. copied from first stream.
  10112. By default value 0xf, all planes will be processed.
  10113. @end table
  10114. @section maskedmax
  10115. Merge the second and third input stream into output stream using absolute differences
  10116. between second input stream and first input stream and absolute difference between
  10117. third input stream and first input stream. The picked value will be from second input
  10118. stream if second absolute difference is greater than first one or from third input stream
  10119. otherwise.
  10120. This filter accepts the following options:
  10121. @table @option
  10122. @item planes
  10123. Set which planes will be processed as bitmap, unprocessed planes will be
  10124. copied from first stream.
  10125. By default value 0xf, all planes will be processed.
  10126. @end table
  10127. @section maskedmerge
  10128. Merge the first input stream with the second input stream using per pixel
  10129. weights in the third input stream.
  10130. A value of 0 in the third stream pixel component means that pixel component
  10131. from first stream is returned unchanged, while maximum value (eg. 255 for
  10132. 8-bit videos) means that pixel component from second stream is returned
  10133. unchanged. Intermediate values define the amount of merging between both
  10134. input stream's pixel components.
  10135. This filter accepts the following options:
  10136. @table @option
  10137. @item planes
  10138. Set which planes will be processed as bitmap, unprocessed planes will be
  10139. copied from first stream.
  10140. By default value 0xf, all planes will be processed.
  10141. @end table
  10142. @section maskedmin
  10143. Merge the second and third input stream into output stream using absolute differences
  10144. between second input stream and first input stream and absolute difference between
  10145. third input stream and first input stream. The picked value will be from second input
  10146. stream if second absolute difference is less than first one or from third input stream
  10147. otherwise.
  10148. This filter accepts the following options:
  10149. @table @option
  10150. @item planes
  10151. Set which planes will be processed as bitmap, unprocessed planes will be
  10152. copied from first stream.
  10153. By default value 0xf, all planes will be processed.
  10154. @end table
  10155. @section maskedthreshold
  10156. Pick pixels comparing absolute difference of two video streams with fixed
  10157. threshold.
  10158. If absolute difference between pixel component of first and second video
  10159. stream is equal or lower than user supplied threshold than pixel component
  10160. from first video stream is picked, otherwise pixel component from second
  10161. video stream is picked.
  10162. This filter accepts the following options:
  10163. @table @option
  10164. @item threshold
  10165. Set threshold used when picking pixels from absolute difference from two input
  10166. video streams.
  10167. @item planes
  10168. Set which planes will be processed as bitmap, unprocessed planes will be
  10169. copied from second stream.
  10170. By default value 0xf, all planes will be processed.
  10171. @end table
  10172. @section maskfun
  10173. Create mask from input video.
  10174. For example it is useful to create motion masks after @code{tblend} filter.
  10175. This filter accepts the following options:
  10176. @table @option
  10177. @item low
  10178. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10179. @item high
  10180. Set high threshold. Any pixel component higher than this value will be set to max value
  10181. allowed for current pixel format.
  10182. @item planes
  10183. Set planes to filter, by default all available planes are filtered.
  10184. @item fill
  10185. Fill all frame pixels with this value.
  10186. @item sum
  10187. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10188. average, output frame will be completely filled with value set by @var{fill} option.
  10189. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10190. @end table
  10191. @section mcdeint
  10192. Apply motion-compensation deinterlacing.
  10193. It needs one field per frame as input and must thus be used together
  10194. with yadif=1/3 or equivalent.
  10195. This filter accepts the following options:
  10196. @table @option
  10197. @item mode
  10198. Set the deinterlacing mode.
  10199. It accepts one of the following values:
  10200. @table @samp
  10201. @item fast
  10202. @item medium
  10203. @item slow
  10204. use iterative motion estimation
  10205. @item extra_slow
  10206. like @samp{slow}, but use multiple reference frames.
  10207. @end table
  10208. Default value is @samp{fast}.
  10209. @item parity
  10210. Set the picture field parity assumed for the input video. It must be
  10211. one of the following values:
  10212. @table @samp
  10213. @item 0, tff
  10214. assume top field first
  10215. @item 1, bff
  10216. assume bottom field first
  10217. @end table
  10218. Default value is @samp{bff}.
  10219. @item qp
  10220. Set per-block quantization parameter (QP) used by the internal
  10221. encoder.
  10222. Higher values should result in a smoother motion vector field but less
  10223. optimal individual vectors. Default value is 1.
  10224. @end table
  10225. @section median
  10226. Pick median pixel from certain rectangle defined by radius.
  10227. This filter accepts the following options:
  10228. @table @option
  10229. @item radius
  10230. Set horizontal radius size. Default value is @code{1}.
  10231. Allowed range is integer from 1 to 127.
  10232. @item planes
  10233. Set which planes to process. Default is @code{15}, which is all available planes.
  10234. @item radiusV
  10235. Set vertical radius size. Default value is @code{0}.
  10236. Allowed range is integer from 0 to 127.
  10237. If it is 0, value will be picked from horizontal @code{radius} option.
  10238. @item percentile
  10239. Set median percentile. Default value is @code{0.5}.
  10240. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  10241. minimum values, and @code{1} maximum values.
  10242. @end table
  10243. @subsection Commands
  10244. This filter supports same @ref{commands} as options.
  10245. The command accepts the same syntax of the corresponding option.
  10246. If the specified expression is not valid, it is kept at its current
  10247. value.
  10248. @section mergeplanes
  10249. Merge color channel components from several video streams.
  10250. The filter accepts up to 4 input streams, and merge selected input
  10251. planes to the output video.
  10252. This filter accepts the following options:
  10253. @table @option
  10254. @item mapping
  10255. Set input to output plane mapping. Default is @code{0}.
  10256. The mappings is specified as a bitmap. It should be specified as a
  10257. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10258. mapping for the first plane of the output stream. 'A' sets the number of
  10259. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10260. corresponding input to use (from 0 to 3). The rest of the mappings is
  10261. similar, 'Bb' describes the mapping for the output stream second
  10262. plane, 'Cc' describes the mapping for the output stream third plane and
  10263. 'Dd' describes the mapping for the output stream fourth plane.
  10264. @item format
  10265. Set output pixel format. Default is @code{yuva444p}.
  10266. @end table
  10267. @subsection Examples
  10268. @itemize
  10269. @item
  10270. Merge three gray video streams of same width and height into single video stream:
  10271. @example
  10272. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10273. @end example
  10274. @item
  10275. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10276. @example
  10277. [a0][a1]mergeplanes=0x00010210:yuva444p
  10278. @end example
  10279. @item
  10280. Swap Y and A plane in yuva444p stream:
  10281. @example
  10282. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10283. @end example
  10284. @item
  10285. Swap U and V plane in yuv420p stream:
  10286. @example
  10287. format=yuv420p,mergeplanes=0x000201:yuv420p
  10288. @end example
  10289. @item
  10290. Cast a rgb24 clip to yuv444p:
  10291. @example
  10292. format=rgb24,mergeplanes=0x000102:yuv444p
  10293. @end example
  10294. @end itemize
  10295. @section mestimate
  10296. Estimate and export motion vectors using block matching algorithms.
  10297. Motion vectors are stored in frame side data to be used by other filters.
  10298. This filter accepts the following options:
  10299. @table @option
  10300. @item method
  10301. Specify the motion estimation method. Accepts one of the following values:
  10302. @table @samp
  10303. @item esa
  10304. Exhaustive search algorithm.
  10305. @item tss
  10306. Three step search algorithm.
  10307. @item tdls
  10308. Two dimensional logarithmic search algorithm.
  10309. @item ntss
  10310. New three step search algorithm.
  10311. @item fss
  10312. Four step search algorithm.
  10313. @item ds
  10314. Diamond search algorithm.
  10315. @item hexbs
  10316. Hexagon-based search algorithm.
  10317. @item epzs
  10318. Enhanced predictive zonal search algorithm.
  10319. @item umh
  10320. Uneven multi-hexagon search algorithm.
  10321. @end table
  10322. Default value is @samp{esa}.
  10323. @item mb_size
  10324. Macroblock size. Default @code{16}.
  10325. @item search_param
  10326. Search parameter. Default @code{7}.
  10327. @end table
  10328. @section midequalizer
  10329. Apply Midway Image Equalization effect using two video streams.
  10330. Midway Image Equalization adjusts a pair of images to have the same
  10331. histogram, while maintaining their dynamics as much as possible. It's
  10332. useful for e.g. matching exposures from a pair of stereo cameras.
  10333. This filter has two inputs and one output, which must be of same pixel format, but
  10334. may be of different sizes. The output of filter is first input adjusted with
  10335. midway histogram of both inputs.
  10336. This filter accepts the following option:
  10337. @table @option
  10338. @item planes
  10339. Set which planes to process. Default is @code{15}, which is all available planes.
  10340. @end table
  10341. @section minterpolate
  10342. Convert the video to specified frame rate using motion interpolation.
  10343. This filter accepts the following options:
  10344. @table @option
  10345. @item fps
  10346. 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}.
  10347. @item mi_mode
  10348. Motion interpolation mode. Following values are accepted:
  10349. @table @samp
  10350. @item dup
  10351. Duplicate previous or next frame for interpolating new ones.
  10352. @item blend
  10353. Blend source frames. Interpolated frame is mean of previous and next frames.
  10354. @item mci
  10355. Motion compensated interpolation. Following options are effective when this mode is selected:
  10356. @table @samp
  10357. @item mc_mode
  10358. Motion compensation mode. Following values are accepted:
  10359. @table @samp
  10360. @item obmc
  10361. Overlapped block motion compensation.
  10362. @item aobmc
  10363. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10364. @end table
  10365. Default mode is @samp{obmc}.
  10366. @item me_mode
  10367. Motion estimation mode. Following values are accepted:
  10368. @table @samp
  10369. @item bidir
  10370. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10371. @item bilat
  10372. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10373. @end table
  10374. Default mode is @samp{bilat}.
  10375. @item me
  10376. The algorithm to be used for motion estimation. Following values are accepted:
  10377. @table @samp
  10378. @item esa
  10379. Exhaustive search algorithm.
  10380. @item tss
  10381. Three step search algorithm.
  10382. @item tdls
  10383. Two dimensional logarithmic search algorithm.
  10384. @item ntss
  10385. New three step search algorithm.
  10386. @item fss
  10387. Four step search algorithm.
  10388. @item ds
  10389. Diamond search algorithm.
  10390. @item hexbs
  10391. Hexagon-based search algorithm.
  10392. @item epzs
  10393. Enhanced predictive zonal search algorithm.
  10394. @item umh
  10395. Uneven multi-hexagon search algorithm.
  10396. @end table
  10397. Default algorithm is @samp{epzs}.
  10398. @item mb_size
  10399. Macroblock size. Default @code{16}.
  10400. @item search_param
  10401. Motion estimation search parameter. Default @code{32}.
  10402. @item vsbmc
  10403. 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).
  10404. @end table
  10405. @end table
  10406. @item scd
  10407. 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:
  10408. @table @samp
  10409. @item none
  10410. Disable scene change detection.
  10411. @item fdiff
  10412. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10413. @end table
  10414. Default method is @samp{fdiff}.
  10415. @item scd_threshold
  10416. Scene change detection threshold. Default is @code{5.0}.
  10417. @end table
  10418. @section mix
  10419. Mix several video input streams into one video stream.
  10420. A description of the accepted options follows.
  10421. @table @option
  10422. @item nb_inputs
  10423. The number of inputs. If unspecified, it defaults to 2.
  10424. @item weights
  10425. Specify weight of each input video stream as sequence.
  10426. Each weight is separated by space. If number of weights
  10427. is smaller than number of @var{frames} last specified
  10428. weight will be used for all remaining unset weights.
  10429. @item scale
  10430. Specify scale, if it is set it will be multiplied with sum
  10431. of each weight multiplied with pixel values to give final destination
  10432. pixel value. By default @var{scale} is auto scaled to sum of weights.
  10433. @item duration
  10434. Specify how end of stream is determined.
  10435. @table @samp
  10436. @item longest
  10437. The duration of the longest input. (default)
  10438. @item shortest
  10439. The duration of the shortest input.
  10440. @item first
  10441. The duration of the first input.
  10442. @end table
  10443. @end table
  10444. @section mpdecimate
  10445. Drop frames that do not differ greatly from the previous frame in
  10446. order to reduce frame rate.
  10447. The main use of this filter is for very-low-bitrate encoding
  10448. (e.g. streaming over dialup modem), but it could in theory be used for
  10449. fixing movies that were inverse-telecined incorrectly.
  10450. A description of the accepted options follows.
  10451. @table @option
  10452. @item max
  10453. Set the maximum number of consecutive frames which can be dropped (if
  10454. positive), or the minimum interval between dropped frames (if
  10455. negative). If the value is 0, the frame is dropped disregarding the
  10456. number of previous sequentially dropped frames.
  10457. Default value is 0.
  10458. @item hi
  10459. @item lo
  10460. @item frac
  10461. Set the dropping threshold values.
  10462. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10463. represent actual pixel value differences, so a threshold of 64
  10464. corresponds to 1 unit of difference for each pixel, or the same spread
  10465. out differently over the block.
  10466. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10467. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10468. meaning the whole image) differ by more than a threshold of @option{lo}.
  10469. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10470. 64*5, and default value for @option{frac} is 0.33.
  10471. @end table
  10472. @section negate
  10473. Negate (invert) the input video.
  10474. It accepts the following option:
  10475. @table @option
  10476. @item negate_alpha
  10477. With value 1, it negates the alpha component, if present. Default value is 0.
  10478. @end table
  10479. @anchor{nlmeans}
  10480. @section nlmeans
  10481. Denoise frames using Non-Local Means algorithm.
  10482. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10483. context similarity is defined by comparing their surrounding patches of size
  10484. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10485. around the pixel.
  10486. Note that the research area defines centers for patches, which means some
  10487. patches will be made of pixels outside that research area.
  10488. The filter accepts the following options.
  10489. @table @option
  10490. @item s
  10491. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10492. @item p
  10493. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10494. @item pc
  10495. Same as @option{p} but for chroma planes.
  10496. The default value is @var{0} and means automatic.
  10497. @item r
  10498. Set research size. Default is 15. Must be odd number in range [0, 99].
  10499. @item rc
  10500. Same as @option{r} but for chroma planes.
  10501. The default value is @var{0} and means automatic.
  10502. @end table
  10503. @section nnedi
  10504. Deinterlace video using neural network edge directed interpolation.
  10505. This filter accepts the following options:
  10506. @table @option
  10507. @item weights
  10508. Mandatory option, without binary file filter can not work.
  10509. Currently file can be found here:
  10510. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10511. @item deint
  10512. Set which frames to deinterlace, by default it is @code{all}.
  10513. Can be @code{all} or @code{interlaced}.
  10514. @item field
  10515. Set mode of operation.
  10516. Can be one of the following:
  10517. @table @samp
  10518. @item af
  10519. Use frame flags, both fields.
  10520. @item a
  10521. Use frame flags, single field.
  10522. @item t
  10523. Use top field only.
  10524. @item b
  10525. Use bottom field only.
  10526. @item tf
  10527. Use both fields, top first.
  10528. @item bf
  10529. Use both fields, bottom first.
  10530. @end table
  10531. @item planes
  10532. Set which planes to process, by default filter process all frames.
  10533. @item nsize
  10534. Set size of local neighborhood around each pixel, used by the predictor neural
  10535. network.
  10536. Can be one of the following:
  10537. @table @samp
  10538. @item s8x6
  10539. @item s16x6
  10540. @item s32x6
  10541. @item s48x6
  10542. @item s8x4
  10543. @item s16x4
  10544. @item s32x4
  10545. @end table
  10546. @item nns
  10547. Set the number of neurons in predictor neural network.
  10548. Can be one of the following:
  10549. @table @samp
  10550. @item n16
  10551. @item n32
  10552. @item n64
  10553. @item n128
  10554. @item n256
  10555. @end table
  10556. @item qual
  10557. Controls the number of different neural network predictions that are blended
  10558. together to compute the final output value. Can be @code{fast}, default or
  10559. @code{slow}.
  10560. @item etype
  10561. Set which set of weights to use in the predictor.
  10562. Can be one of the following:
  10563. @table @samp
  10564. @item a
  10565. weights trained to minimize absolute error
  10566. @item s
  10567. weights trained to minimize squared error
  10568. @end table
  10569. @item pscrn
  10570. Controls whether or not the prescreener neural network is used to decide
  10571. which pixels should be processed by the predictor neural network and which
  10572. can be handled by simple cubic interpolation.
  10573. The prescreener is trained to know whether cubic interpolation will be
  10574. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10575. The computational complexity of the prescreener nn is much less than that of
  10576. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10577. using the prescreener generally results in much faster processing.
  10578. The prescreener is pretty accurate, so the difference between using it and not
  10579. using it is almost always unnoticeable.
  10580. Can be one of the following:
  10581. @table @samp
  10582. @item none
  10583. @item original
  10584. @item new
  10585. @end table
  10586. Default is @code{new}.
  10587. @item fapprox
  10588. Set various debugging flags.
  10589. @end table
  10590. @section noformat
  10591. Force libavfilter not to use any of the specified pixel formats for the
  10592. input to the next filter.
  10593. It accepts the following parameters:
  10594. @table @option
  10595. @item pix_fmts
  10596. A '|'-separated list of pixel format names, such as
  10597. pix_fmts=yuv420p|monow|rgb24".
  10598. @end table
  10599. @subsection Examples
  10600. @itemize
  10601. @item
  10602. Force libavfilter to use a format different from @var{yuv420p} for the
  10603. input to the vflip filter:
  10604. @example
  10605. noformat=pix_fmts=yuv420p,vflip
  10606. @end example
  10607. @item
  10608. Convert the input video to any of the formats not contained in the list:
  10609. @example
  10610. noformat=yuv420p|yuv444p|yuv410p
  10611. @end example
  10612. @end itemize
  10613. @section noise
  10614. Add noise on video input frame.
  10615. The filter accepts the following options:
  10616. @table @option
  10617. @item all_seed
  10618. @item c0_seed
  10619. @item c1_seed
  10620. @item c2_seed
  10621. @item c3_seed
  10622. Set noise seed for specific pixel component or all pixel components in case
  10623. of @var{all_seed}. Default value is @code{123457}.
  10624. @item all_strength, alls
  10625. @item c0_strength, c0s
  10626. @item c1_strength, c1s
  10627. @item c2_strength, c2s
  10628. @item c3_strength, c3s
  10629. Set noise strength for specific pixel component or all pixel components in case
  10630. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10631. @item all_flags, allf
  10632. @item c0_flags, c0f
  10633. @item c1_flags, c1f
  10634. @item c2_flags, c2f
  10635. @item c3_flags, c3f
  10636. Set pixel component flags or set flags for all components if @var{all_flags}.
  10637. Available values for component flags are:
  10638. @table @samp
  10639. @item a
  10640. averaged temporal noise (smoother)
  10641. @item p
  10642. mix random noise with a (semi)regular pattern
  10643. @item t
  10644. temporal noise (noise pattern changes between frames)
  10645. @item u
  10646. uniform noise (gaussian otherwise)
  10647. @end table
  10648. @end table
  10649. @subsection Examples
  10650. Add temporal and uniform noise to input video:
  10651. @example
  10652. noise=alls=20:allf=t+u
  10653. @end example
  10654. @section normalize
  10655. Normalize RGB video (aka histogram stretching, contrast stretching).
  10656. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10657. For each channel of each frame, the filter computes the input range and maps
  10658. it linearly to the user-specified output range. The output range defaults
  10659. to the full dynamic range from pure black to pure white.
  10660. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10661. changes in brightness) caused when small dark or bright objects enter or leave
  10662. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10663. video camera, and, like a video camera, it may cause a period of over- or
  10664. under-exposure of the video.
  10665. The R,G,B channels can be normalized independently, which may cause some
  10666. color shifting, or linked together as a single channel, which prevents
  10667. color shifting. Linked normalization preserves hue. Independent normalization
  10668. does not, so it can be used to remove some color casts. Independent and linked
  10669. normalization can be combined in any ratio.
  10670. The normalize filter accepts the following options:
  10671. @table @option
  10672. @item blackpt
  10673. @item whitept
  10674. Colors which define the output range. The minimum input value is mapped to
  10675. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10676. The defaults are black and white respectively. Specifying white for
  10677. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10678. normalized video. Shades of grey can be used to reduce the dynamic range
  10679. (contrast). Specifying saturated colors here can create some interesting
  10680. effects.
  10681. @item smoothing
  10682. The number of previous frames to use for temporal smoothing. The input range
  10683. of each channel is smoothed using a rolling average over the current frame
  10684. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10685. smoothing).
  10686. @item independence
  10687. Controls the ratio of independent (color shifting) channel normalization to
  10688. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10689. independent. Defaults to 1.0 (fully independent).
  10690. @item strength
  10691. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10692. expensive no-op. Defaults to 1.0 (full strength).
  10693. @end table
  10694. @subsection Commands
  10695. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  10696. The command accepts the same syntax of the corresponding option.
  10697. If the specified expression is not valid, it is kept at its current
  10698. value.
  10699. @subsection Examples
  10700. Stretch video contrast to use the full dynamic range, with no temporal
  10701. smoothing; may flicker depending on the source content:
  10702. @example
  10703. normalize=blackpt=black:whitept=white:smoothing=0
  10704. @end example
  10705. As above, but with 50 frames of temporal smoothing; flicker should be
  10706. reduced, depending on the source content:
  10707. @example
  10708. normalize=blackpt=black:whitept=white:smoothing=50
  10709. @end example
  10710. As above, but with hue-preserving linked channel normalization:
  10711. @example
  10712. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10713. @end example
  10714. As above, but with half strength:
  10715. @example
  10716. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10717. @end example
  10718. Map the darkest input color to red, the brightest input color to cyan:
  10719. @example
  10720. normalize=blackpt=red:whitept=cyan
  10721. @end example
  10722. @section null
  10723. Pass the video source unchanged to the output.
  10724. @section ocr
  10725. Optical Character Recognition
  10726. This filter uses Tesseract for optical character recognition. To enable
  10727. compilation of this filter, you need to configure FFmpeg with
  10728. @code{--enable-libtesseract}.
  10729. It accepts the following options:
  10730. @table @option
  10731. @item datapath
  10732. Set datapath to tesseract data. Default is to use whatever was
  10733. set at installation.
  10734. @item language
  10735. Set language, default is "eng".
  10736. @item whitelist
  10737. Set character whitelist.
  10738. @item blacklist
  10739. Set character blacklist.
  10740. @end table
  10741. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10742. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10743. @section ocv
  10744. Apply a video transform using libopencv.
  10745. To enable this filter, install the libopencv library and headers and
  10746. configure FFmpeg with @code{--enable-libopencv}.
  10747. It accepts the following parameters:
  10748. @table @option
  10749. @item filter_name
  10750. The name of the libopencv filter to apply.
  10751. @item filter_params
  10752. The parameters to pass to the libopencv filter. If not specified, the default
  10753. values are assumed.
  10754. @end table
  10755. Refer to the official libopencv documentation for more precise
  10756. information:
  10757. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10758. Several libopencv filters are supported; see the following subsections.
  10759. @anchor{dilate}
  10760. @subsection dilate
  10761. Dilate an image by using a specific structuring element.
  10762. It corresponds to the libopencv function @code{cvDilate}.
  10763. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10764. @var{struct_el} represents a structuring element, and has the syntax:
  10765. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10766. @var{cols} and @var{rows} represent the number of columns and rows of
  10767. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10768. point, and @var{shape} the shape for the structuring element. @var{shape}
  10769. must be "rect", "cross", "ellipse", or "custom".
  10770. If the value for @var{shape} is "custom", it must be followed by a
  10771. string of the form "=@var{filename}". The file with name
  10772. @var{filename} is assumed to represent a binary image, with each
  10773. printable character corresponding to a bright pixel. When a custom
  10774. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10775. or columns and rows of the read file are assumed instead.
  10776. The default value for @var{struct_el} is "3x3+0x0/rect".
  10777. @var{nb_iterations} specifies the number of times the transform is
  10778. applied to the image, and defaults to 1.
  10779. Some examples:
  10780. @example
  10781. # Use the default values
  10782. ocv=dilate
  10783. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10784. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10785. # Read the shape from the file diamond.shape, iterating two times.
  10786. # The file diamond.shape may contain a pattern of characters like this
  10787. # *
  10788. # ***
  10789. # *****
  10790. # ***
  10791. # *
  10792. # The specified columns and rows are ignored
  10793. # but the anchor point coordinates are not
  10794. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10795. @end example
  10796. @subsection erode
  10797. Erode an image by using a specific structuring element.
  10798. It corresponds to the libopencv function @code{cvErode}.
  10799. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10800. with the same syntax and semantics as the @ref{dilate} filter.
  10801. @subsection smooth
  10802. Smooth the input video.
  10803. The filter takes the following parameters:
  10804. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10805. @var{type} is the type of smooth filter to apply, and must be one of
  10806. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10807. or "bilateral". The default value is "gaussian".
  10808. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10809. depends on the smooth type. @var{param1} and
  10810. @var{param2} accept integer positive values or 0. @var{param3} and
  10811. @var{param4} accept floating point values.
  10812. The default value for @var{param1} is 3. The default value for the
  10813. other parameters is 0.
  10814. These parameters correspond to the parameters assigned to the
  10815. libopencv function @code{cvSmooth}.
  10816. @section oscilloscope
  10817. 2D Video Oscilloscope.
  10818. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10819. It accepts the following parameters:
  10820. @table @option
  10821. @item x
  10822. Set scope center x position.
  10823. @item y
  10824. Set scope center y position.
  10825. @item s
  10826. Set scope size, relative to frame diagonal.
  10827. @item t
  10828. Set scope tilt/rotation.
  10829. @item o
  10830. Set trace opacity.
  10831. @item tx
  10832. Set trace center x position.
  10833. @item ty
  10834. Set trace center y position.
  10835. @item tw
  10836. Set trace width, relative to width of frame.
  10837. @item th
  10838. Set trace height, relative to height of frame.
  10839. @item c
  10840. Set which components to trace. By default it traces first three components.
  10841. @item g
  10842. Draw trace grid. By default is enabled.
  10843. @item st
  10844. Draw some statistics. By default is enabled.
  10845. @item sc
  10846. Draw scope. By default is enabled.
  10847. @end table
  10848. @subsection Commands
  10849. This filter supports same @ref{commands} as options.
  10850. The command accepts the same syntax of the corresponding option.
  10851. If the specified expression is not valid, it is kept at its current
  10852. value.
  10853. @subsection Examples
  10854. @itemize
  10855. @item
  10856. Inspect full first row of video frame.
  10857. @example
  10858. oscilloscope=x=0.5:y=0:s=1
  10859. @end example
  10860. @item
  10861. Inspect full last row of video frame.
  10862. @example
  10863. oscilloscope=x=0.5:y=1:s=1
  10864. @end example
  10865. @item
  10866. Inspect full 5th line of video frame of height 1080.
  10867. @example
  10868. oscilloscope=x=0.5:y=5/1080:s=1
  10869. @end example
  10870. @item
  10871. Inspect full last column of video frame.
  10872. @example
  10873. oscilloscope=x=1:y=0.5:s=1:t=1
  10874. @end example
  10875. @end itemize
  10876. @anchor{overlay}
  10877. @section overlay
  10878. Overlay one video on top of another.
  10879. It takes two inputs and has one output. The first input is the "main"
  10880. video on which the second input is overlaid.
  10881. It accepts the following parameters:
  10882. A description of the accepted options follows.
  10883. @table @option
  10884. @item x
  10885. @item y
  10886. Set the expression for the x and y coordinates of the overlaid video
  10887. on the main video. Default value is "0" for both expressions. In case
  10888. the expression is invalid, it is set to a huge value (meaning that the
  10889. overlay will not be displayed within the output visible area).
  10890. @item eof_action
  10891. See @ref{framesync}.
  10892. @item eval
  10893. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10894. It accepts the following values:
  10895. @table @samp
  10896. @item init
  10897. only evaluate expressions once during the filter initialization or
  10898. when a command is processed
  10899. @item frame
  10900. evaluate expressions for each incoming frame
  10901. @end table
  10902. Default value is @samp{frame}.
  10903. @item shortest
  10904. See @ref{framesync}.
  10905. @item format
  10906. Set the format for the output video.
  10907. It accepts the following values:
  10908. @table @samp
  10909. @item yuv420
  10910. force YUV420 output
  10911. @item yuv422
  10912. force YUV422 output
  10913. @item yuv444
  10914. force YUV444 output
  10915. @item rgb
  10916. force packed RGB output
  10917. @item gbrp
  10918. force planar RGB output
  10919. @item auto
  10920. automatically pick format
  10921. @end table
  10922. Default value is @samp{yuv420}.
  10923. @item repeatlast
  10924. See @ref{framesync}.
  10925. @item alpha
  10926. Set format of alpha of the overlaid video, it can be @var{straight} or
  10927. @var{premultiplied}. Default is @var{straight}.
  10928. @end table
  10929. The @option{x}, and @option{y} expressions can contain the following
  10930. parameters.
  10931. @table @option
  10932. @item main_w, W
  10933. @item main_h, H
  10934. The main input width and height.
  10935. @item overlay_w, w
  10936. @item overlay_h, h
  10937. The overlay input width and height.
  10938. @item x
  10939. @item y
  10940. The computed values for @var{x} and @var{y}. They are evaluated for
  10941. each new frame.
  10942. @item hsub
  10943. @item vsub
  10944. horizontal and vertical chroma subsample values of the output
  10945. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10946. @var{vsub} is 1.
  10947. @item n
  10948. the number of input frame, starting from 0
  10949. @item pos
  10950. the position in the file of the input frame, NAN if unknown
  10951. @item t
  10952. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10953. @end table
  10954. This filter also supports the @ref{framesync} options.
  10955. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10956. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10957. when @option{eval} is set to @samp{init}.
  10958. Be aware that frames are taken from each input video in timestamp
  10959. order, hence, if their initial timestamps differ, it is a good idea
  10960. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10961. have them begin in the same zero timestamp, as the example for
  10962. the @var{movie} filter does.
  10963. You can chain together more overlays but you should test the
  10964. efficiency of such approach.
  10965. @subsection Commands
  10966. This filter supports the following commands:
  10967. @table @option
  10968. @item x
  10969. @item y
  10970. Modify the x and y of the overlay input.
  10971. The command accepts the same syntax of the corresponding option.
  10972. If the specified expression is not valid, it is kept at its current
  10973. value.
  10974. @end table
  10975. @subsection Examples
  10976. @itemize
  10977. @item
  10978. Draw the overlay at 10 pixels from the bottom right corner of the main
  10979. video:
  10980. @example
  10981. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10982. @end example
  10983. Using named options the example above becomes:
  10984. @example
  10985. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10986. @end example
  10987. @item
  10988. Insert a transparent PNG logo in the bottom left corner of the input,
  10989. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10990. @example
  10991. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10992. @end example
  10993. @item
  10994. Insert 2 different transparent PNG logos (second logo on bottom
  10995. right corner) using the @command{ffmpeg} tool:
  10996. @example
  10997. 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
  10998. @end example
  10999. @item
  11000. Add a transparent color layer on top of the main video; @code{WxH}
  11001. must specify the size of the main input to the overlay filter:
  11002. @example
  11003. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  11004. @end example
  11005. @item
  11006. Play an original video and a filtered version (here with the deshake
  11007. filter) side by side using the @command{ffplay} tool:
  11008. @example
  11009. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  11010. @end example
  11011. The above command is the same as:
  11012. @example
  11013. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  11014. @end example
  11015. @item
  11016. Make a sliding overlay appearing from the left to the right top part of the
  11017. screen starting since time 2:
  11018. @example
  11019. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  11020. @end example
  11021. @item
  11022. Compose output by putting two input videos side to side:
  11023. @example
  11024. ffmpeg -i left.avi -i right.avi -filter_complex "
  11025. nullsrc=size=200x100 [background];
  11026. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  11027. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  11028. [background][left] overlay=shortest=1 [background+left];
  11029. [background+left][right] overlay=shortest=1:x=100 [left+right]
  11030. "
  11031. @end example
  11032. @item
  11033. Mask 10-20 seconds of a video by applying the delogo filter to a section
  11034. @example
  11035. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  11036. -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]'
  11037. masked.avi
  11038. @end example
  11039. @item
  11040. Chain several overlays in cascade:
  11041. @example
  11042. nullsrc=s=200x200 [bg];
  11043. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  11044. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  11045. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  11046. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  11047. [in3] null, [mid2] overlay=100:100 [out0]
  11048. @end example
  11049. @end itemize
  11050. @anchor{overlay_cuda}
  11051. @section overlay_cuda
  11052. Overlay one video on top of another.
  11053. This is the CUDA cariant of the @ref{overlay} filter.
  11054. It only accepts CUDA frames. The underlying input pixel formats have to match.
  11055. It takes two inputs and has one output. The first input is the "main"
  11056. video on which the second input is overlaid.
  11057. It accepts the following parameters:
  11058. @table @option
  11059. @item x
  11060. @item y
  11061. Set the x and y coordinates of the overlaid video on the main video.
  11062. Default value is "0" for both expressions.
  11063. @item eof_action
  11064. See @ref{framesync}.
  11065. @item shortest
  11066. See @ref{framesync}.
  11067. @item repeatlast
  11068. See @ref{framesync}.
  11069. @end table
  11070. This filter also supports the @ref{framesync} options.
  11071. @section owdenoise
  11072. Apply Overcomplete Wavelet denoiser.
  11073. The filter accepts the following options:
  11074. @table @option
  11075. @item depth
  11076. Set depth.
  11077. Larger depth values will denoise lower frequency components more, but
  11078. slow down filtering.
  11079. Must be an int in the range 8-16, default is @code{8}.
  11080. @item luma_strength, ls
  11081. Set luma strength.
  11082. Must be a double value in the range 0-1000, default is @code{1.0}.
  11083. @item chroma_strength, cs
  11084. Set chroma strength.
  11085. Must be a double value in the range 0-1000, default is @code{1.0}.
  11086. @end table
  11087. @anchor{pad}
  11088. @section pad
  11089. Add paddings to the input image, and place the original input at the
  11090. provided @var{x}, @var{y} coordinates.
  11091. It accepts the following parameters:
  11092. @table @option
  11093. @item width, w
  11094. @item height, h
  11095. Specify an expression for the size of the output image with the
  11096. paddings added. If the value for @var{width} or @var{height} is 0, the
  11097. corresponding input size is used for the output.
  11098. The @var{width} expression can reference the value set by the
  11099. @var{height} expression, and vice versa.
  11100. The default value of @var{width} and @var{height} is 0.
  11101. @item x
  11102. @item y
  11103. Specify the offsets to place the input image at within the padded area,
  11104. with respect to the top/left border of the output image.
  11105. The @var{x} expression can reference the value set by the @var{y}
  11106. expression, and vice versa.
  11107. The default value of @var{x} and @var{y} is 0.
  11108. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  11109. so the input image is centered on the padded area.
  11110. @item color
  11111. Specify the color of the padded area. For the syntax of this option,
  11112. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11113. manual,ffmpeg-utils}.
  11114. The default value of @var{color} is "black".
  11115. @item eval
  11116. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  11117. It accepts the following values:
  11118. @table @samp
  11119. @item init
  11120. Only evaluate expressions once during the filter initialization or when
  11121. a command is processed.
  11122. @item frame
  11123. Evaluate expressions for each incoming frame.
  11124. @end table
  11125. Default value is @samp{init}.
  11126. @item aspect
  11127. Pad to aspect instead to a resolution.
  11128. @end table
  11129. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  11130. options are expressions containing the following constants:
  11131. @table @option
  11132. @item in_w
  11133. @item in_h
  11134. The input video width and height.
  11135. @item iw
  11136. @item ih
  11137. These are the same as @var{in_w} and @var{in_h}.
  11138. @item out_w
  11139. @item out_h
  11140. The output width and height (the size of the padded area), as
  11141. specified by the @var{width} and @var{height} expressions.
  11142. @item ow
  11143. @item oh
  11144. These are the same as @var{out_w} and @var{out_h}.
  11145. @item x
  11146. @item y
  11147. The x and y offsets as specified by the @var{x} and @var{y}
  11148. expressions, or NAN if not yet specified.
  11149. @item a
  11150. same as @var{iw} / @var{ih}
  11151. @item sar
  11152. input sample aspect ratio
  11153. @item dar
  11154. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  11155. @item hsub
  11156. @item vsub
  11157. The horizontal and vertical chroma subsample values. For example for the
  11158. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11159. @end table
  11160. @subsection Examples
  11161. @itemize
  11162. @item
  11163. Add paddings with the color "violet" to the input video. The output video
  11164. size is 640x480, and the top-left corner of the input video is placed at
  11165. column 0, row 40
  11166. @example
  11167. pad=640:480:0:40:violet
  11168. @end example
  11169. The example above is equivalent to the following command:
  11170. @example
  11171. pad=width=640:height=480:x=0:y=40:color=violet
  11172. @end example
  11173. @item
  11174. Pad the input to get an output with dimensions increased by 3/2,
  11175. and put the input video at the center of the padded area:
  11176. @example
  11177. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  11178. @end example
  11179. @item
  11180. Pad the input to get a squared output with size equal to the maximum
  11181. value between the input width and height, and put the input video at
  11182. the center of the padded area:
  11183. @example
  11184. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  11185. @end example
  11186. @item
  11187. Pad the input to get a final w/h ratio of 16:9:
  11188. @example
  11189. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  11190. @end example
  11191. @item
  11192. In case of anamorphic video, in order to set the output display aspect
  11193. correctly, it is necessary to use @var{sar} in the expression,
  11194. according to the relation:
  11195. @example
  11196. (ih * X / ih) * sar = output_dar
  11197. X = output_dar / sar
  11198. @end example
  11199. Thus the previous example needs to be modified to:
  11200. @example
  11201. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  11202. @end example
  11203. @item
  11204. Double the output size and put the input video in the bottom-right
  11205. corner of the output padded area:
  11206. @example
  11207. pad="2*iw:2*ih:ow-iw:oh-ih"
  11208. @end example
  11209. @end itemize
  11210. @anchor{palettegen}
  11211. @section palettegen
  11212. Generate one palette for a whole video stream.
  11213. It accepts the following options:
  11214. @table @option
  11215. @item max_colors
  11216. Set the maximum number of colors to quantize in the palette.
  11217. Note: the palette will still contain 256 colors; the unused palette entries
  11218. will be black.
  11219. @item reserve_transparent
  11220. Create a palette of 255 colors maximum and reserve the last one for
  11221. transparency. Reserving the transparency color is useful for GIF optimization.
  11222. If not set, the maximum of colors in the palette will be 256. You probably want
  11223. to disable this option for a standalone image.
  11224. Set by default.
  11225. @item transparency_color
  11226. Set the color that will be used as background for transparency.
  11227. @item stats_mode
  11228. Set statistics mode.
  11229. It accepts the following values:
  11230. @table @samp
  11231. @item full
  11232. Compute full frame histograms.
  11233. @item diff
  11234. Compute histograms only for the part that differs from previous frame. This
  11235. might be relevant to give more importance to the moving part of your input if
  11236. the background is static.
  11237. @item single
  11238. Compute new histogram for each frame.
  11239. @end table
  11240. Default value is @var{full}.
  11241. @end table
  11242. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11243. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11244. color quantization of the palette. This information is also visible at
  11245. @var{info} logging level.
  11246. @subsection Examples
  11247. @itemize
  11248. @item
  11249. Generate a representative palette of a given video using @command{ffmpeg}:
  11250. @example
  11251. ffmpeg -i input.mkv -vf palettegen palette.png
  11252. @end example
  11253. @end itemize
  11254. @section paletteuse
  11255. Use a palette to downsample an input video stream.
  11256. The filter takes two inputs: one video stream and a palette. The palette must
  11257. be a 256 pixels image.
  11258. It accepts the following options:
  11259. @table @option
  11260. @item dither
  11261. Select dithering mode. Available algorithms are:
  11262. @table @samp
  11263. @item bayer
  11264. Ordered 8x8 bayer dithering (deterministic)
  11265. @item heckbert
  11266. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11267. Note: this dithering is sometimes considered "wrong" and is included as a
  11268. reference.
  11269. @item floyd_steinberg
  11270. Floyd and Steingberg dithering (error diffusion)
  11271. @item sierra2
  11272. Frankie Sierra dithering v2 (error diffusion)
  11273. @item sierra2_4a
  11274. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11275. @end table
  11276. Default is @var{sierra2_4a}.
  11277. @item bayer_scale
  11278. When @var{bayer} dithering is selected, this option defines the scale of the
  11279. pattern (how much the crosshatch pattern is visible). A low value means more
  11280. visible pattern for less banding, and higher value means less visible pattern
  11281. at the cost of more banding.
  11282. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11283. @item diff_mode
  11284. If set, define the zone to process
  11285. @table @samp
  11286. @item rectangle
  11287. Only the changing rectangle will be reprocessed. This is similar to GIF
  11288. cropping/offsetting compression mechanism. This option can be useful for speed
  11289. if only a part of the image is changing, and has use cases such as limiting the
  11290. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11291. moving scene (it leads to more deterministic output if the scene doesn't change
  11292. much, and as a result less moving noise and better GIF compression).
  11293. @end table
  11294. Default is @var{none}.
  11295. @item new
  11296. Take new palette for each output frame.
  11297. @item alpha_threshold
  11298. Sets the alpha threshold for transparency. Alpha values above this threshold
  11299. will be treated as completely opaque, and values below this threshold will be
  11300. treated as completely transparent.
  11301. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11302. @end table
  11303. @subsection Examples
  11304. @itemize
  11305. @item
  11306. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11307. using @command{ffmpeg}:
  11308. @example
  11309. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11310. @end example
  11311. @end itemize
  11312. @section perspective
  11313. Correct perspective of video not recorded perpendicular to the screen.
  11314. A description of the accepted parameters follows.
  11315. @table @option
  11316. @item x0
  11317. @item y0
  11318. @item x1
  11319. @item y1
  11320. @item x2
  11321. @item y2
  11322. @item x3
  11323. @item y3
  11324. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11325. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11326. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11327. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11328. then the corners of the source will be sent to the specified coordinates.
  11329. The expressions can use the following variables:
  11330. @table @option
  11331. @item W
  11332. @item H
  11333. the width and height of video frame.
  11334. @item in
  11335. Input frame count.
  11336. @item on
  11337. Output frame count.
  11338. @end table
  11339. @item interpolation
  11340. Set interpolation for perspective correction.
  11341. It accepts the following values:
  11342. @table @samp
  11343. @item linear
  11344. @item cubic
  11345. @end table
  11346. Default value is @samp{linear}.
  11347. @item sense
  11348. Set interpretation of coordinate options.
  11349. It accepts the following values:
  11350. @table @samp
  11351. @item 0, source
  11352. Send point in the source specified by the given coordinates to
  11353. the corners of the destination.
  11354. @item 1, destination
  11355. Send the corners of the source to the point in the destination specified
  11356. by the given coordinates.
  11357. Default value is @samp{source}.
  11358. @end table
  11359. @item eval
  11360. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11361. It accepts the following values:
  11362. @table @samp
  11363. @item init
  11364. only evaluate expressions once during the filter initialization or
  11365. when a command is processed
  11366. @item frame
  11367. evaluate expressions for each incoming frame
  11368. @end table
  11369. Default value is @samp{init}.
  11370. @end table
  11371. @section phase
  11372. Delay interlaced video by one field time so that the field order changes.
  11373. The intended use is to fix PAL movies that have been captured with the
  11374. opposite field order to the film-to-video transfer.
  11375. A description of the accepted parameters follows.
  11376. @table @option
  11377. @item mode
  11378. Set phase mode.
  11379. It accepts the following values:
  11380. @table @samp
  11381. @item t
  11382. Capture field order top-first, transfer bottom-first.
  11383. Filter will delay the bottom field.
  11384. @item b
  11385. Capture field order bottom-first, transfer top-first.
  11386. Filter will delay the top field.
  11387. @item p
  11388. Capture and transfer with the same field order. This mode only exists
  11389. for the documentation of the other options to refer to, but if you
  11390. actually select it, the filter will faithfully do nothing.
  11391. @item a
  11392. Capture field order determined automatically by field flags, transfer
  11393. opposite.
  11394. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11395. basis using field flags. If no field information is available,
  11396. then this works just like @samp{u}.
  11397. @item u
  11398. Capture unknown or varying, transfer opposite.
  11399. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11400. analyzing the images and selecting the alternative that produces best
  11401. match between the fields.
  11402. @item T
  11403. Capture top-first, transfer unknown or varying.
  11404. Filter selects among @samp{t} and @samp{p} using image analysis.
  11405. @item B
  11406. Capture bottom-first, transfer unknown or varying.
  11407. Filter selects among @samp{b} and @samp{p} using image analysis.
  11408. @item A
  11409. Capture determined by field flags, transfer unknown or varying.
  11410. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11411. image analysis. If no field information is available, then this works just
  11412. like @samp{U}. This is the default mode.
  11413. @item U
  11414. Both capture and transfer unknown or varying.
  11415. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11416. @end table
  11417. @end table
  11418. @section photosensitivity
  11419. Reduce various flashes in video, so to help users with epilepsy.
  11420. It accepts the following options:
  11421. @table @option
  11422. @item frames, f
  11423. Set how many frames to use when filtering. Default is 30.
  11424. @item threshold, t
  11425. Set detection threshold factor. Default is 1.
  11426. Lower is stricter.
  11427. @item skip
  11428. Set how many pixels to skip when sampling frames. Default is 1.
  11429. Allowed range is from 1 to 1024.
  11430. @item bypass
  11431. Leave frames unchanged. Default is disabled.
  11432. @end table
  11433. @section pixdesctest
  11434. Pixel format descriptor test filter, mainly useful for internal
  11435. testing. The output video should be equal to the input video.
  11436. For example:
  11437. @example
  11438. format=monow, pixdesctest
  11439. @end example
  11440. can be used to test the monowhite pixel format descriptor definition.
  11441. @section pixscope
  11442. Display sample values of color channels. Mainly useful for checking color
  11443. and levels. Minimum supported resolution is 640x480.
  11444. The filters accept the following options:
  11445. @table @option
  11446. @item x
  11447. Set scope X position, relative offset on X axis.
  11448. @item y
  11449. Set scope Y position, relative offset on Y axis.
  11450. @item w
  11451. Set scope width.
  11452. @item h
  11453. Set scope height.
  11454. @item o
  11455. Set window opacity. This window also holds statistics about pixel area.
  11456. @item wx
  11457. Set window X position, relative offset on X axis.
  11458. @item wy
  11459. Set window Y position, relative offset on Y axis.
  11460. @end table
  11461. @section pp
  11462. Enable the specified chain of postprocessing subfilters using libpostproc. This
  11463. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  11464. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  11465. Each subfilter and some options have a short and a long name that can be used
  11466. interchangeably, i.e. dr/dering are the same.
  11467. The filters accept the following options:
  11468. @table @option
  11469. @item subfilters
  11470. Set postprocessing subfilters string.
  11471. @end table
  11472. All subfilters share common options to determine their scope:
  11473. @table @option
  11474. @item a/autoq
  11475. Honor the quality commands for this subfilter.
  11476. @item c/chrom
  11477. Do chrominance filtering, too (default).
  11478. @item y/nochrom
  11479. Do luminance filtering only (no chrominance).
  11480. @item n/noluma
  11481. Do chrominance filtering only (no luminance).
  11482. @end table
  11483. These options can be appended after the subfilter name, separated by a '|'.
  11484. Available subfilters are:
  11485. @table @option
  11486. @item hb/hdeblock[|difference[|flatness]]
  11487. Horizontal deblocking filter
  11488. @table @option
  11489. @item difference
  11490. Difference factor where higher values mean more deblocking (default: @code{32}).
  11491. @item flatness
  11492. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11493. @end table
  11494. @item vb/vdeblock[|difference[|flatness]]
  11495. Vertical deblocking filter
  11496. @table @option
  11497. @item difference
  11498. Difference factor where higher values mean more deblocking (default: @code{32}).
  11499. @item flatness
  11500. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11501. @end table
  11502. @item ha/hadeblock[|difference[|flatness]]
  11503. Accurate horizontal deblocking filter
  11504. @table @option
  11505. @item difference
  11506. Difference factor where higher values mean more deblocking (default: @code{32}).
  11507. @item flatness
  11508. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11509. @end table
  11510. @item va/vadeblock[|difference[|flatness]]
  11511. Accurate vertical deblocking filter
  11512. @table @option
  11513. @item difference
  11514. Difference factor where higher values mean more deblocking (default: @code{32}).
  11515. @item flatness
  11516. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11517. @end table
  11518. @end table
  11519. The horizontal and vertical deblocking filters share the difference and
  11520. flatness values so you cannot set different horizontal and vertical
  11521. thresholds.
  11522. @table @option
  11523. @item h1/x1hdeblock
  11524. Experimental horizontal deblocking filter
  11525. @item v1/x1vdeblock
  11526. Experimental vertical deblocking filter
  11527. @item dr/dering
  11528. Deringing filter
  11529. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  11530. @table @option
  11531. @item threshold1
  11532. larger -> stronger filtering
  11533. @item threshold2
  11534. larger -> stronger filtering
  11535. @item threshold3
  11536. larger -> stronger filtering
  11537. @end table
  11538. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  11539. @table @option
  11540. @item f/fullyrange
  11541. Stretch luminance to @code{0-255}.
  11542. @end table
  11543. @item lb/linblenddeint
  11544. Linear blend deinterlacing filter that deinterlaces the given block by
  11545. filtering all lines with a @code{(1 2 1)} filter.
  11546. @item li/linipoldeint
  11547. Linear interpolating deinterlacing filter that deinterlaces the given block by
  11548. linearly interpolating every second line.
  11549. @item ci/cubicipoldeint
  11550. Cubic interpolating deinterlacing filter deinterlaces the given block by
  11551. cubically interpolating every second line.
  11552. @item md/mediandeint
  11553. Median deinterlacing filter that deinterlaces the given block by applying a
  11554. median filter to every second line.
  11555. @item fd/ffmpegdeint
  11556. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  11557. second line with a @code{(-1 4 2 4 -1)} filter.
  11558. @item l5/lowpass5
  11559. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  11560. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  11561. @item fq/forceQuant[|quantizer]
  11562. Overrides the quantizer table from the input with the constant quantizer you
  11563. specify.
  11564. @table @option
  11565. @item quantizer
  11566. Quantizer to use
  11567. @end table
  11568. @item de/default
  11569. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  11570. @item fa/fast
  11571. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  11572. @item ac
  11573. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11574. @end table
  11575. @subsection Examples
  11576. @itemize
  11577. @item
  11578. Apply horizontal and vertical deblocking, deringing and automatic
  11579. brightness/contrast:
  11580. @example
  11581. pp=hb/vb/dr/al
  11582. @end example
  11583. @item
  11584. Apply default filters without brightness/contrast correction:
  11585. @example
  11586. pp=de/-al
  11587. @end example
  11588. @item
  11589. Apply default filters and temporal denoiser:
  11590. @example
  11591. pp=default/tmpnoise|1|2|3
  11592. @end example
  11593. @item
  11594. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11595. automatically depending on available CPU time:
  11596. @example
  11597. pp=hb|y/vb|a
  11598. @end example
  11599. @end itemize
  11600. @section pp7
  11601. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11602. similar to spp = 6 with 7 point DCT, where only the center sample is
  11603. used after IDCT.
  11604. The filter accepts the following options:
  11605. @table @option
  11606. @item qp
  11607. Force a constant quantization parameter. It accepts an integer in range
  11608. 0 to 63. If not set, the filter will use the QP from the video stream
  11609. (if available).
  11610. @item mode
  11611. Set thresholding mode. Available modes are:
  11612. @table @samp
  11613. @item hard
  11614. Set hard thresholding.
  11615. @item soft
  11616. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11617. @item medium
  11618. Set medium thresholding (good results, default).
  11619. @end table
  11620. @end table
  11621. @section premultiply
  11622. Apply alpha premultiply effect to input video stream using first plane
  11623. of second stream as alpha.
  11624. Both streams must have same dimensions and same pixel format.
  11625. The filter accepts the following option:
  11626. @table @option
  11627. @item planes
  11628. Set which planes will be processed, unprocessed planes will be copied.
  11629. By default value 0xf, all planes will be processed.
  11630. @item inplace
  11631. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11632. @end table
  11633. @section prewitt
  11634. Apply prewitt operator to input video stream.
  11635. The filter accepts the following option:
  11636. @table @option
  11637. @item planes
  11638. Set which planes will be processed, unprocessed planes will be copied.
  11639. By default value 0xf, all planes will be processed.
  11640. @item scale
  11641. Set value which will be multiplied with filtered result.
  11642. @item delta
  11643. Set value which will be added to filtered result.
  11644. @end table
  11645. @section pseudocolor
  11646. Alter frame colors in video with pseudocolors.
  11647. This filter accepts the following options:
  11648. @table @option
  11649. @item c0
  11650. set pixel first component expression
  11651. @item c1
  11652. set pixel second component expression
  11653. @item c2
  11654. set pixel third component expression
  11655. @item c3
  11656. set pixel fourth component expression, corresponds to the alpha component
  11657. @item i
  11658. set component to use as base for altering colors
  11659. @end table
  11660. Each of them specifies the expression to use for computing the lookup table for
  11661. the corresponding pixel component values.
  11662. The expressions can contain the following constants and functions:
  11663. @table @option
  11664. @item w
  11665. @item h
  11666. The input width and height.
  11667. @item val
  11668. The input value for the pixel component.
  11669. @item ymin, umin, vmin, amin
  11670. The minimum allowed component value.
  11671. @item ymax, umax, vmax, amax
  11672. The maximum allowed component value.
  11673. @end table
  11674. All expressions default to "val".
  11675. @subsection Examples
  11676. @itemize
  11677. @item
  11678. Change too high luma values to gradient:
  11679. @example
  11680. 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'"
  11681. @end example
  11682. @end itemize
  11683. @section psnr
  11684. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11685. Ratio) between two input videos.
  11686. This filter takes in input two input videos, the first input is
  11687. considered the "main" source and is passed unchanged to the
  11688. output. The second input is used as a "reference" video for computing
  11689. the PSNR.
  11690. Both video inputs must have the same resolution and pixel format for
  11691. this filter to work correctly. Also it assumes that both inputs
  11692. have the same number of frames, which are compared one by one.
  11693. The obtained average PSNR is printed through the logging system.
  11694. The filter stores the accumulated MSE (mean squared error) of each
  11695. frame, and at the end of the processing it is averaged across all frames
  11696. equally, and the following formula is applied to obtain the PSNR:
  11697. @example
  11698. PSNR = 10*log10(MAX^2/MSE)
  11699. @end example
  11700. Where MAX is the average of the maximum values of each component of the
  11701. image.
  11702. The description of the accepted parameters follows.
  11703. @table @option
  11704. @item stats_file, f
  11705. If specified the filter will use the named file to save the PSNR of
  11706. each individual frame. When filename equals "-" the data is sent to
  11707. standard output.
  11708. @item stats_version
  11709. Specifies which version of the stats file format to use. Details of
  11710. each format are written below.
  11711. Default value is 1.
  11712. @item stats_add_max
  11713. Determines whether the max value is output to the stats log.
  11714. Default value is 0.
  11715. Requires stats_version >= 2. If this is set and stats_version < 2,
  11716. the filter will return an error.
  11717. @end table
  11718. This filter also supports the @ref{framesync} options.
  11719. The file printed if @var{stats_file} is selected, contains a sequence of
  11720. key/value pairs of the form @var{key}:@var{value} for each compared
  11721. couple of frames.
  11722. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11723. the list of per-frame-pair stats, with key value pairs following the frame
  11724. format with the following parameters:
  11725. @table @option
  11726. @item psnr_log_version
  11727. The version of the log file format. Will match @var{stats_version}.
  11728. @item fields
  11729. A comma separated list of the per-frame-pair parameters included in
  11730. the log.
  11731. @end table
  11732. A description of each shown per-frame-pair parameter follows:
  11733. @table @option
  11734. @item n
  11735. sequential number of the input frame, starting from 1
  11736. @item mse_avg
  11737. Mean Square Error pixel-by-pixel average difference of the compared
  11738. frames, averaged over all the image components.
  11739. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11740. Mean Square Error pixel-by-pixel average difference of the compared
  11741. frames for the component specified by the suffix.
  11742. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11743. Peak Signal to Noise ratio of the compared frames for the component
  11744. specified by the suffix.
  11745. @item max_avg, max_y, max_u, max_v
  11746. Maximum allowed value for each channel, and average over all
  11747. channels.
  11748. @end table
  11749. @subsection Examples
  11750. @itemize
  11751. @item
  11752. For example:
  11753. @example
  11754. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11755. [main][ref] psnr="stats_file=stats.log" [out]
  11756. @end example
  11757. On this example the input file being processed is compared with the
  11758. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11759. is stored in @file{stats.log}.
  11760. @item
  11761. Another example with different containers:
  11762. @example
  11763. 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 -
  11764. @end example
  11765. @end itemize
  11766. @anchor{pullup}
  11767. @section pullup
  11768. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11769. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11770. content.
  11771. The pullup filter is designed to take advantage of future context in making
  11772. its decisions. This filter is stateless in the sense that it does not lock
  11773. onto a pattern to follow, but it instead looks forward to the following
  11774. fields in order to identify matches and rebuild progressive frames.
  11775. To produce content with an even framerate, insert the fps filter after
  11776. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11777. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11778. The filter accepts the following options:
  11779. @table @option
  11780. @item jl
  11781. @item jr
  11782. @item jt
  11783. @item jb
  11784. These options set the amount of "junk" to ignore at the left, right, top, and
  11785. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11786. while top and bottom are in units of 2 lines.
  11787. The default is 8 pixels on each side.
  11788. @item sb
  11789. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11790. filter generating an occasional mismatched frame, but it may also cause an
  11791. excessive number of frames to be dropped during high motion sequences.
  11792. Conversely, setting it to -1 will make filter match fields more easily.
  11793. This may help processing of video where there is slight blurring between
  11794. the fields, but may also cause there to be interlaced frames in the output.
  11795. Default value is @code{0}.
  11796. @item mp
  11797. Set the metric plane to use. It accepts the following values:
  11798. @table @samp
  11799. @item l
  11800. Use luma plane.
  11801. @item u
  11802. Use chroma blue plane.
  11803. @item v
  11804. Use chroma red plane.
  11805. @end table
  11806. This option may be set to use chroma plane instead of the default luma plane
  11807. for doing filter's computations. This may improve accuracy on very clean
  11808. source material, but more likely will decrease accuracy, especially if there
  11809. is chroma noise (rainbow effect) or any grayscale video.
  11810. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11811. load and make pullup usable in realtime on slow machines.
  11812. @end table
  11813. For best results (without duplicated frames in the output file) it is
  11814. necessary to change the output frame rate. For example, to inverse
  11815. telecine NTSC input:
  11816. @example
  11817. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11818. @end example
  11819. @section qp
  11820. Change video quantization parameters (QP).
  11821. The filter accepts the following option:
  11822. @table @option
  11823. @item qp
  11824. Set expression for quantization parameter.
  11825. @end table
  11826. The expression is evaluated through the eval API and can contain, among others,
  11827. the following constants:
  11828. @table @var
  11829. @item known
  11830. 1 if index is not 129, 0 otherwise.
  11831. @item qp
  11832. Sequential index starting from -129 to 128.
  11833. @end table
  11834. @subsection Examples
  11835. @itemize
  11836. @item
  11837. Some equation like:
  11838. @example
  11839. qp=2+2*sin(PI*qp)
  11840. @end example
  11841. @end itemize
  11842. @section random
  11843. Flush video frames from internal cache of frames into a random order.
  11844. No frame is discarded.
  11845. Inspired by @ref{frei0r} nervous filter.
  11846. @table @option
  11847. @item frames
  11848. Set size in number of frames of internal cache, in range from @code{2} to
  11849. @code{512}. Default is @code{30}.
  11850. @item seed
  11851. Set seed for random number generator, must be an integer included between
  11852. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11853. less than @code{0}, the filter will try to use a good random seed on a
  11854. best effort basis.
  11855. @end table
  11856. @section readeia608
  11857. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11858. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11859. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11860. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11861. @table @option
  11862. @item lavfi.readeia608.X.cc
  11863. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11864. @item lavfi.readeia608.X.line
  11865. The number of the line on which the EIA-608 data was identified and read.
  11866. @end table
  11867. This filter accepts the following options:
  11868. @table @option
  11869. @item scan_min
  11870. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11871. @item scan_max
  11872. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11873. @item spw
  11874. Set the ratio of width reserved for sync code detection.
  11875. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  11876. @item chp
  11877. Enable checking the parity bit. In the event of a parity error, the filter will output
  11878. @code{0x00} for that character. Default is false.
  11879. @item lp
  11880. Lowpass lines prior to further processing. Default is enabled.
  11881. @end table
  11882. @subsection Examples
  11883. @itemize
  11884. @item
  11885. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11886. @example
  11887. 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
  11888. @end example
  11889. @end itemize
  11890. @section readvitc
  11891. Read vertical interval timecode (VITC) information from the top lines of a
  11892. video frame.
  11893. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11894. timecode value, if a valid timecode has been detected. Further metadata key
  11895. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11896. timecode data has been found or not.
  11897. This filter accepts the following options:
  11898. @table @option
  11899. @item scan_max
  11900. Set the maximum number of lines to scan for VITC data. If the value is set to
  11901. @code{-1} the full video frame is scanned. Default is @code{45}.
  11902. @item thr_b
  11903. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11904. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11905. @item thr_w
  11906. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11907. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11908. @end table
  11909. @subsection Examples
  11910. @itemize
  11911. @item
  11912. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11913. draw @code{--:--:--:--} as a placeholder:
  11914. @example
  11915. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11916. @end example
  11917. @end itemize
  11918. @section remap
  11919. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11920. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11921. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11922. value for pixel will be used for destination pixel.
  11923. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11924. will have Xmap/Ymap video stream dimensions.
  11925. Xmap and Ymap input video streams are 16bit depth, single channel.
  11926. @table @option
  11927. @item format
  11928. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11929. Default is @code{color}.
  11930. @item fill
  11931. Specify the color of the unmapped pixels. For the syntax of this option,
  11932. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11933. manual,ffmpeg-utils}. Default color is @code{black}.
  11934. @end table
  11935. @section removegrain
  11936. The removegrain filter is a spatial denoiser for progressive video.
  11937. @table @option
  11938. @item m0
  11939. Set mode for the first plane.
  11940. @item m1
  11941. Set mode for the second plane.
  11942. @item m2
  11943. Set mode for the third plane.
  11944. @item m3
  11945. Set mode for the fourth plane.
  11946. @end table
  11947. Range of mode is from 0 to 24. Description of each mode follows:
  11948. @table @var
  11949. @item 0
  11950. Leave input plane unchanged. Default.
  11951. @item 1
  11952. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11953. @item 2
  11954. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11955. @item 3
  11956. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11957. @item 4
  11958. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11959. This is equivalent to a median filter.
  11960. @item 5
  11961. Line-sensitive clipping giving the minimal change.
  11962. @item 6
  11963. Line-sensitive clipping, intermediate.
  11964. @item 7
  11965. Line-sensitive clipping, intermediate.
  11966. @item 8
  11967. Line-sensitive clipping, intermediate.
  11968. @item 9
  11969. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11970. @item 10
  11971. Replaces the target pixel with the closest neighbour.
  11972. @item 11
  11973. [1 2 1] horizontal and vertical kernel blur.
  11974. @item 12
  11975. Same as mode 11.
  11976. @item 13
  11977. Bob mode, interpolates top field from the line where the neighbours
  11978. pixels are the closest.
  11979. @item 14
  11980. Bob mode, interpolates bottom field from the line where the neighbours
  11981. pixels are the closest.
  11982. @item 15
  11983. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11984. interpolation formula.
  11985. @item 16
  11986. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11987. interpolation formula.
  11988. @item 17
  11989. Clips the pixel with the minimum and maximum of respectively the maximum and
  11990. minimum of each pair of opposite neighbour pixels.
  11991. @item 18
  11992. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11993. the current pixel is minimal.
  11994. @item 19
  11995. Replaces the pixel with the average of its 8 neighbours.
  11996. @item 20
  11997. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11998. @item 21
  11999. Clips pixels using the averages of opposite neighbour.
  12000. @item 22
  12001. Same as mode 21 but simpler and faster.
  12002. @item 23
  12003. Small edge and halo removal, but reputed useless.
  12004. @item 24
  12005. Similar as 23.
  12006. @end table
  12007. @section removelogo
  12008. Suppress a TV station logo, using an image file to determine which
  12009. pixels comprise the logo. It works by filling in the pixels that
  12010. comprise the logo with neighboring pixels.
  12011. The filter accepts the following options:
  12012. @table @option
  12013. @item filename, f
  12014. Set the filter bitmap file, which can be any image format supported by
  12015. libavformat. The width and height of the image file must match those of the
  12016. video stream being processed.
  12017. @end table
  12018. Pixels in the provided bitmap image with a value of zero are not
  12019. considered part of the logo, non-zero pixels are considered part of
  12020. the logo. If you use white (255) for the logo and black (0) for the
  12021. rest, you will be safe. For making the filter bitmap, it is
  12022. recommended to take a screen capture of a black frame with the logo
  12023. visible, and then using a threshold filter followed by the erode
  12024. filter once or twice.
  12025. If needed, little splotches can be fixed manually. Remember that if
  12026. logo pixels are not covered, the filter quality will be much
  12027. reduced. Marking too many pixels as part of the logo does not hurt as
  12028. much, but it will increase the amount of blurring needed to cover over
  12029. the image and will destroy more information than necessary, and extra
  12030. pixels will slow things down on a large logo.
  12031. @section repeatfields
  12032. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  12033. fields based on its value.
  12034. @section reverse
  12035. Reverse a video clip.
  12036. Warning: This filter requires memory to buffer the entire clip, so trimming
  12037. is suggested.
  12038. @subsection Examples
  12039. @itemize
  12040. @item
  12041. Take the first 5 seconds of a clip, and reverse it.
  12042. @example
  12043. trim=end=5,reverse
  12044. @end example
  12045. @end itemize
  12046. @section rgbashift
  12047. Shift R/G/B/A pixels horizontally and/or vertically.
  12048. The filter accepts the following options:
  12049. @table @option
  12050. @item rh
  12051. Set amount to shift red horizontally.
  12052. @item rv
  12053. Set amount to shift red vertically.
  12054. @item gh
  12055. Set amount to shift green horizontally.
  12056. @item gv
  12057. Set amount to shift green vertically.
  12058. @item bh
  12059. Set amount to shift blue horizontally.
  12060. @item bv
  12061. Set amount to shift blue vertically.
  12062. @item ah
  12063. Set amount to shift alpha horizontally.
  12064. @item av
  12065. Set amount to shift alpha vertically.
  12066. @item edge
  12067. Set edge mode, can be @var{smear}, default, or @var{warp}.
  12068. @end table
  12069. @subsection Commands
  12070. This filter supports the all above options as @ref{commands}.
  12071. @section roberts
  12072. Apply roberts cross operator to input video stream.
  12073. The filter accepts the following option:
  12074. @table @option
  12075. @item planes
  12076. Set which planes will be processed, unprocessed planes will be copied.
  12077. By default value 0xf, all planes will be processed.
  12078. @item scale
  12079. Set value which will be multiplied with filtered result.
  12080. @item delta
  12081. Set value which will be added to filtered result.
  12082. @end table
  12083. @section rotate
  12084. Rotate video by an arbitrary angle expressed in radians.
  12085. The filter accepts the following options:
  12086. A description of the optional parameters follows.
  12087. @table @option
  12088. @item angle, a
  12089. Set an expression for the angle by which to rotate the input video
  12090. clockwise, expressed as a number of radians. A negative value will
  12091. result in a counter-clockwise rotation. By default it is set to "0".
  12092. This expression is evaluated for each frame.
  12093. @item out_w, ow
  12094. Set the output width expression, default value is "iw".
  12095. This expression is evaluated just once during configuration.
  12096. @item out_h, oh
  12097. Set the output height expression, default value is "ih".
  12098. This expression is evaluated just once during configuration.
  12099. @item bilinear
  12100. Enable bilinear interpolation if set to 1, a value of 0 disables
  12101. it. Default value is 1.
  12102. @item fillcolor, c
  12103. Set the color used to fill the output area not covered by the rotated
  12104. image. For the general syntax of this option, check the
  12105. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12106. If the special value "none" is selected then no
  12107. background is printed (useful for example if the background is never shown).
  12108. Default value is "black".
  12109. @end table
  12110. The expressions for the angle and the output size can contain the
  12111. following constants and functions:
  12112. @table @option
  12113. @item n
  12114. sequential number of the input frame, starting from 0. It is always NAN
  12115. before the first frame is filtered.
  12116. @item t
  12117. time in seconds of the input frame, it is set to 0 when the filter is
  12118. configured. It is always NAN before the first frame is filtered.
  12119. @item hsub
  12120. @item vsub
  12121. horizontal and vertical chroma subsample values. For example for the
  12122. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12123. @item in_w, iw
  12124. @item in_h, ih
  12125. the input video width and height
  12126. @item out_w, ow
  12127. @item out_h, oh
  12128. the output width and height, that is the size of the padded area as
  12129. specified by the @var{width} and @var{height} expressions
  12130. @item rotw(a)
  12131. @item roth(a)
  12132. the minimal width/height required for completely containing the input
  12133. video rotated by @var{a} radians.
  12134. These are only available when computing the @option{out_w} and
  12135. @option{out_h} expressions.
  12136. @end table
  12137. @subsection Examples
  12138. @itemize
  12139. @item
  12140. Rotate the input by PI/6 radians clockwise:
  12141. @example
  12142. rotate=PI/6
  12143. @end example
  12144. @item
  12145. Rotate the input by PI/6 radians counter-clockwise:
  12146. @example
  12147. rotate=-PI/6
  12148. @end example
  12149. @item
  12150. Rotate the input by 45 degrees clockwise:
  12151. @example
  12152. rotate=45*PI/180
  12153. @end example
  12154. @item
  12155. Apply a constant rotation with period T, starting from an angle of PI/3:
  12156. @example
  12157. rotate=PI/3+2*PI*t/T
  12158. @end example
  12159. @item
  12160. Make the input video rotation oscillating with a period of T
  12161. seconds and an amplitude of A radians:
  12162. @example
  12163. rotate=A*sin(2*PI/T*t)
  12164. @end example
  12165. @item
  12166. Rotate the video, output size is chosen so that the whole rotating
  12167. input video is always completely contained in the output:
  12168. @example
  12169. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12170. @end example
  12171. @item
  12172. Rotate the video, reduce the output size so that no background is ever
  12173. shown:
  12174. @example
  12175. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12176. @end example
  12177. @end itemize
  12178. @subsection Commands
  12179. The filter supports the following commands:
  12180. @table @option
  12181. @item a, angle
  12182. Set the angle expression.
  12183. The command accepts the same syntax of the corresponding option.
  12184. If the specified expression is not valid, it is kept at its current
  12185. value.
  12186. @end table
  12187. @section sab
  12188. Apply Shape Adaptive Blur.
  12189. The filter accepts the following options:
  12190. @table @option
  12191. @item luma_radius, lr
  12192. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12193. value is 1.0. A greater value will result in a more blurred image, and
  12194. in slower processing.
  12195. @item luma_pre_filter_radius, lpfr
  12196. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12197. value is 1.0.
  12198. @item luma_strength, ls
  12199. Set luma maximum difference between pixels to still be considered, must
  12200. be a value in the 0.1-100.0 range, default value is 1.0.
  12201. @item chroma_radius, cr
  12202. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12203. greater value will result in a more blurred image, and in slower
  12204. processing.
  12205. @item chroma_pre_filter_radius, cpfr
  12206. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12207. @item chroma_strength, cs
  12208. Set chroma maximum difference between pixels to still be considered,
  12209. must be a value in the -0.9-100.0 range.
  12210. @end table
  12211. Each chroma option value, if not explicitly specified, is set to the
  12212. corresponding luma option value.
  12213. @anchor{scale}
  12214. @section scale
  12215. Scale (resize) the input video, using the libswscale library.
  12216. The scale filter forces the output display aspect ratio to be the same
  12217. of the input, by changing the output sample aspect ratio.
  12218. If the input image format is different from the format requested by
  12219. the next filter, the scale filter will convert the input to the
  12220. requested format.
  12221. @subsection Options
  12222. The filter accepts the following options, or any of the options
  12223. supported by the libswscale scaler.
  12224. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12225. the complete list of scaler options.
  12226. @table @option
  12227. @item width, w
  12228. @item height, h
  12229. Set the output video dimension expression. Default value is the input
  12230. dimension.
  12231. If the @var{width} or @var{w} value is 0, the input width is used for
  12232. the output. If the @var{height} or @var{h} value is 0, the input height
  12233. is used for the output.
  12234. If one and only one of the values is -n with n >= 1, the scale filter
  12235. will use a value that maintains the aspect ratio of the input image,
  12236. calculated from the other specified dimension. After that it will,
  12237. however, make sure that the calculated dimension is divisible by n and
  12238. adjust the value if necessary.
  12239. If both values are -n with n >= 1, the behavior will be identical to
  12240. both values being set to 0 as previously detailed.
  12241. See below for the list of accepted constants for use in the dimension
  12242. expression.
  12243. @item eval
  12244. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12245. @table @samp
  12246. @item init
  12247. Only evaluate expressions once during the filter initialization or when a command is processed.
  12248. @item frame
  12249. Evaluate expressions for each incoming frame.
  12250. @end table
  12251. Default value is @samp{init}.
  12252. @item interl
  12253. Set the interlacing mode. It accepts the following values:
  12254. @table @samp
  12255. @item 1
  12256. Force interlaced aware scaling.
  12257. @item 0
  12258. Do not apply interlaced scaling.
  12259. @item -1
  12260. Select interlaced aware scaling depending on whether the source frames
  12261. are flagged as interlaced or not.
  12262. @end table
  12263. Default value is @samp{0}.
  12264. @item flags
  12265. Set libswscale scaling flags. See
  12266. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12267. complete list of values. If not explicitly specified the filter applies
  12268. the default flags.
  12269. @item param0, param1
  12270. Set libswscale input parameters for scaling algorithms that need them. See
  12271. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12272. complete documentation. If not explicitly specified the filter applies
  12273. empty parameters.
  12274. @item size, s
  12275. Set the video size. For the syntax of this option, check the
  12276. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12277. @item in_color_matrix
  12278. @item out_color_matrix
  12279. Set in/output YCbCr color space type.
  12280. This allows the autodetected value to be overridden as well as allows forcing
  12281. a specific value used for the output and encoder.
  12282. If not specified, the color space type depends on the pixel format.
  12283. Possible values:
  12284. @table @samp
  12285. @item auto
  12286. Choose automatically.
  12287. @item bt709
  12288. Format conforming to International Telecommunication Union (ITU)
  12289. Recommendation BT.709.
  12290. @item fcc
  12291. Set color space conforming to the United States Federal Communications
  12292. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12293. @item bt601
  12294. @item bt470
  12295. @item smpte170m
  12296. Set color space conforming to:
  12297. @itemize
  12298. @item
  12299. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12300. @item
  12301. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12302. @item
  12303. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12304. @end itemize
  12305. @item smpte240m
  12306. Set color space conforming to SMPTE ST 240:1999.
  12307. @item bt2020
  12308. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12309. @end table
  12310. @item in_range
  12311. @item out_range
  12312. Set in/output YCbCr sample range.
  12313. This allows the autodetected value to be overridden as well as allows forcing
  12314. a specific value used for the output and encoder. If not specified, the
  12315. range depends on the pixel format. Possible values:
  12316. @table @samp
  12317. @item auto/unknown
  12318. Choose automatically.
  12319. @item jpeg/full/pc
  12320. Set full range (0-255 in case of 8-bit luma).
  12321. @item mpeg/limited/tv
  12322. Set "MPEG" range (16-235 in case of 8-bit luma).
  12323. @end table
  12324. @item force_original_aspect_ratio
  12325. Enable decreasing or increasing output video width or height if necessary to
  12326. keep the original aspect ratio. Possible values:
  12327. @table @samp
  12328. @item disable
  12329. Scale the video as specified and disable this feature.
  12330. @item decrease
  12331. The output video dimensions will automatically be decreased if needed.
  12332. @item increase
  12333. The output video dimensions will automatically be increased if needed.
  12334. @end table
  12335. One useful instance of this option is that when you know a specific device's
  12336. maximum allowed resolution, you can use this to limit the output video to
  12337. that, while retaining the aspect ratio. For example, device A allows
  12338. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12339. decrease) and specifying 1280x720 to the command line makes the output
  12340. 1280x533.
  12341. Please note that this is a different thing than specifying -1 for @option{w}
  12342. or @option{h}, you still need to specify the output resolution for this option
  12343. to work.
  12344. @item force_divisible_by
  12345. Ensures that both the output dimensions, width and height, are divisible by the
  12346. given integer when used together with @option{force_original_aspect_ratio}. This
  12347. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12348. This option respects the value set for @option{force_original_aspect_ratio},
  12349. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12350. may be slightly modified.
  12351. This option can be handy if you need to have a video fit within or exceed
  12352. a defined resolution using @option{force_original_aspect_ratio} but also have
  12353. encoder restrictions on width or height divisibility.
  12354. @end table
  12355. The values of the @option{w} and @option{h} options are expressions
  12356. containing the following constants:
  12357. @table @var
  12358. @item in_w
  12359. @item in_h
  12360. The input width and height
  12361. @item iw
  12362. @item ih
  12363. These are the same as @var{in_w} and @var{in_h}.
  12364. @item out_w
  12365. @item out_h
  12366. The output (scaled) width and height
  12367. @item ow
  12368. @item oh
  12369. These are the same as @var{out_w} and @var{out_h}
  12370. @item a
  12371. The same as @var{iw} / @var{ih}
  12372. @item sar
  12373. input sample aspect ratio
  12374. @item dar
  12375. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12376. @item hsub
  12377. @item vsub
  12378. horizontal and vertical input chroma subsample values. For example for the
  12379. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12380. @item ohsub
  12381. @item ovsub
  12382. horizontal and vertical output chroma subsample values. For example for the
  12383. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12384. @item n
  12385. The (sequential) number of the input frame, starting from 0.
  12386. Only available with @code{eval=frame}.
  12387. @item t
  12388. The presentation timestamp of the input frame, expressed as a number of
  12389. seconds. Only available with @code{eval=frame}.
  12390. @item pos
  12391. The position (byte offset) of the frame in the input stream, or NaN if
  12392. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12393. Only available with @code{eval=frame}.
  12394. @end table
  12395. @subsection Examples
  12396. @itemize
  12397. @item
  12398. Scale the input video to a size of 200x100
  12399. @example
  12400. scale=w=200:h=100
  12401. @end example
  12402. This is equivalent to:
  12403. @example
  12404. scale=200:100
  12405. @end example
  12406. or:
  12407. @example
  12408. scale=200x100
  12409. @end example
  12410. @item
  12411. Specify a size abbreviation for the output size:
  12412. @example
  12413. scale=qcif
  12414. @end example
  12415. which can also be written as:
  12416. @example
  12417. scale=size=qcif
  12418. @end example
  12419. @item
  12420. Scale the input to 2x:
  12421. @example
  12422. scale=w=2*iw:h=2*ih
  12423. @end example
  12424. @item
  12425. The above is the same as:
  12426. @example
  12427. scale=2*in_w:2*in_h
  12428. @end example
  12429. @item
  12430. Scale the input to 2x with forced interlaced scaling:
  12431. @example
  12432. scale=2*iw:2*ih:interl=1
  12433. @end example
  12434. @item
  12435. Scale the input to half size:
  12436. @example
  12437. scale=w=iw/2:h=ih/2
  12438. @end example
  12439. @item
  12440. Increase the width, and set the height to the same size:
  12441. @example
  12442. scale=3/2*iw:ow
  12443. @end example
  12444. @item
  12445. Seek Greek harmony:
  12446. @example
  12447. scale=iw:1/PHI*iw
  12448. scale=ih*PHI:ih
  12449. @end example
  12450. @item
  12451. Increase the height, and set the width to 3/2 of the height:
  12452. @example
  12453. scale=w=3/2*oh:h=3/5*ih
  12454. @end example
  12455. @item
  12456. Increase the size, making the size a multiple of the chroma
  12457. subsample values:
  12458. @example
  12459. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12460. @end example
  12461. @item
  12462. Increase the width to a maximum of 500 pixels,
  12463. keeping the same aspect ratio as the input:
  12464. @example
  12465. scale=w='min(500\, iw*3/2):h=-1'
  12466. @end example
  12467. @item
  12468. Make pixels square by combining scale and setsar:
  12469. @example
  12470. scale='trunc(ih*dar):ih',setsar=1/1
  12471. @end example
  12472. @item
  12473. Make pixels square by combining scale and setsar,
  12474. making sure the resulting resolution is even (required by some codecs):
  12475. @example
  12476. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12477. @end example
  12478. @end itemize
  12479. @subsection Commands
  12480. This filter supports the following commands:
  12481. @table @option
  12482. @item width, w
  12483. @item height, h
  12484. Set the output video dimension expression.
  12485. The command accepts the same syntax of the corresponding option.
  12486. If the specified expression is not valid, it is kept at its current
  12487. value.
  12488. @end table
  12489. @section scale_npp
  12490. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12491. format conversion on CUDA video frames. Setting the output width and height
  12492. works in the same way as for the @var{scale} filter.
  12493. The following additional options are accepted:
  12494. @table @option
  12495. @item format
  12496. The pixel format of the output CUDA frames. If set to the string "same" (the
  12497. default), the input format will be kept. Note that automatic format negotiation
  12498. and conversion is not yet supported for hardware frames
  12499. @item interp_algo
  12500. The interpolation algorithm used for resizing. One of the following:
  12501. @table @option
  12502. @item nn
  12503. Nearest neighbour.
  12504. @item linear
  12505. @item cubic
  12506. @item cubic2p_bspline
  12507. 2-parameter cubic (B=1, C=0)
  12508. @item cubic2p_catmullrom
  12509. 2-parameter cubic (B=0, C=1/2)
  12510. @item cubic2p_b05c03
  12511. 2-parameter cubic (B=1/2, C=3/10)
  12512. @item super
  12513. Supersampling
  12514. @item lanczos
  12515. @end table
  12516. @item force_original_aspect_ratio
  12517. Enable decreasing or increasing output video width or height if necessary to
  12518. keep the original aspect ratio. Possible values:
  12519. @table @samp
  12520. @item disable
  12521. Scale the video as specified and disable this feature.
  12522. @item decrease
  12523. The output video dimensions will automatically be decreased if needed.
  12524. @item increase
  12525. The output video dimensions will automatically be increased if needed.
  12526. @end table
  12527. One useful instance of this option is that when you know a specific device's
  12528. maximum allowed resolution, you can use this to limit the output video to
  12529. that, while retaining the aspect ratio. For example, device A allows
  12530. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12531. decrease) and specifying 1280x720 to the command line makes the output
  12532. 1280x533.
  12533. Please note that this is a different thing than specifying -1 for @option{w}
  12534. or @option{h}, you still need to specify the output resolution for this option
  12535. to work.
  12536. @item force_divisible_by
  12537. Ensures that both the output dimensions, width and height, are divisible by the
  12538. given integer when used together with @option{force_original_aspect_ratio}. This
  12539. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12540. This option respects the value set for @option{force_original_aspect_ratio},
  12541. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12542. may be slightly modified.
  12543. This option can be handy if you need to have a video fit within or exceed
  12544. a defined resolution using @option{force_original_aspect_ratio} but also have
  12545. encoder restrictions on width or height divisibility.
  12546. @end table
  12547. @section scale2ref
  12548. Scale (resize) the input video, based on a reference video.
  12549. See the scale filter for available options, scale2ref supports the same but
  12550. uses the reference video instead of the main input as basis. scale2ref also
  12551. supports the following additional constants for the @option{w} and
  12552. @option{h} options:
  12553. @table @var
  12554. @item main_w
  12555. @item main_h
  12556. The main input video's width and height
  12557. @item main_a
  12558. The same as @var{main_w} / @var{main_h}
  12559. @item main_sar
  12560. The main input video's sample aspect ratio
  12561. @item main_dar, mdar
  12562. The main input video's display aspect ratio. Calculated from
  12563. @code{(main_w / main_h) * main_sar}.
  12564. @item main_hsub
  12565. @item main_vsub
  12566. The main input video's horizontal and vertical chroma subsample values.
  12567. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12568. is 1.
  12569. @item main_n
  12570. The (sequential) number of the main input frame, starting from 0.
  12571. Only available with @code{eval=frame}.
  12572. @item main_t
  12573. The presentation timestamp of the main input frame, expressed as a number of
  12574. seconds. Only available with @code{eval=frame}.
  12575. @item main_pos
  12576. The position (byte offset) of the frame in the main input stream, or NaN if
  12577. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12578. Only available with @code{eval=frame}.
  12579. @end table
  12580. @subsection Examples
  12581. @itemize
  12582. @item
  12583. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12584. @example
  12585. 'scale2ref[b][a];[a][b]overlay'
  12586. @end example
  12587. @item
  12588. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12589. @example
  12590. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12591. @end example
  12592. @end itemize
  12593. @subsection Commands
  12594. This filter supports the following commands:
  12595. @table @option
  12596. @item width, w
  12597. @item height, h
  12598. Set the output video dimension expression.
  12599. The command accepts the same syntax of the corresponding option.
  12600. If the specified expression is not valid, it is kept at its current
  12601. value.
  12602. @end table
  12603. @section scroll
  12604. Scroll input video horizontally and/or vertically by constant speed.
  12605. The filter accepts the following options:
  12606. @table @option
  12607. @item horizontal, h
  12608. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12609. Negative values changes scrolling direction.
  12610. @item vertical, v
  12611. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12612. Negative values changes scrolling direction.
  12613. @item hpos
  12614. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12615. @item vpos
  12616. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12617. @end table
  12618. @subsection Commands
  12619. This filter supports the following @ref{commands}:
  12620. @table @option
  12621. @item horizontal, h
  12622. Set the horizontal scrolling speed.
  12623. @item vertical, v
  12624. Set the vertical scrolling speed.
  12625. @end table
  12626. @anchor{selectivecolor}
  12627. @section selectivecolor
  12628. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12629. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12630. by the "purity" of the color (that is, how saturated it already is).
  12631. This filter is similar to the Adobe Photoshop Selective Color tool.
  12632. The filter accepts the following options:
  12633. @table @option
  12634. @item correction_method
  12635. Select color correction method.
  12636. Available values are:
  12637. @table @samp
  12638. @item absolute
  12639. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12640. component value).
  12641. @item relative
  12642. Specified adjustments are relative to the original component value.
  12643. @end table
  12644. Default is @code{absolute}.
  12645. @item reds
  12646. Adjustments for red pixels (pixels where the red component is the maximum)
  12647. @item yellows
  12648. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12649. @item greens
  12650. Adjustments for green pixels (pixels where the green component is the maximum)
  12651. @item cyans
  12652. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12653. @item blues
  12654. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12655. @item magentas
  12656. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12657. @item whites
  12658. Adjustments for white pixels (pixels where all components are greater than 128)
  12659. @item neutrals
  12660. Adjustments for all pixels except pure black and pure white
  12661. @item blacks
  12662. Adjustments for black pixels (pixels where all components are lesser than 128)
  12663. @item psfile
  12664. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12665. @end table
  12666. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12667. 4 space separated floating point adjustment values in the [-1,1] range,
  12668. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12669. pixels of its range.
  12670. @subsection Examples
  12671. @itemize
  12672. @item
  12673. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12674. increase magenta by 27% in blue areas:
  12675. @example
  12676. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12677. @end example
  12678. @item
  12679. Use a Photoshop selective color preset:
  12680. @example
  12681. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12682. @end example
  12683. @end itemize
  12684. @anchor{separatefields}
  12685. @section separatefields
  12686. The @code{separatefields} takes a frame-based video input and splits
  12687. each frame into its components fields, producing a new half height clip
  12688. with twice the frame rate and twice the frame count.
  12689. This filter use field-dominance information in frame to decide which
  12690. of each pair of fields to place first in the output.
  12691. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12692. @section setdar, setsar
  12693. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12694. output video.
  12695. This is done by changing the specified Sample (aka Pixel) Aspect
  12696. Ratio, according to the following equation:
  12697. @example
  12698. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12699. @end example
  12700. Keep in mind that the @code{setdar} filter does not modify the pixel
  12701. dimensions of the video frame. Also, the display aspect ratio set by
  12702. this filter may be changed by later filters in the filterchain,
  12703. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12704. applied.
  12705. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12706. the filter output video.
  12707. Note that as a consequence of the application of this filter, the
  12708. output display aspect ratio will change according to the equation
  12709. above.
  12710. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12711. filter may be changed by later filters in the filterchain, e.g. if
  12712. another "setsar" or a "setdar" filter is applied.
  12713. It accepts the following parameters:
  12714. @table @option
  12715. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12716. Set the aspect ratio used by the filter.
  12717. The parameter can be a floating point number string, an expression, or
  12718. a string of the form @var{num}:@var{den}, where @var{num} and
  12719. @var{den} are the numerator and denominator of the aspect ratio. If
  12720. the parameter is not specified, it is assumed the value "0".
  12721. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12722. should be escaped.
  12723. @item max
  12724. Set the maximum integer value to use for expressing numerator and
  12725. denominator when reducing the expressed aspect ratio to a rational.
  12726. Default value is @code{100}.
  12727. @end table
  12728. The parameter @var{sar} is an expression containing
  12729. the following constants:
  12730. @table @option
  12731. @item E, PI, PHI
  12732. These are approximated values for the mathematical constants e
  12733. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12734. @item w, h
  12735. The input width and height.
  12736. @item a
  12737. These are the same as @var{w} / @var{h}.
  12738. @item sar
  12739. The input sample aspect ratio.
  12740. @item dar
  12741. The input display aspect ratio. It is the same as
  12742. (@var{w} / @var{h}) * @var{sar}.
  12743. @item hsub, vsub
  12744. Horizontal and vertical chroma subsample values. For example, for the
  12745. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12746. @end table
  12747. @subsection Examples
  12748. @itemize
  12749. @item
  12750. To change the display aspect ratio to 16:9, specify one of the following:
  12751. @example
  12752. setdar=dar=1.77777
  12753. setdar=dar=16/9
  12754. @end example
  12755. @item
  12756. To change the sample aspect ratio to 10:11, specify:
  12757. @example
  12758. setsar=sar=10/11
  12759. @end example
  12760. @item
  12761. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12762. 1000 in the aspect ratio reduction, use the command:
  12763. @example
  12764. setdar=ratio=16/9:max=1000
  12765. @end example
  12766. @end itemize
  12767. @anchor{setfield}
  12768. @section setfield
  12769. Force field for the output video frame.
  12770. The @code{setfield} filter marks the interlace type field for the
  12771. output frames. It does not change the input frame, but only sets the
  12772. corresponding property, which affects how the frame is treated by
  12773. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12774. The filter accepts the following options:
  12775. @table @option
  12776. @item mode
  12777. Available values are:
  12778. @table @samp
  12779. @item auto
  12780. Keep the same field property.
  12781. @item bff
  12782. Mark the frame as bottom-field-first.
  12783. @item tff
  12784. Mark the frame as top-field-first.
  12785. @item prog
  12786. Mark the frame as progressive.
  12787. @end table
  12788. @end table
  12789. @anchor{setparams}
  12790. @section setparams
  12791. Force frame parameter for the output video frame.
  12792. The @code{setparams} filter marks interlace and color range for the
  12793. output frames. It does not change the input frame, but only sets the
  12794. corresponding property, which affects how the frame is treated by
  12795. filters/encoders.
  12796. @table @option
  12797. @item field_mode
  12798. Available values are:
  12799. @table @samp
  12800. @item auto
  12801. Keep the same field property (default).
  12802. @item bff
  12803. Mark the frame as bottom-field-first.
  12804. @item tff
  12805. Mark the frame as top-field-first.
  12806. @item prog
  12807. Mark the frame as progressive.
  12808. @end table
  12809. @item range
  12810. Available values are:
  12811. @table @samp
  12812. @item auto
  12813. Keep the same color range property (default).
  12814. @item unspecified, unknown
  12815. Mark the frame as unspecified color range.
  12816. @item limited, tv, mpeg
  12817. Mark the frame as limited range.
  12818. @item full, pc, jpeg
  12819. Mark the frame as full range.
  12820. @end table
  12821. @item color_primaries
  12822. Set the color primaries.
  12823. Available values are:
  12824. @table @samp
  12825. @item auto
  12826. Keep the same color primaries property (default).
  12827. @item bt709
  12828. @item unknown
  12829. @item bt470m
  12830. @item bt470bg
  12831. @item smpte170m
  12832. @item smpte240m
  12833. @item film
  12834. @item bt2020
  12835. @item smpte428
  12836. @item smpte431
  12837. @item smpte432
  12838. @item jedec-p22
  12839. @end table
  12840. @item color_trc
  12841. Set the color transfer.
  12842. Available values are:
  12843. @table @samp
  12844. @item auto
  12845. Keep the same color trc property (default).
  12846. @item bt709
  12847. @item unknown
  12848. @item bt470m
  12849. @item bt470bg
  12850. @item smpte170m
  12851. @item smpte240m
  12852. @item linear
  12853. @item log100
  12854. @item log316
  12855. @item iec61966-2-4
  12856. @item bt1361e
  12857. @item iec61966-2-1
  12858. @item bt2020-10
  12859. @item bt2020-12
  12860. @item smpte2084
  12861. @item smpte428
  12862. @item arib-std-b67
  12863. @end table
  12864. @item colorspace
  12865. Set the colorspace.
  12866. Available values are:
  12867. @table @samp
  12868. @item auto
  12869. Keep the same colorspace property (default).
  12870. @item gbr
  12871. @item bt709
  12872. @item unknown
  12873. @item fcc
  12874. @item bt470bg
  12875. @item smpte170m
  12876. @item smpte240m
  12877. @item ycgco
  12878. @item bt2020nc
  12879. @item bt2020c
  12880. @item smpte2085
  12881. @item chroma-derived-nc
  12882. @item chroma-derived-c
  12883. @item ictcp
  12884. @end table
  12885. @end table
  12886. @section showinfo
  12887. Show a line containing various information for each input video frame.
  12888. The input video is not modified.
  12889. This filter supports the following options:
  12890. @table @option
  12891. @item checksum
  12892. Calculate checksums of each plane. By default enabled.
  12893. @end table
  12894. The shown line contains a sequence of key/value pairs of the form
  12895. @var{key}:@var{value}.
  12896. The following values are shown in the output:
  12897. @table @option
  12898. @item n
  12899. The (sequential) number of the input frame, starting from 0.
  12900. @item pts
  12901. The Presentation TimeStamp of the input frame, expressed as a number of
  12902. time base units. The time base unit depends on the filter input pad.
  12903. @item pts_time
  12904. The Presentation TimeStamp of the input frame, expressed as a number of
  12905. seconds.
  12906. @item pos
  12907. The position of the frame in the input stream, or -1 if this information is
  12908. unavailable and/or meaningless (for example in case of synthetic video).
  12909. @item fmt
  12910. The pixel format name.
  12911. @item sar
  12912. The sample aspect ratio of the input frame, expressed in the form
  12913. @var{num}/@var{den}.
  12914. @item s
  12915. The size of the input frame. For the syntax of this option, check the
  12916. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12917. @item i
  12918. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12919. for bottom field first).
  12920. @item iskey
  12921. This is 1 if the frame is a key frame, 0 otherwise.
  12922. @item type
  12923. The picture type of the input frame ("I" for an I-frame, "P" for a
  12924. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12925. Also refer to the documentation of the @code{AVPictureType} enum and of
  12926. the @code{av_get_picture_type_char} function defined in
  12927. @file{libavutil/avutil.h}.
  12928. @item checksum
  12929. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12930. @item plane_checksum
  12931. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12932. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12933. @item mean
  12934. The mean value of pixels in each plane of the input frame, expressed in the form
  12935. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  12936. @item stdev
  12937. The standard deviation of pixel values in each plane of the input frame, expressed
  12938. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  12939. @end table
  12940. @section showpalette
  12941. Displays the 256 colors palette of each frame. This filter is only relevant for
  12942. @var{pal8} pixel format frames.
  12943. It accepts the following option:
  12944. @table @option
  12945. @item s
  12946. Set the size of the box used to represent one palette color entry. Default is
  12947. @code{30} (for a @code{30x30} pixel box).
  12948. @end table
  12949. @section shuffleframes
  12950. Reorder and/or duplicate and/or drop video frames.
  12951. It accepts the following parameters:
  12952. @table @option
  12953. @item mapping
  12954. Set the destination indexes of input frames.
  12955. This is space or '|' separated list of indexes that maps input frames to output
  12956. frames. Number of indexes also sets maximal value that each index may have.
  12957. '-1' index have special meaning and that is to drop frame.
  12958. @end table
  12959. The first frame has the index 0. The default is to keep the input unchanged.
  12960. @subsection Examples
  12961. @itemize
  12962. @item
  12963. Swap second and third frame of every three frames of the input:
  12964. @example
  12965. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12966. @end example
  12967. @item
  12968. Swap 10th and 1st frame of every ten frames of the input:
  12969. @example
  12970. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12971. @end example
  12972. @end itemize
  12973. @section shuffleplanes
  12974. Reorder and/or duplicate video planes.
  12975. It accepts the following parameters:
  12976. @table @option
  12977. @item map0
  12978. The index of the input plane to be used as the first output plane.
  12979. @item map1
  12980. The index of the input plane to be used as the second output plane.
  12981. @item map2
  12982. The index of the input plane to be used as the third output plane.
  12983. @item map3
  12984. The index of the input plane to be used as the fourth output plane.
  12985. @end table
  12986. The first plane has the index 0. The default is to keep the input unchanged.
  12987. @subsection Examples
  12988. @itemize
  12989. @item
  12990. Swap the second and third planes of the input:
  12991. @example
  12992. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12993. @end example
  12994. @end itemize
  12995. @anchor{signalstats}
  12996. @section signalstats
  12997. Evaluate various visual metrics that assist in determining issues associated
  12998. with the digitization of analog video media.
  12999. By default the filter will log these metadata values:
  13000. @table @option
  13001. @item YMIN
  13002. Display the minimal Y value contained within the input frame. Expressed in
  13003. range of [0-255].
  13004. @item YLOW
  13005. Display the Y value at the 10% percentile within the input frame. Expressed in
  13006. range of [0-255].
  13007. @item YAVG
  13008. Display the average Y value within the input frame. Expressed in range of
  13009. [0-255].
  13010. @item YHIGH
  13011. Display the Y value at the 90% percentile within the input frame. Expressed in
  13012. range of [0-255].
  13013. @item YMAX
  13014. Display the maximum Y value contained within the input frame. Expressed in
  13015. range of [0-255].
  13016. @item UMIN
  13017. Display the minimal U value contained within the input frame. Expressed in
  13018. range of [0-255].
  13019. @item ULOW
  13020. Display the U value at the 10% percentile within the input frame. Expressed in
  13021. range of [0-255].
  13022. @item UAVG
  13023. Display the average U value within the input frame. Expressed in range of
  13024. [0-255].
  13025. @item UHIGH
  13026. Display the U value at the 90% percentile within the input frame. Expressed in
  13027. range of [0-255].
  13028. @item UMAX
  13029. Display the maximum U value contained within the input frame. Expressed in
  13030. range of [0-255].
  13031. @item VMIN
  13032. Display the minimal V value contained within the input frame. Expressed in
  13033. range of [0-255].
  13034. @item VLOW
  13035. Display the V value at the 10% percentile within the input frame. Expressed in
  13036. range of [0-255].
  13037. @item VAVG
  13038. Display the average V value within the input frame. Expressed in range of
  13039. [0-255].
  13040. @item VHIGH
  13041. Display the V value at the 90% percentile within the input frame. Expressed in
  13042. range of [0-255].
  13043. @item VMAX
  13044. Display the maximum V value contained within the input frame. Expressed in
  13045. range of [0-255].
  13046. @item SATMIN
  13047. Display the minimal saturation value contained within the input frame.
  13048. Expressed in range of [0-~181.02].
  13049. @item SATLOW
  13050. Display the saturation value at the 10% percentile within the input frame.
  13051. Expressed in range of [0-~181.02].
  13052. @item SATAVG
  13053. Display the average saturation value within the input frame. Expressed in range
  13054. of [0-~181.02].
  13055. @item SATHIGH
  13056. Display the saturation value at the 90% percentile within the input frame.
  13057. Expressed in range of [0-~181.02].
  13058. @item SATMAX
  13059. Display the maximum saturation value contained within the input frame.
  13060. Expressed in range of [0-~181.02].
  13061. @item HUEMED
  13062. Display the median value for hue within the input frame. Expressed in range of
  13063. [0-360].
  13064. @item HUEAVG
  13065. Display the average value for hue within the input frame. Expressed in range of
  13066. [0-360].
  13067. @item YDIF
  13068. Display the average of sample value difference between all values of the Y
  13069. plane in the current frame and corresponding values of the previous input frame.
  13070. Expressed in range of [0-255].
  13071. @item UDIF
  13072. Display the average of sample value difference between all values of the U
  13073. plane in the current frame and corresponding values of the previous input frame.
  13074. Expressed in range of [0-255].
  13075. @item VDIF
  13076. Display the average of sample value difference between all values of the V
  13077. plane in the current frame and corresponding values of the previous input frame.
  13078. Expressed in range of [0-255].
  13079. @item YBITDEPTH
  13080. Display bit depth of Y plane in current frame.
  13081. Expressed in range of [0-16].
  13082. @item UBITDEPTH
  13083. Display bit depth of U plane in current frame.
  13084. Expressed in range of [0-16].
  13085. @item VBITDEPTH
  13086. Display bit depth of V plane in current frame.
  13087. Expressed in range of [0-16].
  13088. @end table
  13089. The filter accepts the following options:
  13090. @table @option
  13091. @item stat
  13092. @item out
  13093. @option{stat} specify an additional form of image analysis.
  13094. @option{out} output video with the specified type of pixel highlighted.
  13095. Both options accept the following values:
  13096. @table @samp
  13097. @item tout
  13098. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  13099. unlike the neighboring pixels of the same field. Examples of temporal outliers
  13100. include the results of video dropouts, head clogs, or tape tracking issues.
  13101. @item vrep
  13102. Identify @var{vertical line repetition}. Vertical line repetition includes
  13103. similar rows of pixels within a frame. In born-digital video vertical line
  13104. repetition is common, but this pattern is uncommon in video digitized from an
  13105. analog source. When it occurs in video that results from the digitization of an
  13106. analog source it can indicate concealment from a dropout compensator.
  13107. @item brng
  13108. Identify pixels that fall outside of legal broadcast range.
  13109. @end table
  13110. @item color, c
  13111. Set the highlight color for the @option{out} option. The default color is
  13112. yellow.
  13113. @end table
  13114. @subsection Examples
  13115. @itemize
  13116. @item
  13117. Output data of various video metrics:
  13118. @example
  13119. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  13120. @end example
  13121. @item
  13122. Output specific data about the minimum and maximum values of the Y plane per frame:
  13123. @example
  13124. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  13125. @end example
  13126. @item
  13127. Playback video while highlighting pixels that are outside of broadcast range in red.
  13128. @example
  13129. ffplay example.mov -vf signalstats="out=brng:color=red"
  13130. @end example
  13131. @item
  13132. Playback video with signalstats metadata drawn over the frame.
  13133. @example
  13134. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  13135. @end example
  13136. The contents of signalstat_drawtext.txt used in the command are:
  13137. @example
  13138. time %@{pts:hms@}
  13139. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  13140. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  13141. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  13142. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  13143. @end example
  13144. @end itemize
  13145. @anchor{signature}
  13146. @section signature
  13147. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  13148. input. In this case the matching between the inputs can be calculated additionally.
  13149. The filter always passes through the first input. The signature of each stream can
  13150. be written into a file.
  13151. It accepts the following options:
  13152. @table @option
  13153. @item detectmode
  13154. Enable or disable the matching process.
  13155. Available values are:
  13156. @table @samp
  13157. @item off
  13158. Disable the calculation of a matching (default).
  13159. @item full
  13160. Calculate the matching for the whole video and output whether the whole video
  13161. matches or only parts.
  13162. @item fast
  13163. Calculate only until a matching is found or the video ends. Should be faster in
  13164. some cases.
  13165. @end table
  13166. @item nb_inputs
  13167. Set the number of inputs. The option value must be a non negative integer.
  13168. Default value is 1.
  13169. @item filename
  13170. Set the path to which the output is written. If there is more than one input,
  13171. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  13172. integer), that will be replaced with the input number. If no filename is
  13173. specified, no output will be written. This is the default.
  13174. @item format
  13175. Choose the output format.
  13176. Available values are:
  13177. @table @samp
  13178. @item binary
  13179. Use the specified binary representation (default).
  13180. @item xml
  13181. Use the specified xml representation.
  13182. @end table
  13183. @item th_d
  13184. Set threshold to detect one word as similar. The option value must be an integer
  13185. greater than zero. The default value is 9000.
  13186. @item th_dc
  13187. Set threshold to detect all words as similar. The option value must be an integer
  13188. greater than zero. The default value is 60000.
  13189. @item th_xh
  13190. Set threshold to detect frames as similar. The option value must be an integer
  13191. greater than zero. The default value is 116.
  13192. @item th_di
  13193. Set the minimum length of a sequence in frames to recognize it as matching
  13194. sequence. The option value must be a non negative integer value.
  13195. The default value is 0.
  13196. @item th_it
  13197. Set the minimum relation, that matching frames to all frames must have.
  13198. The option value must be a double value between 0 and 1. The default value is 0.5.
  13199. @end table
  13200. @subsection Examples
  13201. @itemize
  13202. @item
  13203. To calculate the signature of an input video and store it in signature.bin:
  13204. @example
  13205. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13206. @end example
  13207. @item
  13208. To detect whether two videos match and store the signatures in XML format in
  13209. signature0.xml and signature1.xml:
  13210. @example
  13211. 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 -
  13212. @end example
  13213. @end itemize
  13214. @anchor{smartblur}
  13215. @section smartblur
  13216. Blur the input video without impacting the outlines.
  13217. It accepts the following options:
  13218. @table @option
  13219. @item luma_radius, lr
  13220. Set the luma radius. The option value must be a float number in
  13221. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13222. used to blur the image (slower if larger). Default value is 1.0.
  13223. @item luma_strength, ls
  13224. Set the luma strength. The option value must be a float number
  13225. in the range [-1.0,1.0] that configures the blurring. A value included
  13226. in [0.0,1.0] will blur the image whereas a value included in
  13227. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13228. @item luma_threshold, lt
  13229. Set the luma threshold used as a coefficient to determine
  13230. whether a pixel should be blurred or not. The option value must be an
  13231. integer in the range [-30,30]. A value of 0 will filter all the image,
  13232. a value included in [0,30] will filter flat areas and a value included
  13233. in [-30,0] will filter edges. Default value is 0.
  13234. @item chroma_radius, cr
  13235. Set the chroma radius. The option value must be a float number in
  13236. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13237. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13238. @item chroma_strength, cs
  13239. Set the chroma strength. The option value must be a float number
  13240. in the range [-1.0,1.0] that configures the blurring. A value included
  13241. in [0.0,1.0] will blur the image whereas a value included in
  13242. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13243. @item chroma_threshold, ct
  13244. Set the chroma threshold used as a coefficient to determine
  13245. whether a pixel should be blurred or not. The option value must be an
  13246. integer in the range [-30,30]. A value of 0 will filter all the image,
  13247. a value included in [0,30] will filter flat areas and a value included
  13248. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13249. @end table
  13250. If a chroma option is not explicitly set, the corresponding luma value
  13251. is set.
  13252. @section sobel
  13253. Apply sobel operator to input video stream.
  13254. The filter accepts the following option:
  13255. @table @option
  13256. @item planes
  13257. Set which planes will be processed, unprocessed planes will be copied.
  13258. By default value 0xf, all planes will be processed.
  13259. @item scale
  13260. Set value which will be multiplied with filtered result.
  13261. @item delta
  13262. Set value which will be added to filtered result.
  13263. @end table
  13264. @anchor{spp}
  13265. @section spp
  13266. Apply a simple postprocessing filter that compresses and decompresses the image
  13267. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13268. and average the results.
  13269. The filter accepts the following options:
  13270. @table @option
  13271. @item quality
  13272. Set quality. This option defines the number of levels for averaging. It accepts
  13273. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13274. effect. A value of @code{6} means the higher quality. For each increment of
  13275. that value the speed drops by a factor of approximately 2. Default value is
  13276. @code{3}.
  13277. @item qp
  13278. Force a constant quantization parameter. If not set, the filter will use the QP
  13279. from the video stream (if available).
  13280. @item mode
  13281. Set thresholding mode. Available modes are:
  13282. @table @samp
  13283. @item hard
  13284. Set hard thresholding (default).
  13285. @item soft
  13286. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13287. @end table
  13288. @item use_bframe_qp
  13289. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13290. option may cause flicker since the B-Frames have often larger QP. Default is
  13291. @code{0} (not enabled).
  13292. @end table
  13293. @subsection Commands
  13294. This filter supports the following commands:
  13295. @table @option
  13296. @item quality, level
  13297. Set quality level. The value @code{max} can be used to set the maximum level,
  13298. currently @code{6}.
  13299. @end table
  13300. @anchor{sr}
  13301. @section sr
  13302. Scale the input by applying one of the super-resolution methods based on
  13303. convolutional neural networks. Supported models:
  13304. @itemize
  13305. @item
  13306. Super-Resolution Convolutional Neural Network model (SRCNN).
  13307. See @url{https://arxiv.org/abs/1501.00092}.
  13308. @item
  13309. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13310. See @url{https://arxiv.org/abs/1609.05158}.
  13311. @end itemize
  13312. Training scripts as well as scripts for model file (.pb) saving can be found at
  13313. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13314. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13315. Native model files (.model) can be generated from TensorFlow model
  13316. files (.pb) by using tools/python/convert.py
  13317. The filter accepts the following options:
  13318. @table @option
  13319. @item dnn_backend
  13320. Specify which DNN backend to use for model loading and execution. This option accepts
  13321. the following values:
  13322. @table @samp
  13323. @item native
  13324. Native implementation of DNN loading and execution.
  13325. @item tensorflow
  13326. TensorFlow backend. To enable this backend you
  13327. need to install the TensorFlow for C library (see
  13328. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13329. @code{--enable-libtensorflow}
  13330. @end table
  13331. Default value is @samp{native}.
  13332. @item model
  13333. Set path to model file specifying network architecture and its parameters.
  13334. Note that different backends use different file formats. TensorFlow backend
  13335. can load files for both formats, while native backend can load files for only
  13336. its format.
  13337. @item scale_factor
  13338. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13339. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13340. input upscaled using bicubic upscaling with proper scale factor.
  13341. @end table
  13342. This feature can also be finished with @ref{dnn_processing} filter.
  13343. @section ssim
  13344. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13345. This filter takes in input two input videos, the first input is
  13346. considered the "main" source and is passed unchanged to the
  13347. output. The second input is used as a "reference" video for computing
  13348. the SSIM.
  13349. Both video inputs must have the same resolution and pixel format for
  13350. this filter to work correctly. Also it assumes that both inputs
  13351. have the same number of frames, which are compared one by one.
  13352. The filter stores the calculated SSIM of each frame.
  13353. The description of the accepted parameters follows.
  13354. @table @option
  13355. @item stats_file, f
  13356. If specified the filter will use the named file to save the SSIM of
  13357. each individual frame. When filename equals "-" the data is sent to
  13358. standard output.
  13359. @end table
  13360. The file printed if @var{stats_file} is selected, contains a sequence of
  13361. key/value pairs of the form @var{key}:@var{value} for each compared
  13362. couple of frames.
  13363. A description of each shown parameter follows:
  13364. @table @option
  13365. @item n
  13366. sequential number of the input frame, starting from 1
  13367. @item Y, U, V, R, G, B
  13368. SSIM of the compared frames for the component specified by the suffix.
  13369. @item All
  13370. SSIM of the compared frames for the whole frame.
  13371. @item dB
  13372. Same as above but in dB representation.
  13373. @end table
  13374. This filter also supports the @ref{framesync} options.
  13375. @subsection Examples
  13376. @itemize
  13377. @item
  13378. For example:
  13379. @example
  13380. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13381. [main][ref] ssim="stats_file=stats.log" [out]
  13382. @end example
  13383. On this example the input file being processed is compared with the
  13384. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  13385. is stored in @file{stats.log}.
  13386. @item
  13387. Another example with both psnr and ssim at same time:
  13388. @example
  13389. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  13390. @end example
  13391. @item
  13392. Another example with different containers:
  13393. @example
  13394. 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 -
  13395. @end example
  13396. @end itemize
  13397. @section stereo3d
  13398. Convert between different stereoscopic image formats.
  13399. The filters accept the following options:
  13400. @table @option
  13401. @item in
  13402. Set stereoscopic image format of input.
  13403. Available values for input image formats are:
  13404. @table @samp
  13405. @item sbsl
  13406. side by side parallel (left eye left, right eye right)
  13407. @item sbsr
  13408. side by side crosseye (right eye left, left eye right)
  13409. @item sbs2l
  13410. side by side parallel with half width resolution
  13411. (left eye left, right eye right)
  13412. @item sbs2r
  13413. side by side crosseye with half width resolution
  13414. (right eye left, left eye right)
  13415. @item abl
  13416. @item tbl
  13417. above-below (left eye above, right eye below)
  13418. @item abr
  13419. @item tbr
  13420. above-below (right eye above, left eye below)
  13421. @item ab2l
  13422. @item tb2l
  13423. above-below with half height resolution
  13424. (left eye above, right eye below)
  13425. @item ab2r
  13426. @item tb2r
  13427. above-below with half height resolution
  13428. (right eye above, left eye below)
  13429. @item al
  13430. alternating frames (left eye first, right eye second)
  13431. @item ar
  13432. alternating frames (right eye first, left eye second)
  13433. @item irl
  13434. interleaved rows (left eye has top row, right eye starts on next row)
  13435. @item irr
  13436. interleaved rows (right eye has top row, left eye starts on next row)
  13437. @item icl
  13438. interleaved columns, left eye first
  13439. @item icr
  13440. interleaved columns, right eye first
  13441. Default value is @samp{sbsl}.
  13442. @end table
  13443. @item out
  13444. Set stereoscopic image format of output.
  13445. @table @samp
  13446. @item sbsl
  13447. side by side parallel (left eye left, right eye right)
  13448. @item sbsr
  13449. side by side crosseye (right eye left, left eye right)
  13450. @item sbs2l
  13451. side by side parallel with half width resolution
  13452. (left eye left, right eye right)
  13453. @item sbs2r
  13454. side by side crosseye with half width resolution
  13455. (right eye left, left eye right)
  13456. @item abl
  13457. @item tbl
  13458. above-below (left eye above, right eye below)
  13459. @item abr
  13460. @item tbr
  13461. above-below (right eye above, left eye below)
  13462. @item ab2l
  13463. @item tb2l
  13464. above-below with half height resolution
  13465. (left eye above, right eye below)
  13466. @item ab2r
  13467. @item tb2r
  13468. above-below with half height resolution
  13469. (right eye above, left eye below)
  13470. @item al
  13471. alternating frames (left eye first, right eye second)
  13472. @item ar
  13473. alternating frames (right eye first, left eye second)
  13474. @item irl
  13475. interleaved rows (left eye has top row, right eye starts on next row)
  13476. @item irr
  13477. interleaved rows (right eye has top row, left eye starts on next row)
  13478. @item arbg
  13479. anaglyph red/blue gray
  13480. (red filter on left eye, blue filter on right eye)
  13481. @item argg
  13482. anaglyph red/green gray
  13483. (red filter on left eye, green filter on right eye)
  13484. @item arcg
  13485. anaglyph red/cyan gray
  13486. (red filter on left eye, cyan filter on right eye)
  13487. @item arch
  13488. anaglyph red/cyan half colored
  13489. (red filter on left eye, cyan filter on right eye)
  13490. @item arcc
  13491. anaglyph red/cyan color
  13492. (red filter on left eye, cyan filter on right eye)
  13493. @item arcd
  13494. anaglyph red/cyan color optimized with the least squares projection of dubois
  13495. (red filter on left eye, cyan filter on right eye)
  13496. @item agmg
  13497. anaglyph green/magenta gray
  13498. (green filter on left eye, magenta filter on right eye)
  13499. @item agmh
  13500. anaglyph green/magenta half colored
  13501. (green filter on left eye, magenta filter on right eye)
  13502. @item agmc
  13503. anaglyph green/magenta colored
  13504. (green filter on left eye, magenta filter on right eye)
  13505. @item agmd
  13506. anaglyph green/magenta color optimized with the least squares projection of dubois
  13507. (green filter on left eye, magenta filter on right eye)
  13508. @item aybg
  13509. anaglyph yellow/blue gray
  13510. (yellow filter on left eye, blue filter on right eye)
  13511. @item aybh
  13512. anaglyph yellow/blue half colored
  13513. (yellow filter on left eye, blue filter on right eye)
  13514. @item aybc
  13515. anaglyph yellow/blue colored
  13516. (yellow filter on left eye, blue filter on right eye)
  13517. @item aybd
  13518. anaglyph yellow/blue color optimized with the least squares projection of dubois
  13519. (yellow filter on left eye, blue filter on right eye)
  13520. @item ml
  13521. mono output (left eye only)
  13522. @item mr
  13523. mono output (right eye only)
  13524. @item chl
  13525. checkerboard, left eye first
  13526. @item chr
  13527. checkerboard, right eye first
  13528. @item icl
  13529. interleaved columns, left eye first
  13530. @item icr
  13531. interleaved columns, right eye first
  13532. @item hdmi
  13533. HDMI frame pack
  13534. @end table
  13535. Default value is @samp{arcd}.
  13536. @end table
  13537. @subsection Examples
  13538. @itemize
  13539. @item
  13540. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  13541. @example
  13542. stereo3d=sbsl:aybd
  13543. @end example
  13544. @item
  13545. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  13546. @example
  13547. stereo3d=abl:sbsr
  13548. @end example
  13549. @end itemize
  13550. @section streamselect, astreamselect
  13551. Select video or audio streams.
  13552. The filter accepts the following options:
  13553. @table @option
  13554. @item inputs
  13555. Set number of inputs. Default is 2.
  13556. @item map
  13557. Set input indexes to remap to outputs.
  13558. @end table
  13559. @subsection Commands
  13560. The @code{streamselect} and @code{astreamselect} filter supports the following
  13561. commands:
  13562. @table @option
  13563. @item map
  13564. Set input indexes to remap to outputs.
  13565. @end table
  13566. @subsection Examples
  13567. @itemize
  13568. @item
  13569. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13570. @example
  13571. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13572. @end example
  13573. @item
  13574. Same as above, but for audio:
  13575. @example
  13576. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13577. @end example
  13578. @end itemize
  13579. @anchor{subtitles}
  13580. @section subtitles
  13581. Draw subtitles on top of input video using the libass library.
  13582. To enable compilation of this filter you need to configure FFmpeg with
  13583. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13584. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13585. Alpha) subtitles format.
  13586. The filter accepts the following options:
  13587. @table @option
  13588. @item filename, f
  13589. Set the filename of the subtitle file to read. It must be specified.
  13590. @item original_size
  13591. Specify the size of the original video, the video for which the ASS file
  13592. was composed. For the syntax of this option, check the
  13593. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13594. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13595. correctly scale the fonts if the aspect ratio has been changed.
  13596. @item fontsdir
  13597. Set a directory path containing fonts that can be used by the filter.
  13598. These fonts will be used in addition to whatever the font provider uses.
  13599. @item alpha
  13600. Process alpha channel, by default alpha channel is untouched.
  13601. @item charenc
  13602. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13603. useful if not UTF-8.
  13604. @item stream_index, si
  13605. Set subtitles stream index. @code{subtitles} filter only.
  13606. @item force_style
  13607. Override default style or script info parameters of the subtitles. It accepts a
  13608. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13609. @end table
  13610. If the first key is not specified, it is assumed that the first value
  13611. specifies the @option{filename}.
  13612. For example, to render the file @file{sub.srt} on top of the input
  13613. video, use the command:
  13614. @example
  13615. subtitles=sub.srt
  13616. @end example
  13617. which is equivalent to:
  13618. @example
  13619. subtitles=filename=sub.srt
  13620. @end example
  13621. To render the default subtitles stream from file @file{video.mkv}, use:
  13622. @example
  13623. subtitles=video.mkv
  13624. @end example
  13625. To render the second subtitles stream from that file, use:
  13626. @example
  13627. subtitles=video.mkv:si=1
  13628. @end example
  13629. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13630. @code{DejaVu Serif}, use:
  13631. @example
  13632. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13633. @end example
  13634. @section super2xsai
  13635. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13636. Interpolate) pixel art scaling algorithm.
  13637. Useful for enlarging pixel art images without reducing sharpness.
  13638. @section swaprect
  13639. Swap two rectangular objects in video.
  13640. This filter accepts the following options:
  13641. @table @option
  13642. @item w
  13643. Set object width.
  13644. @item h
  13645. Set object height.
  13646. @item x1
  13647. Set 1st rect x coordinate.
  13648. @item y1
  13649. Set 1st rect y coordinate.
  13650. @item x2
  13651. Set 2nd rect x coordinate.
  13652. @item y2
  13653. Set 2nd rect y coordinate.
  13654. All expressions are evaluated once for each frame.
  13655. @end table
  13656. The all options are expressions containing the following constants:
  13657. @table @option
  13658. @item w
  13659. @item h
  13660. The input width and height.
  13661. @item a
  13662. same as @var{w} / @var{h}
  13663. @item sar
  13664. input sample aspect ratio
  13665. @item dar
  13666. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13667. @item n
  13668. The number of the input frame, starting from 0.
  13669. @item t
  13670. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13671. @item pos
  13672. the position in the file of the input frame, NAN if unknown
  13673. @end table
  13674. @section swapuv
  13675. Swap U & V plane.
  13676. @section tblend
  13677. Blend successive video frames.
  13678. See @ref{blend}
  13679. @section telecine
  13680. Apply telecine process to the video.
  13681. This filter accepts the following options:
  13682. @table @option
  13683. @item first_field
  13684. @table @samp
  13685. @item top, t
  13686. top field first
  13687. @item bottom, b
  13688. bottom field first
  13689. The default value is @code{top}.
  13690. @end table
  13691. @item pattern
  13692. A string of numbers representing the pulldown pattern you wish to apply.
  13693. The default value is @code{23}.
  13694. @end table
  13695. @example
  13696. Some typical patterns:
  13697. NTSC output (30i):
  13698. 27.5p: 32222
  13699. 24p: 23 (classic)
  13700. 24p: 2332 (preferred)
  13701. 20p: 33
  13702. 18p: 334
  13703. 16p: 3444
  13704. PAL output (25i):
  13705. 27.5p: 12222
  13706. 24p: 222222222223 ("Euro pulldown")
  13707. 16.67p: 33
  13708. 16p: 33333334
  13709. @end example
  13710. @section thistogram
  13711. Compute and draw a color distribution histogram for the input video across time.
  13712. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  13713. at certain time, this filter shows also past histograms of number of frames defined
  13714. by @code{width} option.
  13715. The computed histogram is a representation of the color component
  13716. distribution in an image.
  13717. The filter accepts the following options:
  13718. @table @option
  13719. @item width, w
  13720. Set width of single color component output. Default value is @code{0}.
  13721. Value of @code{0} means width will be picked from input video.
  13722. This also set number of passed histograms to keep.
  13723. Allowed range is [0, 8192].
  13724. @item display_mode, d
  13725. Set display mode.
  13726. It accepts the following values:
  13727. @table @samp
  13728. @item stack
  13729. Per color component graphs are placed below each other.
  13730. @item parade
  13731. Per color component graphs are placed side by side.
  13732. @item overlay
  13733. Presents information identical to that in the @code{parade}, except
  13734. that the graphs representing color components are superimposed directly
  13735. over one another.
  13736. @end table
  13737. Default is @code{stack}.
  13738. @item levels_mode, m
  13739. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  13740. Default is @code{linear}.
  13741. @item components, c
  13742. Set what color components to display.
  13743. Default is @code{7}.
  13744. @item bgopacity, b
  13745. Set background opacity. Default is @code{0.9}.
  13746. @item envelope, e
  13747. Show envelope. Default is disabled.
  13748. @item ecolor, ec
  13749. Set envelope color. Default is @code{gold}.
  13750. @end table
  13751. @section threshold
  13752. Apply threshold effect to video stream.
  13753. This filter needs four video streams to perform thresholding.
  13754. First stream is stream we are filtering.
  13755. Second stream is holding threshold values, third stream is holding min values,
  13756. and last, fourth stream is holding max values.
  13757. The filter accepts the following option:
  13758. @table @option
  13759. @item planes
  13760. Set which planes will be processed, unprocessed planes will be copied.
  13761. By default value 0xf, all planes will be processed.
  13762. @end table
  13763. For example if first stream pixel's component value is less then threshold value
  13764. of pixel component from 2nd threshold stream, third stream value will picked,
  13765. otherwise fourth stream pixel component value will be picked.
  13766. Using color source filter one can perform various types of thresholding:
  13767. @subsection Examples
  13768. @itemize
  13769. @item
  13770. Binary threshold, using gray color as threshold:
  13771. @example
  13772. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13773. @end example
  13774. @item
  13775. Inverted binary threshold, using gray color as threshold:
  13776. @example
  13777. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13778. @end example
  13779. @item
  13780. Truncate binary threshold, using gray color as threshold:
  13781. @example
  13782. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13783. @end example
  13784. @item
  13785. Threshold to zero, using gray color as threshold:
  13786. @example
  13787. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13788. @end example
  13789. @item
  13790. Inverted threshold to zero, using gray color as threshold:
  13791. @example
  13792. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13793. @end example
  13794. @end itemize
  13795. @section thumbnail
  13796. Select the most representative frame in a given sequence of consecutive frames.
  13797. The filter accepts the following options:
  13798. @table @option
  13799. @item n
  13800. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13801. will pick one of them, and then handle the next batch of @var{n} frames until
  13802. the end. Default is @code{100}.
  13803. @end table
  13804. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13805. value will result in a higher memory usage, so a high value is not recommended.
  13806. @subsection Examples
  13807. @itemize
  13808. @item
  13809. Extract one picture each 50 frames:
  13810. @example
  13811. thumbnail=50
  13812. @end example
  13813. @item
  13814. Complete example of a thumbnail creation with @command{ffmpeg}:
  13815. @example
  13816. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13817. @end example
  13818. @end itemize
  13819. @section tile
  13820. Tile several successive frames together.
  13821. The filter accepts the following options:
  13822. @table @option
  13823. @item layout
  13824. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13825. this option, check the
  13826. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13827. @item nb_frames
  13828. Set the maximum number of frames to render in the given area. It must be less
  13829. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13830. the area will be used.
  13831. @item margin
  13832. Set the outer border margin in pixels.
  13833. @item padding
  13834. Set the inner border thickness (i.e. the number of pixels between frames). For
  13835. more advanced padding options (such as having different values for the edges),
  13836. refer to the pad video filter.
  13837. @item color
  13838. Specify the color of the unused area. For the syntax of this option, check the
  13839. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13840. The default value of @var{color} is "black".
  13841. @item overlap
  13842. Set the number of frames to overlap when tiling several successive frames together.
  13843. The value must be between @code{0} and @var{nb_frames - 1}.
  13844. @item init_padding
  13845. Set the number of frames to initially be empty before displaying first output frame.
  13846. This controls how soon will one get first output frame.
  13847. The value must be between @code{0} and @var{nb_frames - 1}.
  13848. @end table
  13849. @subsection Examples
  13850. @itemize
  13851. @item
  13852. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13853. @example
  13854. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13855. @end example
  13856. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13857. duplicating each output frame to accommodate the originally detected frame
  13858. rate.
  13859. @item
  13860. Display @code{5} pictures in an area of @code{3x2} frames,
  13861. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13862. mixed flat and named options:
  13863. @example
  13864. tile=3x2:nb_frames=5:padding=7:margin=2
  13865. @end example
  13866. @end itemize
  13867. @section tinterlace
  13868. Perform various types of temporal field interlacing.
  13869. Frames are counted starting from 1, so the first input frame is
  13870. considered odd.
  13871. The filter accepts the following options:
  13872. @table @option
  13873. @item mode
  13874. Specify the mode of the interlacing. This option can also be specified
  13875. as a value alone. See below for a list of values for this option.
  13876. Available values are:
  13877. @table @samp
  13878. @item merge, 0
  13879. Move odd frames into the upper field, even into the lower field,
  13880. generating a double height frame at half frame rate.
  13881. @example
  13882. ------> time
  13883. Input:
  13884. Frame 1 Frame 2 Frame 3 Frame 4
  13885. 11111 22222 33333 44444
  13886. 11111 22222 33333 44444
  13887. 11111 22222 33333 44444
  13888. 11111 22222 33333 44444
  13889. Output:
  13890. 11111 33333
  13891. 22222 44444
  13892. 11111 33333
  13893. 22222 44444
  13894. 11111 33333
  13895. 22222 44444
  13896. 11111 33333
  13897. 22222 44444
  13898. @end example
  13899. @item drop_even, 1
  13900. Only output odd frames, even frames are dropped, generating a frame with
  13901. unchanged height at half frame rate.
  13902. @example
  13903. ------> time
  13904. Input:
  13905. Frame 1 Frame 2 Frame 3 Frame 4
  13906. 11111 22222 33333 44444
  13907. 11111 22222 33333 44444
  13908. 11111 22222 33333 44444
  13909. 11111 22222 33333 44444
  13910. Output:
  13911. 11111 33333
  13912. 11111 33333
  13913. 11111 33333
  13914. 11111 33333
  13915. @end example
  13916. @item drop_odd, 2
  13917. Only output even frames, odd frames are dropped, generating a frame with
  13918. unchanged height at half frame rate.
  13919. @example
  13920. ------> time
  13921. Input:
  13922. Frame 1 Frame 2 Frame 3 Frame 4
  13923. 11111 22222 33333 44444
  13924. 11111 22222 33333 44444
  13925. 11111 22222 33333 44444
  13926. 11111 22222 33333 44444
  13927. Output:
  13928. 22222 44444
  13929. 22222 44444
  13930. 22222 44444
  13931. 22222 44444
  13932. @end example
  13933. @item pad, 3
  13934. Expand each frame to full height, but pad alternate lines with black,
  13935. generating a frame with double height at the same input frame rate.
  13936. @example
  13937. ------> time
  13938. Input:
  13939. Frame 1 Frame 2 Frame 3 Frame 4
  13940. 11111 22222 33333 44444
  13941. 11111 22222 33333 44444
  13942. 11111 22222 33333 44444
  13943. 11111 22222 33333 44444
  13944. Output:
  13945. 11111 ..... 33333 .....
  13946. ..... 22222 ..... 44444
  13947. 11111 ..... 33333 .....
  13948. ..... 22222 ..... 44444
  13949. 11111 ..... 33333 .....
  13950. ..... 22222 ..... 44444
  13951. 11111 ..... 33333 .....
  13952. ..... 22222 ..... 44444
  13953. @end example
  13954. @item interleave_top, 4
  13955. Interleave the upper field from odd frames with the lower field from
  13956. even frames, generating a frame with unchanged height at half frame rate.
  13957. @example
  13958. ------> time
  13959. Input:
  13960. Frame 1 Frame 2 Frame 3 Frame 4
  13961. 11111<- 22222 33333<- 44444
  13962. 11111 22222<- 33333 44444<-
  13963. 11111<- 22222 33333<- 44444
  13964. 11111 22222<- 33333 44444<-
  13965. Output:
  13966. 11111 33333
  13967. 22222 44444
  13968. 11111 33333
  13969. 22222 44444
  13970. @end example
  13971. @item interleave_bottom, 5
  13972. Interleave the lower field from odd frames with the upper field from
  13973. even frames, generating a frame with unchanged height at half frame rate.
  13974. @example
  13975. ------> time
  13976. Input:
  13977. Frame 1 Frame 2 Frame 3 Frame 4
  13978. 11111 22222<- 33333 44444<-
  13979. 11111<- 22222 33333<- 44444
  13980. 11111 22222<- 33333 44444<-
  13981. 11111<- 22222 33333<- 44444
  13982. Output:
  13983. 22222 44444
  13984. 11111 33333
  13985. 22222 44444
  13986. 11111 33333
  13987. @end example
  13988. @item interlacex2, 6
  13989. Double frame rate with unchanged height. Frames are inserted each
  13990. containing the second temporal field from the previous input frame and
  13991. the first temporal field from the next input frame. This mode relies on
  13992. the top_field_first flag. Useful for interlaced video displays with no
  13993. field synchronisation.
  13994. @example
  13995. ------> time
  13996. Input:
  13997. Frame 1 Frame 2 Frame 3 Frame 4
  13998. 11111 22222 33333 44444
  13999. 11111 22222 33333 44444
  14000. 11111 22222 33333 44444
  14001. 11111 22222 33333 44444
  14002. Output:
  14003. 11111 22222 22222 33333 33333 44444 44444
  14004. 11111 11111 22222 22222 33333 33333 44444
  14005. 11111 22222 22222 33333 33333 44444 44444
  14006. 11111 11111 22222 22222 33333 33333 44444
  14007. @end example
  14008. @item mergex2, 7
  14009. Move odd frames into the upper field, even into the lower field,
  14010. generating a double height frame at same frame rate.
  14011. @example
  14012. ------> time
  14013. Input:
  14014. Frame 1 Frame 2 Frame 3 Frame 4
  14015. 11111 22222 33333 44444
  14016. 11111 22222 33333 44444
  14017. 11111 22222 33333 44444
  14018. 11111 22222 33333 44444
  14019. Output:
  14020. 11111 33333 33333 55555
  14021. 22222 22222 44444 44444
  14022. 11111 33333 33333 55555
  14023. 22222 22222 44444 44444
  14024. 11111 33333 33333 55555
  14025. 22222 22222 44444 44444
  14026. 11111 33333 33333 55555
  14027. 22222 22222 44444 44444
  14028. @end example
  14029. @end table
  14030. Numeric values are deprecated but are accepted for backward
  14031. compatibility reasons.
  14032. Default mode is @code{merge}.
  14033. @item flags
  14034. Specify flags influencing the filter process.
  14035. Available value for @var{flags} is:
  14036. @table @option
  14037. @item low_pass_filter, vlpf
  14038. Enable linear vertical low-pass filtering in the filter.
  14039. Vertical low-pass filtering is required when creating an interlaced
  14040. destination from a progressive source which contains high-frequency
  14041. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  14042. patterning.
  14043. @item complex_filter, cvlpf
  14044. Enable complex vertical low-pass filtering.
  14045. This will slightly less reduce interlace 'twitter' and Moire
  14046. patterning but better retain detail and subjective sharpness impression.
  14047. @item bypass_il
  14048. Bypass already interlaced frames, only adjust the frame rate.
  14049. @end table
  14050. Vertical low-pass filtering and bypassing already interlaced frames can only be
  14051. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  14052. @end table
  14053. @section tmedian
  14054. Pick median pixels from several successive input video frames.
  14055. The filter accepts the following options:
  14056. @table @option
  14057. @item radius
  14058. Set radius of median filter.
  14059. Default is 1. Allowed range is from 1 to 127.
  14060. @item planes
  14061. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14062. @item percentile
  14063. Set median percentile. Default value is @code{0.5}.
  14064. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  14065. minimum values, and @code{1} maximum values.
  14066. @end table
  14067. @section tmix
  14068. Mix successive video frames.
  14069. A description of the accepted options follows.
  14070. @table @option
  14071. @item frames
  14072. The number of successive frames to mix. If unspecified, it defaults to 3.
  14073. @item weights
  14074. Specify weight of each input video frame.
  14075. Each weight is separated by space. If number of weights is smaller than
  14076. number of @var{frames} last specified weight will be used for all remaining
  14077. unset weights.
  14078. @item scale
  14079. Specify scale, if it is set it will be multiplied with sum
  14080. of each weight multiplied with pixel values to give final destination
  14081. pixel value. By default @var{scale} is auto scaled to sum of weights.
  14082. @end table
  14083. @subsection Examples
  14084. @itemize
  14085. @item
  14086. Average 7 successive frames:
  14087. @example
  14088. tmix=frames=7:weights="1 1 1 1 1 1 1"
  14089. @end example
  14090. @item
  14091. Apply simple temporal convolution:
  14092. @example
  14093. tmix=frames=3:weights="-1 3 -1"
  14094. @end example
  14095. @item
  14096. Similar as above but only showing temporal differences:
  14097. @example
  14098. tmix=frames=3:weights="-1 2 -1":scale=1
  14099. @end example
  14100. @end itemize
  14101. @anchor{tonemap}
  14102. @section tonemap
  14103. Tone map colors from different dynamic ranges.
  14104. This filter expects data in single precision floating point, as it needs to
  14105. operate on (and can output) out-of-range values. Another filter, such as
  14106. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  14107. The tonemapping algorithms implemented only work on linear light, so input
  14108. data should be linearized beforehand (and possibly correctly tagged).
  14109. @example
  14110. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  14111. @end example
  14112. @subsection Options
  14113. The filter accepts the following options.
  14114. @table @option
  14115. @item tonemap
  14116. Set the tone map algorithm to use.
  14117. Possible values are:
  14118. @table @var
  14119. @item none
  14120. Do not apply any tone map, only desaturate overbright pixels.
  14121. @item clip
  14122. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  14123. in-range values, while distorting out-of-range values.
  14124. @item linear
  14125. Stretch the entire reference gamut to a linear multiple of the display.
  14126. @item gamma
  14127. Fit a logarithmic transfer between the tone curves.
  14128. @item reinhard
  14129. Preserve overall image brightness with a simple curve, using nonlinear
  14130. contrast, which results in flattening details and degrading color accuracy.
  14131. @item hable
  14132. Preserve both dark and bright details better than @var{reinhard}, at the cost
  14133. of slightly darkening everything. Use it when detail preservation is more
  14134. important than color and brightness accuracy.
  14135. @item mobius
  14136. Smoothly map out-of-range values, while retaining contrast and colors for
  14137. in-range material as much as possible. Use it when color accuracy is more
  14138. important than detail preservation.
  14139. @end table
  14140. Default is none.
  14141. @item param
  14142. Tune the tone mapping algorithm.
  14143. This affects the following algorithms:
  14144. @table @var
  14145. @item none
  14146. Ignored.
  14147. @item linear
  14148. Specifies the scale factor to use while stretching.
  14149. Default to 1.0.
  14150. @item gamma
  14151. Specifies the exponent of the function.
  14152. Default to 1.8.
  14153. @item clip
  14154. Specify an extra linear coefficient to multiply into the signal before clipping.
  14155. Default to 1.0.
  14156. @item reinhard
  14157. Specify the local contrast coefficient at the display peak.
  14158. Default to 0.5, which means that in-gamut values will be about half as bright
  14159. as when clipping.
  14160. @item hable
  14161. Ignored.
  14162. @item mobius
  14163. Specify the transition point from linear to mobius transform. Every value
  14164. below this point is guaranteed to be mapped 1:1. The higher the value, the
  14165. more accurate the result will be, at the cost of losing bright details.
  14166. Default to 0.3, which due to the steep initial slope still preserves in-range
  14167. colors fairly accurately.
  14168. @end table
  14169. @item desat
  14170. Apply desaturation for highlights that exceed this level of brightness. The
  14171. higher the parameter, the more color information will be preserved. This
  14172. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14173. (smoothly) turning into white instead. This makes images feel more natural,
  14174. at the cost of reducing information about out-of-range colors.
  14175. The default of 2.0 is somewhat conservative and will mostly just apply to
  14176. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  14177. This option works only if the input frame has a supported color tag.
  14178. @item peak
  14179. Override signal/nominal/reference peak with this value. Useful when the
  14180. embedded peak information in display metadata is not reliable or when tone
  14181. mapping from a lower range to a higher range.
  14182. @end table
  14183. @section tpad
  14184. Temporarily pad video frames.
  14185. The filter accepts the following options:
  14186. @table @option
  14187. @item start
  14188. Specify number of delay frames before input video stream. Default is 0.
  14189. @item stop
  14190. Specify number of padding frames after input video stream.
  14191. Set to -1 to pad indefinitely. Default is 0.
  14192. @item start_mode
  14193. Set kind of frames added to beginning of stream.
  14194. Can be either @var{add} or @var{clone}.
  14195. With @var{add} frames of solid-color are added.
  14196. With @var{clone} frames are clones of first frame.
  14197. Default is @var{add}.
  14198. @item stop_mode
  14199. Set kind of frames added to end of stream.
  14200. Can be either @var{add} or @var{clone}.
  14201. With @var{add} frames of solid-color are added.
  14202. With @var{clone} frames are clones of last frame.
  14203. Default is @var{add}.
  14204. @item start_duration, stop_duration
  14205. Specify the duration of the start/stop delay. See
  14206. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14207. for the accepted syntax.
  14208. These options override @var{start} and @var{stop}. Default is 0.
  14209. @item color
  14210. Specify the color of the padded area. For the syntax of this option,
  14211. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14212. manual,ffmpeg-utils}.
  14213. The default value of @var{color} is "black".
  14214. @end table
  14215. @anchor{transpose}
  14216. @section transpose
  14217. Transpose rows with columns in the input video and optionally flip it.
  14218. It accepts the following parameters:
  14219. @table @option
  14220. @item dir
  14221. Specify the transposition direction.
  14222. Can assume the following values:
  14223. @table @samp
  14224. @item 0, 4, cclock_flip
  14225. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  14226. @example
  14227. L.R L.l
  14228. . . -> . .
  14229. l.r R.r
  14230. @end example
  14231. @item 1, 5, clock
  14232. Rotate by 90 degrees clockwise, that is:
  14233. @example
  14234. L.R l.L
  14235. . . -> . .
  14236. l.r r.R
  14237. @end example
  14238. @item 2, 6, cclock
  14239. Rotate by 90 degrees counterclockwise, that is:
  14240. @example
  14241. L.R R.r
  14242. . . -> . .
  14243. l.r L.l
  14244. @end example
  14245. @item 3, 7, clock_flip
  14246. Rotate by 90 degrees clockwise and vertically flip, that is:
  14247. @example
  14248. L.R r.R
  14249. . . -> . .
  14250. l.r l.L
  14251. @end example
  14252. @end table
  14253. For values between 4-7, the transposition is only done if the input
  14254. video geometry is portrait and not landscape. These values are
  14255. deprecated, the @code{passthrough} option should be used instead.
  14256. Numerical values are deprecated, and should be dropped in favor of
  14257. symbolic constants.
  14258. @item passthrough
  14259. Do not apply the transposition if the input geometry matches the one
  14260. specified by the specified value. It accepts the following values:
  14261. @table @samp
  14262. @item none
  14263. Always apply transposition.
  14264. @item portrait
  14265. Preserve portrait geometry (when @var{height} >= @var{width}).
  14266. @item landscape
  14267. Preserve landscape geometry (when @var{width} >= @var{height}).
  14268. @end table
  14269. Default value is @code{none}.
  14270. @end table
  14271. For example to rotate by 90 degrees clockwise and preserve portrait
  14272. layout:
  14273. @example
  14274. transpose=dir=1:passthrough=portrait
  14275. @end example
  14276. The command above can also be specified as:
  14277. @example
  14278. transpose=1:portrait
  14279. @end example
  14280. @section transpose_npp
  14281. Transpose rows with columns in the input video and optionally flip it.
  14282. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14283. It accepts the following parameters:
  14284. @table @option
  14285. @item dir
  14286. Specify the transposition direction.
  14287. Can assume the following values:
  14288. @table @samp
  14289. @item cclock_flip
  14290. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14291. @item clock
  14292. Rotate by 90 degrees clockwise.
  14293. @item cclock
  14294. Rotate by 90 degrees counterclockwise.
  14295. @item clock_flip
  14296. Rotate by 90 degrees clockwise and vertically flip.
  14297. @end table
  14298. @item passthrough
  14299. Do not apply the transposition if the input geometry matches the one
  14300. specified by the specified value. It accepts the following values:
  14301. @table @samp
  14302. @item none
  14303. Always apply transposition. (default)
  14304. @item portrait
  14305. Preserve portrait geometry (when @var{height} >= @var{width}).
  14306. @item landscape
  14307. Preserve landscape geometry (when @var{width} >= @var{height}).
  14308. @end table
  14309. @end table
  14310. @section trim
  14311. Trim the input so that the output contains one continuous subpart of the input.
  14312. It accepts the following parameters:
  14313. @table @option
  14314. @item start
  14315. Specify the time of the start of the kept section, i.e. the frame with the
  14316. timestamp @var{start} will be the first frame in the output.
  14317. @item end
  14318. Specify the time of the first frame that will be dropped, i.e. the frame
  14319. immediately preceding the one with the timestamp @var{end} will be the last
  14320. frame in the output.
  14321. @item start_pts
  14322. This is the same as @var{start}, except this option sets the start timestamp
  14323. in timebase units instead of seconds.
  14324. @item end_pts
  14325. This is the same as @var{end}, except this option sets the end timestamp
  14326. in timebase units instead of seconds.
  14327. @item duration
  14328. The maximum duration of the output in seconds.
  14329. @item start_frame
  14330. The number of the first frame that should be passed to the output.
  14331. @item end_frame
  14332. The number of the first frame that should be dropped.
  14333. @end table
  14334. @option{start}, @option{end}, and @option{duration} are expressed as time
  14335. duration specifications; see
  14336. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14337. for the accepted syntax.
  14338. Note that the first two sets of the start/end options and the @option{duration}
  14339. option look at the frame timestamp, while the _frame variants simply count the
  14340. frames that pass through the filter. Also note that this filter does not modify
  14341. the timestamps. If you wish for the output timestamps to start at zero, insert a
  14342. setpts filter after the trim filter.
  14343. If multiple start or end options are set, this filter tries to be greedy and
  14344. keep all the frames that match at least one of the specified constraints. To keep
  14345. only the part that matches all the constraints at once, chain multiple trim
  14346. filters.
  14347. The defaults are such that all the input is kept. So it is possible to set e.g.
  14348. just the end values to keep everything before the specified time.
  14349. Examples:
  14350. @itemize
  14351. @item
  14352. Drop everything except the second minute of input:
  14353. @example
  14354. ffmpeg -i INPUT -vf trim=60:120
  14355. @end example
  14356. @item
  14357. Keep only the first second:
  14358. @example
  14359. ffmpeg -i INPUT -vf trim=duration=1
  14360. @end example
  14361. @end itemize
  14362. @section unpremultiply
  14363. Apply alpha unpremultiply effect to input video stream using first plane
  14364. of second stream as alpha.
  14365. Both streams must have same dimensions and same pixel format.
  14366. The filter accepts the following option:
  14367. @table @option
  14368. @item planes
  14369. Set which planes will be processed, unprocessed planes will be copied.
  14370. By default value 0xf, all planes will be processed.
  14371. If the format has 1 or 2 components, then luma is bit 0.
  14372. If the format has 3 or 4 components:
  14373. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  14374. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  14375. If present, the alpha channel is always the last bit.
  14376. @item inplace
  14377. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14378. @end table
  14379. @anchor{unsharp}
  14380. @section unsharp
  14381. Sharpen or blur the input video.
  14382. It accepts the following parameters:
  14383. @table @option
  14384. @item luma_msize_x, lx
  14385. Set the luma matrix horizontal size. It must be an odd integer between
  14386. 3 and 23. The default value is 5.
  14387. @item luma_msize_y, ly
  14388. Set the luma matrix vertical size. It must be an odd integer between 3
  14389. and 23. The default value is 5.
  14390. @item luma_amount, la
  14391. Set the luma effect strength. It must be a floating point number, reasonable
  14392. values lay between -1.5 and 1.5.
  14393. Negative values will blur the input video, while positive values will
  14394. sharpen it, a value of zero will disable the effect.
  14395. Default value is 1.0.
  14396. @item chroma_msize_x, cx
  14397. Set the chroma matrix horizontal size. It must be an odd integer
  14398. between 3 and 23. The default value is 5.
  14399. @item chroma_msize_y, cy
  14400. Set the chroma matrix vertical size. It must be an odd integer
  14401. between 3 and 23. The default value is 5.
  14402. @item chroma_amount, ca
  14403. Set the chroma effect strength. It must be a floating point number, reasonable
  14404. values lay between -1.5 and 1.5.
  14405. Negative values will blur the input video, while positive values will
  14406. sharpen it, a value of zero will disable the effect.
  14407. Default value is 0.0.
  14408. @end table
  14409. All parameters are optional and default to the equivalent of the
  14410. string '5:5:1.0:5:5:0.0'.
  14411. @subsection Examples
  14412. @itemize
  14413. @item
  14414. Apply strong luma sharpen effect:
  14415. @example
  14416. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  14417. @end example
  14418. @item
  14419. Apply a strong blur of both luma and chroma parameters:
  14420. @example
  14421. unsharp=7:7:-2:7:7:-2
  14422. @end example
  14423. @end itemize
  14424. @section uspp
  14425. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  14426. the image at several (or - in the case of @option{quality} level @code{8} - all)
  14427. shifts and average the results.
  14428. The way this differs from the behavior of spp is that uspp actually encodes &
  14429. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  14430. DCT similar to MJPEG.
  14431. The filter accepts the following options:
  14432. @table @option
  14433. @item quality
  14434. Set quality. This option defines the number of levels for averaging. It accepts
  14435. an integer in the range 0-8. If set to @code{0}, the filter will have no
  14436. effect. A value of @code{8} means the higher quality. For each increment of
  14437. that value the speed drops by a factor of approximately 2. Default value is
  14438. @code{3}.
  14439. @item qp
  14440. Force a constant quantization parameter. If not set, the filter will use the QP
  14441. from the video stream (if available).
  14442. @end table
  14443. @section v360
  14444. Convert 360 videos between various formats.
  14445. The filter accepts the following options:
  14446. @table @option
  14447. @item input
  14448. @item output
  14449. Set format of the input/output video.
  14450. Available formats:
  14451. @table @samp
  14452. @item e
  14453. @item equirect
  14454. Equirectangular projection.
  14455. @item c3x2
  14456. @item c6x1
  14457. @item c1x6
  14458. Cubemap with 3x2/6x1/1x6 layout.
  14459. Format specific options:
  14460. @table @option
  14461. @item in_pad
  14462. @item out_pad
  14463. Set padding proportion for the input/output cubemap. Values in decimals.
  14464. Example values:
  14465. @table @samp
  14466. @item 0
  14467. No padding.
  14468. @item 0.01
  14469. 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)
  14470. @end table
  14471. Default value is @b{@samp{0}}.
  14472. Maximum value is @b{@samp{0.1}}.
  14473. @item fin_pad
  14474. @item fout_pad
  14475. Set fixed padding for the input/output cubemap. Values in pixels.
  14476. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  14477. @item in_forder
  14478. @item out_forder
  14479. Set order of faces for the input/output cubemap. Choose one direction for each position.
  14480. Designation of directions:
  14481. @table @samp
  14482. @item r
  14483. right
  14484. @item l
  14485. left
  14486. @item u
  14487. up
  14488. @item d
  14489. down
  14490. @item f
  14491. forward
  14492. @item b
  14493. back
  14494. @end table
  14495. Default value is @b{@samp{rludfb}}.
  14496. @item in_frot
  14497. @item out_frot
  14498. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  14499. Designation of angles:
  14500. @table @samp
  14501. @item 0
  14502. 0 degrees clockwise
  14503. @item 1
  14504. 90 degrees clockwise
  14505. @item 2
  14506. 180 degrees clockwise
  14507. @item 3
  14508. 270 degrees clockwise
  14509. @end table
  14510. Default value is @b{@samp{000000}}.
  14511. @end table
  14512. @item eac
  14513. Equi-Angular Cubemap.
  14514. @item flat
  14515. @item gnomonic
  14516. @item rectilinear
  14517. Regular video.
  14518. Format specific options:
  14519. @table @option
  14520. @item h_fov
  14521. @item v_fov
  14522. @item d_fov
  14523. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14524. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14525. @item ih_fov
  14526. @item iv_fov
  14527. @item id_fov
  14528. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14529. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14530. @end table
  14531. @item dfisheye
  14532. Dual fisheye.
  14533. Format specific options:
  14534. @table @option
  14535. @item h_fov
  14536. @item v_fov
  14537. @item d_fov
  14538. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14539. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14540. @item ih_fov
  14541. @item iv_fov
  14542. @item id_fov
  14543. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14544. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14545. @end table
  14546. @item barrel
  14547. @item fb
  14548. @item barrelsplit
  14549. Facebook's 360 formats.
  14550. @item sg
  14551. Stereographic format.
  14552. Format specific options:
  14553. @table @option
  14554. @item h_fov
  14555. @item v_fov
  14556. @item d_fov
  14557. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14558. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14559. @item ih_fov
  14560. @item iv_fov
  14561. @item id_fov
  14562. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14563. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14564. @end table
  14565. @item mercator
  14566. Mercator format.
  14567. @item ball
  14568. Ball format, gives significant distortion toward the back.
  14569. @item hammer
  14570. Hammer-Aitoff map projection format.
  14571. @item sinusoidal
  14572. Sinusoidal map projection format.
  14573. @item fisheye
  14574. Fisheye projection.
  14575. Format specific options:
  14576. @table @option
  14577. @item h_fov
  14578. @item v_fov
  14579. @item d_fov
  14580. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14581. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14582. @item ih_fov
  14583. @item iv_fov
  14584. @item id_fov
  14585. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14586. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14587. @end table
  14588. @item pannini
  14589. Pannini projection.
  14590. Format specific options:
  14591. @table @option
  14592. @item h_fov
  14593. Set output pannini parameter.
  14594. @item ih_fov
  14595. Set input pannini parameter.
  14596. @end table
  14597. @item cylindrical
  14598. Cylindrical projection.
  14599. Format specific options:
  14600. @table @option
  14601. @item h_fov
  14602. @item v_fov
  14603. @item d_fov
  14604. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14605. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14606. @item ih_fov
  14607. @item iv_fov
  14608. @item id_fov
  14609. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14610. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14611. @end table
  14612. @item perspective
  14613. Perspective projection. @i{(output only)}
  14614. Format specific options:
  14615. @table @option
  14616. @item v_fov
  14617. Set perspective parameter.
  14618. @end table
  14619. @item tetrahedron
  14620. Tetrahedron projection.
  14621. @item tsp
  14622. Truncated square pyramid projection.
  14623. @item he
  14624. @item hequirect
  14625. Half equirectangular projection.
  14626. @end table
  14627. @item interp
  14628. Set interpolation method.@*
  14629. @i{Note: more complex interpolation methods require much more memory to run.}
  14630. Available methods:
  14631. @table @samp
  14632. @item near
  14633. @item nearest
  14634. Nearest neighbour.
  14635. @item line
  14636. @item linear
  14637. Bilinear interpolation.
  14638. @item lagrange9
  14639. Lagrange9 interpolation.
  14640. @item cube
  14641. @item cubic
  14642. Bicubic interpolation.
  14643. @item lanc
  14644. @item lanczos
  14645. Lanczos interpolation.
  14646. @item sp16
  14647. @item spline16
  14648. Spline16 interpolation.
  14649. @item gauss
  14650. @item gaussian
  14651. Gaussian interpolation.
  14652. @end table
  14653. Default value is @b{@samp{line}}.
  14654. @item w
  14655. @item h
  14656. Set the output video resolution.
  14657. Default resolution depends on formats.
  14658. @item in_stereo
  14659. @item out_stereo
  14660. Set the input/output stereo format.
  14661. @table @samp
  14662. @item 2d
  14663. 2D mono
  14664. @item sbs
  14665. Side by side
  14666. @item tb
  14667. Top bottom
  14668. @end table
  14669. Default value is @b{@samp{2d}} for input and output format.
  14670. @item yaw
  14671. @item pitch
  14672. @item roll
  14673. Set rotation for the output video. Values in degrees.
  14674. @item rorder
  14675. Set rotation order for the output video. Choose one item for each position.
  14676. @table @samp
  14677. @item y, Y
  14678. yaw
  14679. @item p, P
  14680. pitch
  14681. @item r, R
  14682. roll
  14683. @end table
  14684. Default value is @b{@samp{ypr}}.
  14685. @item h_flip
  14686. @item v_flip
  14687. @item d_flip
  14688. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  14689. @item ih_flip
  14690. @item iv_flip
  14691. Set if input video is flipped horizontally/vertically. Boolean values.
  14692. @item in_trans
  14693. Set if input video is transposed. Boolean value, by default disabled.
  14694. @item out_trans
  14695. Set if output video needs to be transposed. Boolean value, by default disabled.
  14696. @item alpha_mask
  14697. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  14698. @end table
  14699. @subsection Examples
  14700. @itemize
  14701. @item
  14702. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  14703. @example
  14704. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  14705. @end example
  14706. @item
  14707. Extract back view of Equi-Angular Cubemap:
  14708. @example
  14709. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  14710. @end example
  14711. @item
  14712. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  14713. @example
  14714. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  14715. @end example
  14716. @end itemize
  14717. @subsection Commands
  14718. This filter supports subset of above options as @ref{commands}.
  14719. @section vaguedenoiser
  14720. Apply a wavelet based denoiser.
  14721. It transforms each frame from the video input into the wavelet domain,
  14722. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  14723. the obtained coefficients. It does an inverse wavelet transform after.
  14724. Due to wavelet properties, it should give a nice smoothed result, and
  14725. reduced noise, without blurring picture features.
  14726. This filter accepts the following options:
  14727. @table @option
  14728. @item threshold
  14729. The filtering strength. The higher, the more filtered the video will be.
  14730. Hard thresholding can use a higher threshold than soft thresholding
  14731. before the video looks overfiltered. Default value is 2.
  14732. @item method
  14733. The filtering method the filter will use.
  14734. It accepts the following values:
  14735. @table @samp
  14736. @item hard
  14737. All values under the threshold will be zeroed.
  14738. @item soft
  14739. All values under the threshold will be zeroed. All values above will be
  14740. reduced by the threshold.
  14741. @item garrote
  14742. Scales or nullifies coefficients - intermediary between (more) soft and
  14743. (less) hard thresholding.
  14744. @end table
  14745. Default is garrote.
  14746. @item nsteps
  14747. Number of times, the wavelet will decompose the picture. Picture can't
  14748. be decomposed beyond a particular point (typically, 8 for a 640x480
  14749. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  14750. @item percent
  14751. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  14752. @item planes
  14753. A list of the planes to process. By default all planes are processed.
  14754. @end table
  14755. @section vectorscope
  14756. Display 2 color component values in the two dimensional graph (which is called
  14757. a vectorscope).
  14758. This filter accepts the following options:
  14759. @table @option
  14760. @item mode, m
  14761. Set vectorscope mode.
  14762. It accepts the following values:
  14763. @table @samp
  14764. @item gray
  14765. @item tint
  14766. Gray values are displayed on graph, higher brightness means more pixels have
  14767. same component color value on location in graph. This is the default mode.
  14768. @item color
  14769. Gray values are displayed on graph. Surrounding pixels values which are not
  14770. present in video frame are drawn in gradient of 2 color components which are
  14771. set by option @code{x} and @code{y}. The 3rd color component is static.
  14772. @item color2
  14773. Actual color components values present in video frame are displayed on graph.
  14774. @item color3
  14775. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  14776. on graph increases value of another color component, which is luminance by
  14777. default values of @code{x} and @code{y}.
  14778. @item color4
  14779. Actual colors present in video frame are displayed on graph. If two different
  14780. colors map to same position on graph then color with higher value of component
  14781. not present in graph is picked.
  14782. @item color5
  14783. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  14784. component picked from radial gradient.
  14785. @end table
  14786. @item x
  14787. Set which color component will be represented on X-axis. Default is @code{1}.
  14788. @item y
  14789. Set which color component will be represented on Y-axis. Default is @code{2}.
  14790. @item intensity, i
  14791. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  14792. of color component which represents frequency of (X, Y) location in graph.
  14793. @item envelope, e
  14794. @table @samp
  14795. @item none
  14796. No envelope, this is default.
  14797. @item instant
  14798. Instant envelope, even darkest single pixel will be clearly highlighted.
  14799. @item peak
  14800. Hold maximum and minimum values presented in graph over time. This way you
  14801. can still spot out of range values without constantly looking at vectorscope.
  14802. @item peak+instant
  14803. Peak and instant envelope combined together.
  14804. @end table
  14805. @item graticule, g
  14806. Set what kind of graticule to draw.
  14807. @table @samp
  14808. @item none
  14809. @item green
  14810. @item color
  14811. @item invert
  14812. @end table
  14813. @item opacity, o
  14814. Set graticule opacity.
  14815. @item flags, f
  14816. Set graticule flags.
  14817. @table @samp
  14818. @item white
  14819. Draw graticule for white point.
  14820. @item black
  14821. Draw graticule for black point.
  14822. @item name
  14823. Draw color points short names.
  14824. @end table
  14825. @item bgopacity, b
  14826. Set background opacity.
  14827. @item lthreshold, l
  14828. Set low threshold for color component not represented on X or Y axis.
  14829. Values lower than this value will be ignored. Default is 0.
  14830. Note this value is multiplied with actual max possible value one pixel component
  14831. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  14832. is 0.1 * 255 = 25.
  14833. @item hthreshold, h
  14834. Set high threshold for color component not represented on X or Y axis.
  14835. Values higher than this value will be ignored. Default is 1.
  14836. Note this value is multiplied with actual max possible value one pixel component
  14837. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  14838. is 0.9 * 255 = 230.
  14839. @item colorspace, c
  14840. Set what kind of colorspace to use when drawing graticule.
  14841. @table @samp
  14842. @item auto
  14843. @item 601
  14844. @item 709
  14845. @end table
  14846. Default is auto.
  14847. @item tint0, t0
  14848. @item tint1, t1
  14849. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  14850. This means no tint, and output will remain gray.
  14851. @end table
  14852. @anchor{vidstabdetect}
  14853. @section vidstabdetect
  14854. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  14855. @ref{vidstabtransform} for pass 2.
  14856. This filter generates a file with relative translation and rotation
  14857. transform information about subsequent frames, which is then used by
  14858. the @ref{vidstabtransform} filter.
  14859. To enable compilation of this filter you need to configure FFmpeg with
  14860. @code{--enable-libvidstab}.
  14861. This filter accepts the following options:
  14862. @table @option
  14863. @item result
  14864. Set the path to the file used to write the transforms information.
  14865. Default value is @file{transforms.trf}.
  14866. @item shakiness
  14867. Set how shaky the video is and how quick the camera is. It accepts an
  14868. integer in the range 1-10, a value of 1 means little shakiness, a
  14869. value of 10 means strong shakiness. Default value is 5.
  14870. @item accuracy
  14871. Set the accuracy of the detection process. It must be a value in the
  14872. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  14873. accuracy. Default value is 15.
  14874. @item stepsize
  14875. Set stepsize of the search process. The region around minimum is
  14876. scanned with 1 pixel resolution. Default value is 6.
  14877. @item mincontrast
  14878. Set minimum contrast. Below this value a local measurement field is
  14879. discarded. Must be a floating point value in the range 0-1. Default
  14880. value is 0.3.
  14881. @item tripod
  14882. Set reference frame number for tripod mode.
  14883. If enabled, the motion of the frames is compared to a reference frame
  14884. in the filtered stream, identified by the specified number. The idea
  14885. is to compensate all movements in a more-or-less static scene and keep
  14886. the camera view absolutely still.
  14887. If set to 0, it is disabled. The frames are counted starting from 1.
  14888. @item show
  14889. Show fields and transforms in the resulting frames. It accepts an
  14890. integer in the range 0-2. Default value is 0, which disables any
  14891. visualization.
  14892. @end table
  14893. @subsection Examples
  14894. @itemize
  14895. @item
  14896. Use default values:
  14897. @example
  14898. vidstabdetect
  14899. @end example
  14900. @item
  14901. Analyze strongly shaky movie and put the results in file
  14902. @file{mytransforms.trf}:
  14903. @example
  14904. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  14905. @end example
  14906. @item
  14907. Visualize the result of internal transformations in the resulting
  14908. video:
  14909. @example
  14910. vidstabdetect=show=1
  14911. @end example
  14912. @item
  14913. Analyze a video with medium shakiness using @command{ffmpeg}:
  14914. @example
  14915. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  14916. @end example
  14917. @end itemize
  14918. @anchor{vidstabtransform}
  14919. @section vidstabtransform
  14920. Video stabilization/deshaking: pass 2 of 2,
  14921. see @ref{vidstabdetect} for pass 1.
  14922. Read a file with transform information for each frame and
  14923. apply/compensate them. Together with the @ref{vidstabdetect}
  14924. filter this can be used to deshake videos. See also
  14925. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  14926. the @ref{unsharp} filter, see below.
  14927. To enable compilation of this filter you need to configure FFmpeg with
  14928. @code{--enable-libvidstab}.
  14929. @subsection Options
  14930. @table @option
  14931. @item input
  14932. Set path to the file used to read the transforms. Default value is
  14933. @file{transforms.trf}.
  14934. @item smoothing
  14935. Set the number of frames (value*2 + 1) used for lowpass filtering the
  14936. camera movements. Default value is 10.
  14937. For example a number of 10 means that 21 frames are used (10 in the
  14938. past and 10 in the future) to smoothen the motion in the video. A
  14939. larger value leads to a smoother video, but limits the acceleration of
  14940. the camera (pan/tilt movements). 0 is a special case where a static
  14941. camera is simulated.
  14942. @item optalgo
  14943. Set the camera path optimization algorithm.
  14944. Accepted values are:
  14945. @table @samp
  14946. @item gauss
  14947. gaussian kernel low-pass filter on camera motion (default)
  14948. @item avg
  14949. averaging on transformations
  14950. @end table
  14951. @item maxshift
  14952. Set maximal number of pixels to translate frames. Default value is -1,
  14953. meaning no limit.
  14954. @item maxangle
  14955. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  14956. value is -1, meaning no limit.
  14957. @item crop
  14958. Specify how to deal with borders that may be visible due to movement
  14959. compensation.
  14960. Available values are:
  14961. @table @samp
  14962. @item keep
  14963. keep image information from previous frame (default)
  14964. @item black
  14965. fill the border black
  14966. @end table
  14967. @item invert
  14968. Invert transforms if set to 1. Default value is 0.
  14969. @item relative
  14970. Consider transforms as relative to previous frame if set to 1,
  14971. absolute if set to 0. Default value is 0.
  14972. @item zoom
  14973. Set percentage to zoom. A positive value will result in a zoom-in
  14974. effect, a negative value in a zoom-out effect. Default value is 0 (no
  14975. zoom).
  14976. @item optzoom
  14977. Set optimal zooming to avoid borders.
  14978. Accepted values are:
  14979. @table @samp
  14980. @item 0
  14981. disabled
  14982. @item 1
  14983. optimal static zoom value is determined (only very strong movements
  14984. will lead to visible borders) (default)
  14985. @item 2
  14986. optimal adaptive zoom value is determined (no borders will be
  14987. visible), see @option{zoomspeed}
  14988. @end table
  14989. Note that the value given at zoom is added to the one calculated here.
  14990. @item zoomspeed
  14991. Set percent to zoom maximally each frame (enabled when
  14992. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  14993. 0.25.
  14994. @item interpol
  14995. Specify type of interpolation.
  14996. Available values are:
  14997. @table @samp
  14998. @item no
  14999. no interpolation
  15000. @item linear
  15001. linear only horizontal
  15002. @item bilinear
  15003. linear in both directions (default)
  15004. @item bicubic
  15005. cubic in both directions (slow)
  15006. @end table
  15007. @item tripod
  15008. Enable virtual tripod mode if set to 1, which is equivalent to
  15009. @code{relative=0:smoothing=0}. Default value is 0.
  15010. Use also @code{tripod} option of @ref{vidstabdetect}.
  15011. @item debug
  15012. Increase log verbosity if set to 1. Also the detected global motions
  15013. are written to the temporary file @file{global_motions.trf}. Default
  15014. value is 0.
  15015. @end table
  15016. @subsection Examples
  15017. @itemize
  15018. @item
  15019. Use @command{ffmpeg} for a typical stabilization with default values:
  15020. @example
  15021. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  15022. @end example
  15023. Note the use of the @ref{unsharp} filter which is always recommended.
  15024. @item
  15025. Zoom in a bit more and load transform data from a given file:
  15026. @example
  15027. vidstabtransform=zoom=5:input="mytransforms.trf"
  15028. @end example
  15029. @item
  15030. Smoothen the video even more:
  15031. @example
  15032. vidstabtransform=smoothing=30
  15033. @end example
  15034. @end itemize
  15035. @section vflip
  15036. Flip the input video vertically.
  15037. For example, to vertically flip a video with @command{ffmpeg}:
  15038. @example
  15039. ffmpeg -i in.avi -vf "vflip" out.avi
  15040. @end example
  15041. @section vfrdet
  15042. Detect variable frame rate video.
  15043. This filter tries to detect if the input is variable or constant frame rate.
  15044. At end it will output number of frames detected as having variable delta pts,
  15045. and ones with constant delta pts.
  15046. If there was frames with variable delta, than it will also show min, max and
  15047. average delta encountered.
  15048. @section vibrance
  15049. Boost or alter saturation.
  15050. The filter accepts the following options:
  15051. @table @option
  15052. @item intensity
  15053. Set strength of boost if positive value or strength of alter if negative value.
  15054. Default is 0. Allowed range is from -2 to 2.
  15055. @item rbal
  15056. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  15057. @item gbal
  15058. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  15059. @item bbal
  15060. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  15061. @item rlum
  15062. Set the red luma coefficient.
  15063. @item glum
  15064. Set the green luma coefficient.
  15065. @item blum
  15066. Set the blue luma coefficient.
  15067. @item alternate
  15068. If @code{intensity} is negative and this is set to 1, colors will change,
  15069. otherwise colors will be less saturated, more towards gray.
  15070. @end table
  15071. @subsection Commands
  15072. This filter supports the all above options as @ref{commands}.
  15073. @anchor{vignette}
  15074. @section vignette
  15075. Make or reverse a natural vignetting effect.
  15076. The filter accepts the following options:
  15077. @table @option
  15078. @item angle, a
  15079. Set lens angle expression as a number of radians.
  15080. The value is clipped in the @code{[0,PI/2]} range.
  15081. Default value: @code{"PI/5"}
  15082. @item x0
  15083. @item y0
  15084. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  15085. by default.
  15086. @item mode
  15087. Set forward/backward mode.
  15088. Available modes are:
  15089. @table @samp
  15090. @item forward
  15091. The larger the distance from the central point, the darker the image becomes.
  15092. @item backward
  15093. The larger the distance from the central point, the brighter the image becomes.
  15094. This can be used to reverse a vignette effect, though there is no automatic
  15095. detection to extract the lens @option{angle} and other settings (yet). It can
  15096. also be used to create a burning effect.
  15097. @end table
  15098. Default value is @samp{forward}.
  15099. @item eval
  15100. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  15101. It accepts the following values:
  15102. @table @samp
  15103. @item init
  15104. Evaluate expressions only once during the filter initialization.
  15105. @item frame
  15106. Evaluate expressions for each incoming frame. This is way slower than the
  15107. @samp{init} mode since it requires all the scalers to be re-computed, but it
  15108. allows advanced dynamic expressions.
  15109. @end table
  15110. Default value is @samp{init}.
  15111. @item dither
  15112. Set dithering to reduce the circular banding effects. Default is @code{1}
  15113. (enabled).
  15114. @item aspect
  15115. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  15116. Setting this value to the SAR of the input will make a rectangular vignetting
  15117. following the dimensions of the video.
  15118. Default is @code{1/1}.
  15119. @end table
  15120. @subsection Expressions
  15121. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  15122. following parameters.
  15123. @table @option
  15124. @item w
  15125. @item h
  15126. input width and height
  15127. @item n
  15128. the number of input frame, starting from 0
  15129. @item pts
  15130. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  15131. @var{TB} units, NAN if undefined
  15132. @item r
  15133. frame rate of the input video, NAN if the input frame rate is unknown
  15134. @item t
  15135. the PTS (Presentation TimeStamp) of the filtered video frame,
  15136. expressed in seconds, NAN if undefined
  15137. @item tb
  15138. time base of the input video
  15139. @end table
  15140. @subsection Examples
  15141. @itemize
  15142. @item
  15143. Apply simple strong vignetting effect:
  15144. @example
  15145. vignette=PI/4
  15146. @end example
  15147. @item
  15148. Make a flickering vignetting:
  15149. @example
  15150. vignette='PI/4+random(1)*PI/50':eval=frame
  15151. @end example
  15152. @end itemize
  15153. @section vmafmotion
  15154. Obtain the average VMAF motion score of a video.
  15155. It is one of the component metrics of VMAF.
  15156. The obtained average motion score is printed through the logging system.
  15157. The filter accepts the following options:
  15158. @table @option
  15159. @item stats_file
  15160. If specified, the filter will use the named file to save the motion score of
  15161. each frame with respect to the previous frame.
  15162. When filename equals "-" the data is sent to standard output.
  15163. @end table
  15164. Example:
  15165. @example
  15166. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  15167. @end example
  15168. @section vstack
  15169. Stack input videos vertically.
  15170. All streams must be of same pixel format and of same width.
  15171. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  15172. to create same output.
  15173. The filter accepts the following options:
  15174. @table @option
  15175. @item inputs
  15176. Set number of input streams. Default is 2.
  15177. @item shortest
  15178. If set to 1, force the output to terminate when the shortest input
  15179. terminates. Default value is 0.
  15180. @end table
  15181. @section w3fdif
  15182. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  15183. Deinterlacing Filter").
  15184. Based on the process described by Martin Weston for BBC R&D, and
  15185. implemented based on the de-interlace algorithm written by Jim
  15186. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  15187. uses filter coefficients calculated by BBC R&D.
  15188. This filter uses field-dominance information in frame to decide which
  15189. of each pair of fields to place first in the output.
  15190. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  15191. There are two sets of filter coefficients, so called "simple"
  15192. and "complex". Which set of filter coefficients is used can
  15193. be set by passing an optional parameter:
  15194. @table @option
  15195. @item filter
  15196. Set the interlacing filter coefficients. Accepts one of the following values:
  15197. @table @samp
  15198. @item simple
  15199. Simple filter coefficient set.
  15200. @item complex
  15201. More-complex filter coefficient set.
  15202. @end table
  15203. Default value is @samp{complex}.
  15204. @item deint
  15205. Specify which frames to deinterlace. Accepts one of the following values:
  15206. @table @samp
  15207. @item all
  15208. Deinterlace all frames,
  15209. @item interlaced
  15210. Only deinterlace frames marked as interlaced.
  15211. @end table
  15212. Default value is @samp{all}.
  15213. @end table
  15214. @section waveform
  15215. Video waveform monitor.
  15216. The waveform monitor plots color component intensity. By default luminance
  15217. only. Each column of the waveform corresponds to a column of pixels in the
  15218. source video.
  15219. It accepts the following options:
  15220. @table @option
  15221. @item mode, m
  15222. Can be either @code{row}, or @code{column}. Default is @code{column}.
  15223. In row mode, the graph on the left side represents color component value 0 and
  15224. the right side represents value = 255. In column mode, the top side represents
  15225. color component value = 0 and bottom side represents value = 255.
  15226. @item intensity, i
  15227. Set intensity. Smaller values are useful to find out how many values of the same
  15228. luminance are distributed across input rows/columns.
  15229. Default value is @code{0.04}. Allowed range is [0, 1].
  15230. @item mirror, r
  15231. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  15232. In mirrored mode, higher values will be represented on the left
  15233. side for @code{row} mode and at the top for @code{column} mode. Default is
  15234. @code{1} (mirrored).
  15235. @item display, d
  15236. Set display mode.
  15237. It accepts the following values:
  15238. @table @samp
  15239. @item overlay
  15240. Presents information identical to that in the @code{parade}, except
  15241. that the graphs representing color components are superimposed directly
  15242. over one another.
  15243. This display mode makes it easier to spot relative differences or similarities
  15244. in overlapping areas of the color components that are supposed to be identical,
  15245. such as neutral whites, grays, or blacks.
  15246. @item stack
  15247. Display separate graph for the color components side by side in
  15248. @code{row} mode or one below the other in @code{column} mode.
  15249. @item parade
  15250. Display separate graph for the color components side by side in
  15251. @code{column} mode or one below the other in @code{row} mode.
  15252. Using this display mode makes it easy to spot color casts in the highlights
  15253. and shadows of an image, by comparing the contours of the top and the bottom
  15254. graphs of each waveform. Since whites, grays, and blacks are characterized
  15255. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  15256. should display three waveforms of roughly equal width/height. If not, the
  15257. correction is easy to perform by making level adjustments the three waveforms.
  15258. @end table
  15259. Default is @code{stack}.
  15260. @item components, c
  15261. Set which color components to display. Default is 1, which means only luminance
  15262. or red color component if input is in RGB colorspace. If is set for example to
  15263. 7 it will display all 3 (if) available color components.
  15264. @item envelope, e
  15265. @table @samp
  15266. @item none
  15267. No envelope, this is default.
  15268. @item instant
  15269. Instant envelope, minimum and maximum values presented in graph will be easily
  15270. visible even with small @code{step} value.
  15271. @item peak
  15272. Hold minimum and maximum values presented in graph across time. This way you
  15273. can still spot out of range values without constantly looking at waveforms.
  15274. @item peak+instant
  15275. Peak and instant envelope combined together.
  15276. @end table
  15277. @item filter, f
  15278. @table @samp
  15279. @item lowpass
  15280. No filtering, this is default.
  15281. @item flat
  15282. Luma and chroma combined together.
  15283. @item aflat
  15284. Similar as above, but shows difference between blue and red chroma.
  15285. @item xflat
  15286. Similar as above, but use different colors.
  15287. @item yflat
  15288. Similar as above, but again with different colors.
  15289. @item chroma
  15290. Displays only chroma.
  15291. @item color
  15292. Displays actual color value on waveform.
  15293. @item acolor
  15294. Similar as above, but with luma showing frequency of chroma values.
  15295. @end table
  15296. @item graticule, g
  15297. Set which graticule to display.
  15298. @table @samp
  15299. @item none
  15300. Do not display graticule.
  15301. @item green
  15302. Display green graticule showing legal broadcast ranges.
  15303. @item orange
  15304. Display orange graticule showing legal broadcast ranges.
  15305. @item invert
  15306. Display invert graticule showing legal broadcast ranges.
  15307. @end table
  15308. @item opacity, o
  15309. Set graticule opacity.
  15310. @item flags, fl
  15311. Set graticule flags.
  15312. @table @samp
  15313. @item numbers
  15314. Draw numbers above lines. By default enabled.
  15315. @item dots
  15316. Draw dots instead of lines.
  15317. @end table
  15318. @item scale, s
  15319. Set scale used for displaying graticule.
  15320. @table @samp
  15321. @item digital
  15322. @item millivolts
  15323. @item ire
  15324. @end table
  15325. Default is digital.
  15326. @item bgopacity, b
  15327. Set background opacity.
  15328. @item tint0, t0
  15329. @item tint1, t1
  15330. Set tint for output.
  15331. Only used with lowpass filter and when display is not overlay and input
  15332. pixel formats are not RGB.
  15333. @end table
  15334. @section weave, doubleweave
  15335. The @code{weave} takes a field-based video input and join
  15336. each two sequential fields into single frame, producing a new double
  15337. height clip with half the frame rate and half the frame count.
  15338. The @code{doubleweave} works same as @code{weave} but without
  15339. halving frame rate and frame count.
  15340. It accepts the following option:
  15341. @table @option
  15342. @item first_field
  15343. Set first field. Available values are:
  15344. @table @samp
  15345. @item top, t
  15346. Set the frame as top-field-first.
  15347. @item bottom, b
  15348. Set the frame as bottom-field-first.
  15349. @end table
  15350. @end table
  15351. @subsection Examples
  15352. @itemize
  15353. @item
  15354. Interlace video using @ref{select} and @ref{separatefields} filter:
  15355. @example
  15356. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  15357. @end example
  15358. @end itemize
  15359. @section xbr
  15360. Apply the xBR high-quality magnification filter which is designed for pixel
  15361. art. It follows a set of edge-detection rules, see
  15362. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  15363. It accepts the following option:
  15364. @table @option
  15365. @item n
  15366. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  15367. @code{3xBR} and @code{4} for @code{4xBR}.
  15368. Default is @code{3}.
  15369. @end table
  15370. @section xfade
  15371. Apply cross fade from one input video stream to another input video stream.
  15372. The cross fade is applied for specified duration.
  15373. The filter accepts the following options:
  15374. @table @option
  15375. @item transition
  15376. Set one of available transition effects:
  15377. @table @samp
  15378. @item custom
  15379. @item fade
  15380. @item wipeleft
  15381. @item wiperight
  15382. @item wipeup
  15383. @item wipedown
  15384. @item slideleft
  15385. @item slideright
  15386. @item slideup
  15387. @item slidedown
  15388. @item circlecrop
  15389. @item rectcrop
  15390. @item distance
  15391. @item fadeblack
  15392. @item fadewhite
  15393. @item radial
  15394. @item smoothleft
  15395. @item smoothright
  15396. @item smoothup
  15397. @item smoothdown
  15398. @item circleopen
  15399. @item circleclose
  15400. @item vertopen
  15401. @item vertclose
  15402. @item horzopen
  15403. @item horzclose
  15404. @item dissolve
  15405. @item pixelize
  15406. @item diagtl
  15407. @item diagtr
  15408. @item diagbl
  15409. @item diagbr
  15410. @item hlslice
  15411. @item hrslice
  15412. @item vuslice
  15413. @item vdslice
  15414. @end table
  15415. Default transition effect is fade.
  15416. @item duration
  15417. Set cross fade duration in seconds.
  15418. Default duration is 1 second.
  15419. @item offset
  15420. Set cross fade start relative to first input stream in seconds.
  15421. Default offset is 0.
  15422. @item expr
  15423. Set expression for custom transition effect.
  15424. The expressions can use the following variables and functions:
  15425. @table @option
  15426. @item X
  15427. @item Y
  15428. The coordinates of the current sample.
  15429. @item W
  15430. @item H
  15431. The width and height of the image.
  15432. @item P
  15433. Progress of transition effect.
  15434. @item PLANE
  15435. Currently processed plane.
  15436. @item A
  15437. Return value of first input at current location and plane.
  15438. @item B
  15439. Return value of second input at current location and plane.
  15440. @item a0(x, y)
  15441. @item a1(x, y)
  15442. @item a2(x, y)
  15443. @item a3(x, y)
  15444. Return the value of the pixel at location (@var{x},@var{y}) of the
  15445. first/second/third/fourth component of first input.
  15446. @item b0(x, y)
  15447. @item b1(x, y)
  15448. @item b2(x, y)
  15449. @item b3(x, y)
  15450. Return the value of the pixel at location (@var{x},@var{y}) of the
  15451. first/second/third/fourth component of second input.
  15452. @end table
  15453. @end table
  15454. @subsection Examples
  15455. @itemize
  15456. @item
  15457. Cross fade from one input video to another input video, with fade transition and duration of transition
  15458. of 2 seconds starting at offset of 5 seconds:
  15459. @example
  15460. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  15461. @end example
  15462. @end itemize
  15463. @section xmedian
  15464. Pick median pixels from several input videos.
  15465. The filter accepts the following options:
  15466. @table @option
  15467. @item inputs
  15468. Set number of inputs.
  15469. Default is 3. Allowed range is from 3 to 255.
  15470. If number of inputs is even number, than result will be mean value between two median values.
  15471. @item planes
  15472. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  15473. @item percentile
  15474. Set median percentile. Default value is @code{0.5}.
  15475. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  15476. minimum values, and @code{1} maximum values.
  15477. @end table
  15478. @section xstack
  15479. Stack video inputs into custom layout.
  15480. All streams must be of same pixel format.
  15481. The filter accepts the following options:
  15482. @table @option
  15483. @item inputs
  15484. Set number of input streams. Default is 2.
  15485. @item layout
  15486. Specify layout of inputs.
  15487. This option requires the desired layout configuration to be explicitly set by the user.
  15488. This sets position of each video input in output. Each input
  15489. is separated by '|'.
  15490. The first number represents the column, and the second number represents the row.
  15491. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  15492. where X is video input from which to take width or height.
  15493. Multiple values can be used when separated by '+'. In such
  15494. case values are summed together.
  15495. Note that if inputs are of different sizes gaps may appear, as not all of
  15496. the output video frame will be filled. Similarly, videos can overlap each
  15497. other if their position doesn't leave enough space for the full frame of
  15498. adjoining videos.
  15499. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  15500. a layout must be set by the user.
  15501. @item shortest
  15502. If set to 1, force the output to terminate when the shortest input
  15503. terminates. Default value is 0.
  15504. @item fill
  15505. If set to valid color, all unused pixels will be filled with that color.
  15506. By default fill is set to none, so it is disabled.
  15507. @end table
  15508. @subsection Examples
  15509. @itemize
  15510. @item
  15511. Display 4 inputs into 2x2 grid.
  15512. Layout:
  15513. @example
  15514. input1(0, 0) | input3(w0, 0)
  15515. input2(0, h0) | input4(w0, h0)
  15516. @end example
  15517. @example
  15518. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  15519. @end example
  15520. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15521. @item
  15522. Display 4 inputs into 1x4 grid.
  15523. Layout:
  15524. @example
  15525. input1(0, 0)
  15526. input2(0, h0)
  15527. input3(0, h0+h1)
  15528. input4(0, h0+h1+h2)
  15529. @end example
  15530. @example
  15531. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  15532. @end example
  15533. Note that if inputs are of different widths, unused space will appear.
  15534. @item
  15535. Display 9 inputs into 3x3 grid.
  15536. Layout:
  15537. @example
  15538. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  15539. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  15540. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  15541. @end example
  15542. @example
  15543. 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
  15544. @end example
  15545. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15546. @item
  15547. Display 16 inputs into 4x4 grid.
  15548. Layout:
  15549. @example
  15550. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  15551. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  15552. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  15553. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  15554. @end example
  15555. @example
  15556. 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|
  15557. 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
  15558. @end example
  15559. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15560. @end itemize
  15561. @anchor{yadif}
  15562. @section yadif
  15563. Deinterlace the input video ("yadif" means "yet another deinterlacing
  15564. filter").
  15565. It accepts the following parameters:
  15566. @table @option
  15567. @item mode
  15568. The interlacing mode to adopt. It accepts one of the following values:
  15569. @table @option
  15570. @item 0, send_frame
  15571. Output one frame for each frame.
  15572. @item 1, send_field
  15573. Output one frame for each field.
  15574. @item 2, send_frame_nospatial
  15575. Like @code{send_frame}, but it skips the spatial interlacing check.
  15576. @item 3, send_field_nospatial
  15577. Like @code{send_field}, but it skips the spatial interlacing check.
  15578. @end table
  15579. The default value is @code{send_frame}.
  15580. @item parity
  15581. The picture field parity assumed for the input interlaced video. It accepts one
  15582. of the following values:
  15583. @table @option
  15584. @item 0, tff
  15585. Assume the top field is first.
  15586. @item 1, bff
  15587. Assume the bottom field is first.
  15588. @item -1, auto
  15589. Enable automatic detection of field parity.
  15590. @end table
  15591. The default value is @code{auto}.
  15592. If the interlacing is unknown or the decoder does not export this information,
  15593. top field first will be assumed.
  15594. @item deint
  15595. Specify which frames to deinterlace. Accepts one of the following
  15596. values:
  15597. @table @option
  15598. @item 0, all
  15599. Deinterlace all frames.
  15600. @item 1, interlaced
  15601. Only deinterlace frames marked as interlaced.
  15602. @end table
  15603. The default value is @code{all}.
  15604. @end table
  15605. @section yadif_cuda
  15606. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  15607. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  15608. and/or nvenc.
  15609. It accepts the following parameters:
  15610. @table @option
  15611. @item mode
  15612. The interlacing mode to adopt. It accepts one of the following values:
  15613. @table @option
  15614. @item 0, send_frame
  15615. Output one frame for each frame.
  15616. @item 1, send_field
  15617. Output one frame for each field.
  15618. @item 2, send_frame_nospatial
  15619. Like @code{send_frame}, but it skips the spatial interlacing check.
  15620. @item 3, send_field_nospatial
  15621. Like @code{send_field}, but it skips the spatial interlacing check.
  15622. @end table
  15623. The default value is @code{send_frame}.
  15624. @item parity
  15625. The picture field parity assumed for the input interlaced video. It accepts one
  15626. of the following values:
  15627. @table @option
  15628. @item 0, tff
  15629. Assume the top field is first.
  15630. @item 1, bff
  15631. Assume the bottom field is first.
  15632. @item -1, auto
  15633. Enable automatic detection of field parity.
  15634. @end table
  15635. The default value is @code{auto}.
  15636. If the interlacing is unknown or the decoder does not export this information,
  15637. top field first will be assumed.
  15638. @item deint
  15639. Specify which frames to deinterlace. Accepts one of the following
  15640. values:
  15641. @table @option
  15642. @item 0, all
  15643. Deinterlace all frames.
  15644. @item 1, interlaced
  15645. Only deinterlace frames marked as interlaced.
  15646. @end table
  15647. The default value is @code{all}.
  15648. @end table
  15649. @section yaepblur
  15650. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  15651. The algorithm is described in
  15652. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  15653. It accepts the following parameters:
  15654. @table @option
  15655. @item radius, r
  15656. Set the window radius. Default value is 3.
  15657. @item planes, p
  15658. Set which planes to filter. Default is only the first plane.
  15659. @item sigma, s
  15660. Set blur strength. Default value is 128.
  15661. @end table
  15662. @subsection Commands
  15663. This filter supports same @ref{commands} as options.
  15664. @section zoompan
  15665. Apply Zoom & Pan effect.
  15666. This filter accepts the following options:
  15667. @table @option
  15668. @item zoom, z
  15669. Set the zoom expression. Range is 1-10. Default is 1.
  15670. @item x
  15671. @item y
  15672. Set the x and y expression. Default is 0.
  15673. @item d
  15674. Set the duration expression in number of frames.
  15675. This sets for how many number of frames effect will last for
  15676. single input image.
  15677. @item s
  15678. Set the output image size, default is 'hd720'.
  15679. @item fps
  15680. Set the output frame rate, default is '25'.
  15681. @end table
  15682. Each expression can contain the following constants:
  15683. @table @option
  15684. @item in_w, iw
  15685. Input width.
  15686. @item in_h, ih
  15687. Input height.
  15688. @item out_w, ow
  15689. Output width.
  15690. @item out_h, oh
  15691. Output height.
  15692. @item in
  15693. Input frame count.
  15694. @item on
  15695. Output frame count.
  15696. @item x
  15697. @item y
  15698. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  15699. for current input frame.
  15700. @item px
  15701. @item py
  15702. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  15703. not yet such frame (first input frame).
  15704. @item zoom
  15705. Last calculated zoom from 'z' expression for current input frame.
  15706. @item pzoom
  15707. Last calculated zoom of last output frame of previous input frame.
  15708. @item duration
  15709. Number of output frames for current input frame. Calculated from 'd' expression
  15710. for each input frame.
  15711. @item pduration
  15712. number of output frames created for previous input frame
  15713. @item a
  15714. Rational number: input width / input height
  15715. @item sar
  15716. sample aspect ratio
  15717. @item dar
  15718. display aspect ratio
  15719. @end table
  15720. @subsection Examples
  15721. @itemize
  15722. @item
  15723. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  15724. @example
  15725. 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
  15726. @end example
  15727. @item
  15728. Zoom-in up to 1.5 and pan always at center of picture:
  15729. @example
  15730. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15731. @end example
  15732. @item
  15733. Same as above but without pausing:
  15734. @example
  15735. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15736. @end example
  15737. @end itemize
  15738. @anchor{zscale}
  15739. @section zscale
  15740. Scale (resize) the input video, using the z.lib library:
  15741. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  15742. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  15743. The zscale filter forces the output display aspect ratio to be the same
  15744. as the input, by changing the output sample aspect ratio.
  15745. If the input image format is different from the format requested by
  15746. the next filter, the zscale filter will convert the input to the
  15747. requested format.
  15748. @subsection Options
  15749. The filter accepts the following options.
  15750. @table @option
  15751. @item width, w
  15752. @item height, h
  15753. Set the output video dimension expression. Default value is the input
  15754. dimension.
  15755. If the @var{width} or @var{w} value is 0, the input width is used for
  15756. the output. If the @var{height} or @var{h} value is 0, the input height
  15757. is used for the output.
  15758. If one and only one of the values is -n with n >= 1, the zscale filter
  15759. will use a value that maintains the aspect ratio of the input image,
  15760. calculated from the other specified dimension. After that it will,
  15761. however, make sure that the calculated dimension is divisible by n and
  15762. adjust the value if necessary.
  15763. If both values are -n with n >= 1, the behavior will be identical to
  15764. both values being set to 0 as previously detailed.
  15765. See below for the list of accepted constants for use in the dimension
  15766. expression.
  15767. @item size, s
  15768. Set the video size. For the syntax of this option, check the
  15769. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15770. @item dither, d
  15771. Set the dither type.
  15772. Possible values are:
  15773. @table @var
  15774. @item none
  15775. @item ordered
  15776. @item random
  15777. @item error_diffusion
  15778. @end table
  15779. Default is none.
  15780. @item filter, f
  15781. Set the resize filter type.
  15782. Possible values are:
  15783. @table @var
  15784. @item point
  15785. @item bilinear
  15786. @item bicubic
  15787. @item spline16
  15788. @item spline36
  15789. @item lanczos
  15790. @end table
  15791. Default is bilinear.
  15792. @item range, r
  15793. Set the color range.
  15794. Possible values are:
  15795. @table @var
  15796. @item input
  15797. @item limited
  15798. @item full
  15799. @end table
  15800. Default is same as input.
  15801. @item primaries, p
  15802. Set the color primaries.
  15803. Possible values are:
  15804. @table @var
  15805. @item input
  15806. @item 709
  15807. @item unspecified
  15808. @item 170m
  15809. @item 240m
  15810. @item 2020
  15811. @end table
  15812. Default is same as input.
  15813. @item transfer, t
  15814. Set the transfer characteristics.
  15815. Possible values are:
  15816. @table @var
  15817. @item input
  15818. @item 709
  15819. @item unspecified
  15820. @item 601
  15821. @item linear
  15822. @item 2020_10
  15823. @item 2020_12
  15824. @item smpte2084
  15825. @item iec61966-2-1
  15826. @item arib-std-b67
  15827. @end table
  15828. Default is same as input.
  15829. @item matrix, m
  15830. Set the colorspace matrix.
  15831. Possible value are:
  15832. @table @var
  15833. @item input
  15834. @item 709
  15835. @item unspecified
  15836. @item 470bg
  15837. @item 170m
  15838. @item 2020_ncl
  15839. @item 2020_cl
  15840. @end table
  15841. Default is same as input.
  15842. @item rangein, rin
  15843. Set the input color range.
  15844. Possible values are:
  15845. @table @var
  15846. @item input
  15847. @item limited
  15848. @item full
  15849. @end table
  15850. Default is same as input.
  15851. @item primariesin, pin
  15852. Set the input color primaries.
  15853. Possible values are:
  15854. @table @var
  15855. @item input
  15856. @item 709
  15857. @item unspecified
  15858. @item 170m
  15859. @item 240m
  15860. @item 2020
  15861. @end table
  15862. Default is same as input.
  15863. @item transferin, tin
  15864. Set the input transfer characteristics.
  15865. Possible values are:
  15866. @table @var
  15867. @item input
  15868. @item 709
  15869. @item unspecified
  15870. @item 601
  15871. @item linear
  15872. @item 2020_10
  15873. @item 2020_12
  15874. @end table
  15875. Default is same as input.
  15876. @item matrixin, min
  15877. Set the input colorspace matrix.
  15878. Possible value are:
  15879. @table @var
  15880. @item input
  15881. @item 709
  15882. @item unspecified
  15883. @item 470bg
  15884. @item 170m
  15885. @item 2020_ncl
  15886. @item 2020_cl
  15887. @end table
  15888. @item chromal, c
  15889. Set the output chroma location.
  15890. Possible values are:
  15891. @table @var
  15892. @item input
  15893. @item left
  15894. @item center
  15895. @item topleft
  15896. @item top
  15897. @item bottomleft
  15898. @item bottom
  15899. @end table
  15900. @item chromalin, cin
  15901. Set the input chroma location.
  15902. Possible values are:
  15903. @table @var
  15904. @item input
  15905. @item left
  15906. @item center
  15907. @item topleft
  15908. @item top
  15909. @item bottomleft
  15910. @item bottom
  15911. @end table
  15912. @item npl
  15913. Set the nominal peak luminance.
  15914. @end table
  15915. The values of the @option{w} and @option{h} options are expressions
  15916. containing the following constants:
  15917. @table @var
  15918. @item in_w
  15919. @item in_h
  15920. The input width and height
  15921. @item iw
  15922. @item ih
  15923. These are the same as @var{in_w} and @var{in_h}.
  15924. @item out_w
  15925. @item out_h
  15926. The output (scaled) width and height
  15927. @item ow
  15928. @item oh
  15929. These are the same as @var{out_w} and @var{out_h}
  15930. @item a
  15931. The same as @var{iw} / @var{ih}
  15932. @item sar
  15933. input sample aspect ratio
  15934. @item dar
  15935. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15936. @item hsub
  15937. @item vsub
  15938. horizontal and vertical input chroma subsample values. For example for the
  15939. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15940. @item ohsub
  15941. @item ovsub
  15942. horizontal and vertical output chroma subsample values. For example for the
  15943. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15944. @end table
  15945. @subsection Commands
  15946. This filter supports the following commands:
  15947. @table @option
  15948. @item width, w
  15949. @item height, h
  15950. Set the output video dimension expression.
  15951. The command accepts the same syntax of the corresponding option.
  15952. If the specified expression is not valid, it is kept at its current
  15953. value.
  15954. @end table
  15955. @c man end VIDEO FILTERS
  15956. @chapter OpenCL Video Filters
  15957. @c man begin OPENCL VIDEO FILTERS
  15958. Below is a description of the currently available OpenCL video filters.
  15959. To enable compilation of these filters you need to configure FFmpeg with
  15960. @code{--enable-opencl}.
  15961. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  15962. @table @option
  15963. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  15964. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  15965. given device parameters.
  15966. @item -filter_hw_device @var{name}
  15967. Pass the hardware device called @var{name} to all filters in any filter graph.
  15968. @end table
  15969. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  15970. @itemize
  15971. @item
  15972. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  15973. @example
  15974. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  15975. @end example
  15976. @end itemize
  15977. 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.
  15978. @section avgblur_opencl
  15979. Apply average blur filter.
  15980. The filter accepts the following options:
  15981. @table @option
  15982. @item sizeX
  15983. Set horizontal radius size.
  15984. Range is @code{[1, 1024]} and default value is @code{1}.
  15985. @item planes
  15986. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15987. @item sizeY
  15988. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  15989. @end table
  15990. @subsection Example
  15991. @itemize
  15992. @item
  15993. 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.
  15994. @example
  15995. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  15996. @end example
  15997. @end itemize
  15998. @section boxblur_opencl
  15999. Apply a boxblur algorithm to the input video.
  16000. It accepts the following parameters:
  16001. @table @option
  16002. @item luma_radius, lr
  16003. @item luma_power, lp
  16004. @item chroma_radius, cr
  16005. @item chroma_power, cp
  16006. @item alpha_radius, ar
  16007. @item alpha_power, ap
  16008. @end table
  16009. A description of the accepted options follows.
  16010. @table @option
  16011. @item luma_radius, lr
  16012. @item chroma_radius, cr
  16013. @item alpha_radius, ar
  16014. Set an expression for the box radius in pixels used for blurring the
  16015. corresponding input plane.
  16016. The radius value must be a non-negative number, and must not be
  16017. greater than the value of the expression @code{min(w,h)/2} for the
  16018. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  16019. planes.
  16020. Default value for @option{luma_radius} is "2". If not specified,
  16021. @option{chroma_radius} and @option{alpha_radius} default to the
  16022. corresponding value set for @option{luma_radius}.
  16023. The expressions can contain the following constants:
  16024. @table @option
  16025. @item w
  16026. @item h
  16027. The input width and height in pixels.
  16028. @item cw
  16029. @item ch
  16030. The input chroma image width and height in pixels.
  16031. @item hsub
  16032. @item vsub
  16033. The horizontal and vertical chroma subsample values. For example, for the
  16034. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  16035. @end table
  16036. @item luma_power, lp
  16037. @item chroma_power, cp
  16038. @item alpha_power, ap
  16039. Specify how many times the boxblur filter is applied to the
  16040. corresponding plane.
  16041. Default value for @option{luma_power} is 2. If not specified,
  16042. @option{chroma_power} and @option{alpha_power} default to the
  16043. corresponding value set for @option{luma_power}.
  16044. A value of 0 will disable the effect.
  16045. @end table
  16046. @subsection Examples
  16047. 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.
  16048. @itemize
  16049. @item
  16050. Apply a boxblur filter with the luma, chroma, and alpha radius
  16051. 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.
  16052. @example
  16053. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  16054. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  16055. @end example
  16056. @item
  16057. 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.
  16058. For the luma plane, a 2x2 box radius will be run once.
  16059. For the chroma plane, a 4x4 box radius will be run 5 times.
  16060. For the alpha plane, a 3x3 box radius will be run 7 times.
  16061. @example
  16062. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  16063. @end example
  16064. @end itemize
  16065. @section colorkey_opencl
  16066. RGB colorspace color keying.
  16067. The filter accepts the following options:
  16068. @table @option
  16069. @item color
  16070. The color which will be replaced with transparency.
  16071. @item similarity
  16072. Similarity percentage with the key color.
  16073. 0.01 matches only the exact key color, while 1.0 matches everything.
  16074. @item blend
  16075. Blend percentage.
  16076. 0.0 makes pixels either fully transparent, or not transparent at all.
  16077. Higher values result in semi-transparent pixels, with a higher transparency
  16078. the more similar the pixels color is to the key color.
  16079. @end table
  16080. @subsection Examples
  16081. @itemize
  16082. @item
  16083. Make every semi-green pixel in the input transparent with some slight blending:
  16084. @example
  16085. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  16086. @end example
  16087. @end itemize
  16088. @section convolution_opencl
  16089. Apply convolution of 3x3, 5x5, 7x7 matrix.
  16090. The filter accepts the following options:
  16091. @table @option
  16092. @item 0m
  16093. @item 1m
  16094. @item 2m
  16095. @item 3m
  16096. Set matrix for each plane.
  16097. Matrix is sequence of 9, 25 or 49 signed numbers.
  16098. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  16099. @item 0rdiv
  16100. @item 1rdiv
  16101. @item 2rdiv
  16102. @item 3rdiv
  16103. Set multiplier for calculated value for each plane.
  16104. If unset or 0, it will be sum of all matrix elements.
  16105. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  16106. @item 0bias
  16107. @item 1bias
  16108. @item 2bias
  16109. @item 3bias
  16110. Set bias for each plane. This value is added to the result of the multiplication.
  16111. Useful for making the overall image brighter or darker.
  16112. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  16113. @end table
  16114. @subsection Examples
  16115. @itemize
  16116. @item
  16117. Apply sharpen:
  16118. @example
  16119. -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
  16120. @end example
  16121. @item
  16122. Apply blur:
  16123. @example
  16124. -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
  16125. @end example
  16126. @item
  16127. Apply edge enhance:
  16128. @example
  16129. -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
  16130. @end example
  16131. @item
  16132. Apply edge detect:
  16133. @example
  16134. -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
  16135. @end example
  16136. @item
  16137. Apply laplacian edge detector which includes diagonals:
  16138. @example
  16139. -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
  16140. @end example
  16141. @item
  16142. Apply emboss:
  16143. @example
  16144. -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
  16145. @end example
  16146. @end itemize
  16147. @section erosion_opencl
  16148. Apply erosion effect to the video.
  16149. This filter replaces the pixel by the local(3x3) minimum.
  16150. It accepts the following options:
  16151. @table @option
  16152. @item threshold0
  16153. @item threshold1
  16154. @item threshold2
  16155. @item threshold3
  16156. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16157. If @code{0}, plane will remain unchanged.
  16158. @item coordinates
  16159. Flag which specifies the pixel to refer to.
  16160. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16161. Flags to local 3x3 coordinates region centered on @code{x}:
  16162. 1 2 3
  16163. 4 x 5
  16164. 6 7 8
  16165. @end table
  16166. @subsection Example
  16167. @itemize
  16168. @item
  16169. 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.
  16170. @example
  16171. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16172. @end example
  16173. @end itemize
  16174. @section deshake_opencl
  16175. Feature-point based video stabilization filter.
  16176. The filter accepts the following options:
  16177. @table @option
  16178. @item tripod
  16179. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  16180. @item debug
  16181. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  16182. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  16183. Viewing point matches in the output video is only supported for RGB input.
  16184. Defaults to @code{0}.
  16185. @item adaptive_crop
  16186. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  16187. Defaults to @code{1}.
  16188. @item refine_features
  16189. Whether or not feature points should be refined at a sub-pixel level.
  16190. This can be turned off for a slight performance gain at the cost of precision.
  16191. Defaults to @code{1}.
  16192. @item smooth_strength
  16193. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  16194. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  16195. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  16196. Defaults to @code{0.0}.
  16197. @item smooth_window_multiplier
  16198. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  16199. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  16200. Acceptable values range from @code{0.1} to @code{10.0}.
  16201. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  16202. potentially improving smoothness, but also increase latency and memory usage.
  16203. Defaults to @code{2.0}.
  16204. @end table
  16205. @subsection Examples
  16206. @itemize
  16207. @item
  16208. Stabilize a video with a fixed, medium smoothing strength:
  16209. @example
  16210. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  16211. @end example
  16212. @item
  16213. Stabilize a video with debugging (both in console and in rendered video):
  16214. @example
  16215. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  16216. @end example
  16217. @end itemize
  16218. @section dilation_opencl
  16219. Apply dilation effect to the video.
  16220. This filter replaces the pixel by the local(3x3) maximum.
  16221. It accepts the following options:
  16222. @table @option
  16223. @item threshold0
  16224. @item threshold1
  16225. @item threshold2
  16226. @item threshold3
  16227. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16228. If @code{0}, plane will remain unchanged.
  16229. @item coordinates
  16230. Flag which specifies the pixel to refer to.
  16231. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16232. Flags to local 3x3 coordinates region centered on @code{x}:
  16233. 1 2 3
  16234. 4 x 5
  16235. 6 7 8
  16236. @end table
  16237. @subsection Example
  16238. @itemize
  16239. @item
  16240. 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.
  16241. @example
  16242. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16243. @end example
  16244. @end itemize
  16245. @section nlmeans_opencl
  16246. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  16247. @section overlay_opencl
  16248. Overlay one video on top of another.
  16249. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  16250. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  16251. The filter accepts the following options:
  16252. @table @option
  16253. @item x
  16254. Set the x coordinate of the overlaid video on the main video.
  16255. Default value is @code{0}.
  16256. @item y
  16257. Set the y coordinate of the overlaid video on the main video.
  16258. Default value is @code{0}.
  16259. @end table
  16260. @subsection Examples
  16261. @itemize
  16262. @item
  16263. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  16264. @example
  16265. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16266. @end example
  16267. @item
  16268. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  16269. @example
  16270. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16271. @end example
  16272. @end itemize
  16273. @section pad_opencl
  16274. Add paddings to the input image, and place the original input at the
  16275. provided @var{x}, @var{y} coordinates.
  16276. It accepts the following options:
  16277. @table @option
  16278. @item width, w
  16279. @item height, h
  16280. Specify an expression for the size of the output image with the
  16281. paddings added. If the value for @var{width} or @var{height} is 0, the
  16282. corresponding input size is used for the output.
  16283. The @var{width} expression can reference the value set by the
  16284. @var{height} expression, and vice versa.
  16285. The default value of @var{width} and @var{height} is 0.
  16286. @item x
  16287. @item y
  16288. Specify the offsets to place the input image at within the padded area,
  16289. with respect to the top/left border of the output image.
  16290. The @var{x} expression can reference the value set by the @var{y}
  16291. expression, and vice versa.
  16292. The default value of @var{x} and @var{y} is 0.
  16293. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  16294. so the input image is centered on the padded area.
  16295. @item color
  16296. Specify the color of the padded area. For the syntax of this option,
  16297. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  16298. manual,ffmpeg-utils}.
  16299. @item aspect
  16300. Pad to an aspect instead to a resolution.
  16301. @end table
  16302. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  16303. options are expressions containing the following constants:
  16304. @table @option
  16305. @item in_w
  16306. @item in_h
  16307. The input video width and height.
  16308. @item iw
  16309. @item ih
  16310. These are the same as @var{in_w} and @var{in_h}.
  16311. @item out_w
  16312. @item out_h
  16313. The output width and height (the size of the padded area), as
  16314. specified by the @var{width} and @var{height} expressions.
  16315. @item ow
  16316. @item oh
  16317. These are the same as @var{out_w} and @var{out_h}.
  16318. @item x
  16319. @item y
  16320. The x and y offsets as specified by the @var{x} and @var{y}
  16321. expressions, or NAN if not yet specified.
  16322. @item a
  16323. same as @var{iw} / @var{ih}
  16324. @item sar
  16325. input sample aspect ratio
  16326. @item dar
  16327. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  16328. @end table
  16329. @section prewitt_opencl
  16330. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  16331. The filter accepts the following option:
  16332. @table @option
  16333. @item planes
  16334. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16335. @item scale
  16336. Set value which will be multiplied with filtered result.
  16337. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16338. @item delta
  16339. Set value which will be added to filtered result.
  16340. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16341. @end table
  16342. @subsection Example
  16343. @itemize
  16344. @item
  16345. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  16346. @example
  16347. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16348. @end example
  16349. @end itemize
  16350. @anchor{program_opencl}
  16351. @section program_opencl
  16352. Filter video using an OpenCL program.
  16353. @table @option
  16354. @item source
  16355. OpenCL program source file.
  16356. @item kernel
  16357. Kernel name in program.
  16358. @item inputs
  16359. Number of inputs to the filter. Defaults to 1.
  16360. @item size, s
  16361. Size of output frames. Defaults to the same as the first input.
  16362. @end table
  16363. The @code{program_opencl} filter also supports the @ref{framesync} options.
  16364. The program source file must contain a kernel function with the given name,
  16365. which will be run once for each plane of the output. Each run on a plane
  16366. gets enqueued as a separate 2D global NDRange with one work-item for each
  16367. pixel to be generated. The global ID offset for each work-item is therefore
  16368. the coordinates of a pixel in the destination image.
  16369. The kernel function needs to take the following arguments:
  16370. @itemize
  16371. @item
  16372. Destination image, @var{__write_only image2d_t}.
  16373. This image will become the output; the kernel should write all of it.
  16374. @item
  16375. Frame index, @var{unsigned int}.
  16376. This is a counter starting from zero and increasing by one for each frame.
  16377. @item
  16378. Source images, @var{__read_only image2d_t}.
  16379. These are the most recent images on each input. The kernel may read from
  16380. them to generate the output, but they can't be written to.
  16381. @end itemize
  16382. Example programs:
  16383. @itemize
  16384. @item
  16385. Copy the input to the output (output must be the same size as the input).
  16386. @verbatim
  16387. __kernel void copy(__write_only image2d_t destination,
  16388. unsigned int index,
  16389. __read_only image2d_t source)
  16390. {
  16391. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  16392. int2 location = (int2)(get_global_id(0), get_global_id(1));
  16393. float4 value = read_imagef(source, sampler, location);
  16394. write_imagef(destination, location, value);
  16395. }
  16396. @end verbatim
  16397. @item
  16398. Apply a simple transformation, rotating the input by an amount increasing
  16399. with the index counter. Pixel values are linearly interpolated by the
  16400. sampler, and the output need not have the same dimensions as the input.
  16401. @verbatim
  16402. __kernel void rotate_image(__write_only image2d_t dst,
  16403. unsigned int index,
  16404. __read_only image2d_t src)
  16405. {
  16406. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16407. CLK_FILTER_LINEAR);
  16408. float angle = (float)index / 100.0f;
  16409. float2 dst_dim = convert_float2(get_image_dim(dst));
  16410. float2 src_dim = convert_float2(get_image_dim(src));
  16411. float2 dst_cen = dst_dim / 2.0f;
  16412. float2 src_cen = src_dim / 2.0f;
  16413. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16414. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  16415. float2 src_pos = {
  16416. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  16417. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  16418. };
  16419. src_pos = src_pos * src_dim / dst_dim;
  16420. float2 src_loc = src_pos + src_cen;
  16421. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  16422. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  16423. write_imagef(dst, dst_loc, 0.5f);
  16424. else
  16425. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  16426. }
  16427. @end verbatim
  16428. @item
  16429. Blend two inputs together, with the amount of each input used varying
  16430. with the index counter.
  16431. @verbatim
  16432. __kernel void blend_images(__write_only image2d_t dst,
  16433. unsigned int index,
  16434. __read_only image2d_t src1,
  16435. __read_only image2d_t src2)
  16436. {
  16437. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16438. CLK_FILTER_LINEAR);
  16439. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  16440. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16441. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  16442. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  16443. float4 val1 = read_imagef(src1, sampler, src1_loc);
  16444. float4 val2 = read_imagef(src2, sampler, src2_loc);
  16445. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  16446. }
  16447. @end verbatim
  16448. @end itemize
  16449. @section roberts_opencl
  16450. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  16451. The filter accepts the following option:
  16452. @table @option
  16453. @item planes
  16454. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16455. @item scale
  16456. Set value which will be multiplied with filtered result.
  16457. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16458. @item delta
  16459. Set value which will be added to filtered result.
  16460. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16461. @end table
  16462. @subsection Example
  16463. @itemize
  16464. @item
  16465. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  16466. @example
  16467. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16468. @end example
  16469. @end itemize
  16470. @section sobel_opencl
  16471. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  16472. The filter accepts the following option:
  16473. @table @option
  16474. @item planes
  16475. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16476. @item scale
  16477. Set value which will be multiplied with filtered result.
  16478. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16479. @item delta
  16480. Set value which will be added to filtered result.
  16481. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16482. @end table
  16483. @subsection Example
  16484. @itemize
  16485. @item
  16486. Apply sobel operator with scale set to 2 and delta set to 10
  16487. @example
  16488. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16489. @end example
  16490. @end itemize
  16491. @section tonemap_opencl
  16492. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  16493. It accepts the following parameters:
  16494. @table @option
  16495. @item tonemap
  16496. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  16497. @item param
  16498. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  16499. @item desat
  16500. Apply desaturation for highlights that exceed this level of brightness. The
  16501. higher the parameter, the more color information will be preserved. This
  16502. setting helps prevent unnaturally blown-out colors for super-highlights, by
  16503. (smoothly) turning into white instead. This makes images feel more natural,
  16504. at the cost of reducing information about out-of-range colors.
  16505. The default value is 0.5, and the algorithm here is a little different from
  16506. the cpu version tonemap currently. A setting of 0.0 disables this option.
  16507. @item threshold
  16508. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  16509. is used to detect whether the scene has changed or not. If the distance between
  16510. the current frame average brightness and the current running average exceeds
  16511. a threshold value, we would re-calculate scene average and peak brightness.
  16512. The default value is 0.2.
  16513. @item format
  16514. Specify the output pixel format.
  16515. Currently supported formats are:
  16516. @table @var
  16517. @item p010
  16518. @item nv12
  16519. @end table
  16520. @item range, r
  16521. Set the output color range.
  16522. Possible values are:
  16523. @table @var
  16524. @item tv/mpeg
  16525. @item pc/jpeg
  16526. @end table
  16527. Default is same as input.
  16528. @item primaries, p
  16529. Set the output color primaries.
  16530. Possible values are:
  16531. @table @var
  16532. @item bt709
  16533. @item bt2020
  16534. @end table
  16535. Default is same as input.
  16536. @item transfer, t
  16537. Set the output transfer characteristics.
  16538. Possible values are:
  16539. @table @var
  16540. @item bt709
  16541. @item bt2020
  16542. @end table
  16543. Default is bt709.
  16544. @item matrix, m
  16545. Set the output colorspace matrix.
  16546. Possible value are:
  16547. @table @var
  16548. @item bt709
  16549. @item bt2020
  16550. @end table
  16551. Default is same as input.
  16552. @end table
  16553. @subsection Example
  16554. @itemize
  16555. @item
  16556. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  16557. @example
  16558. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  16559. @end example
  16560. @end itemize
  16561. @section unsharp_opencl
  16562. Sharpen or blur the input video.
  16563. It accepts the following parameters:
  16564. @table @option
  16565. @item luma_msize_x, lx
  16566. Set the luma matrix horizontal size.
  16567. Range is @code{[1, 23]} and default value is @code{5}.
  16568. @item luma_msize_y, ly
  16569. Set the luma matrix vertical size.
  16570. Range is @code{[1, 23]} and default value is @code{5}.
  16571. @item luma_amount, la
  16572. Set the luma effect strength.
  16573. Range is @code{[-10, 10]} and default value is @code{1.0}.
  16574. Negative values will blur the input video, while positive values will
  16575. sharpen it, a value of zero will disable the effect.
  16576. @item chroma_msize_x, cx
  16577. Set the chroma matrix horizontal size.
  16578. Range is @code{[1, 23]} and default value is @code{5}.
  16579. @item chroma_msize_y, cy
  16580. Set the chroma matrix vertical size.
  16581. Range is @code{[1, 23]} and default value is @code{5}.
  16582. @item chroma_amount, ca
  16583. Set the chroma effect strength.
  16584. Range is @code{[-10, 10]} and default value is @code{0.0}.
  16585. Negative values will blur the input video, while positive values will
  16586. sharpen it, a value of zero will disable the effect.
  16587. @end table
  16588. All parameters are optional and default to the equivalent of the
  16589. string '5:5:1.0:5:5:0.0'.
  16590. @subsection Examples
  16591. @itemize
  16592. @item
  16593. Apply strong luma sharpen effect:
  16594. @example
  16595. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  16596. @end example
  16597. @item
  16598. Apply a strong blur of both luma and chroma parameters:
  16599. @example
  16600. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  16601. @end example
  16602. @end itemize
  16603. @section xfade_opencl
  16604. Cross fade two videos with custom transition effect by using OpenCL.
  16605. It accepts the following options:
  16606. @table @option
  16607. @item transition
  16608. Set one of possible transition effects.
  16609. @table @option
  16610. @item custom
  16611. Select custom transition effect, the actual transition description
  16612. will be picked from source and kernel options.
  16613. @item fade
  16614. @item wipeleft
  16615. @item wiperight
  16616. @item wipeup
  16617. @item wipedown
  16618. @item slideleft
  16619. @item slideright
  16620. @item slideup
  16621. @item slidedown
  16622. Default transition is fade.
  16623. @end table
  16624. @item source
  16625. OpenCL program source file for custom transition.
  16626. @item kernel
  16627. Set name of kernel to use for custom transition from program source file.
  16628. @item duration
  16629. Set duration of video transition.
  16630. @item offset
  16631. Set time of start of transition relative to first video.
  16632. @end table
  16633. The program source file must contain a kernel function with the given name,
  16634. which will be run once for each plane of the output. Each run on a plane
  16635. gets enqueued as a separate 2D global NDRange with one work-item for each
  16636. pixel to be generated. The global ID offset for each work-item is therefore
  16637. the coordinates of a pixel in the destination image.
  16638. The kernel function needs to take the following arguments:
  16639. @itemize
  16640. @item
  16641. Destination image, @var{__write_only image2d_t}.
  16642. This image will become the output; the kernel should write all of it.
  16643. @item
  16644. First Source image, @var{__read_only image2d_t}.
  16645. Second Source image, @var{__read_only image2d_t}.
  16646. These are the most recent images on each input. The kernel may read from
  16647. them to generate the output, but they can't be written to.
  16648. @item
  16649. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  16650. @end itemize
  16651. Example programs:
  16652. @itemize
  16653. @item
  16654. Apply dots curtain transition effect:
  16655. @verbatim
  16656. __kernel void blend_images(__write_only image2d_t dst,
  16657. __read_only image2d_t src1,
  16658. __read_only image2d_t src2,
  16659. float progress)
  16660. {
  16661. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16662. CLK_FILTER_LINEAR);
  16663. int2 p = (int2)(get_global_id(0), get_global_id(1));
  16664. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  16665. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  16666. rp = rp / dim;
  16667. float2 dots = (float2)(20.0, 20.0);
  16668. float2 center = (float2)(0,0);
  16669. float2 unused;
  16670. float4 val1 = read_imagef(src1, sampler, p);
  16671. float4 val2 = read_imagef(src2, sampler, p);
  16672. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  16673. write_imagef(dst, p, next ? val1 : val2);
  16674. }
  16675. @end verbatim
  16676. @end itemize
  16677. @c man end OPENCL VIDEO FILTERS
  16678. @chapter VAAPI Video Filters
  16679. @c man begin VAAPI VIDEO FILTERS
  16680. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  16681. To enable compilation of these filters you need to configure FFmpeg with
  16682. @code{--enable-vaapi}.
  16683. 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}
  16684. @section tonemap_vaapi
  16685. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  16686. It maps the dynamic range of HDR10 content to the SDR content.
  16687. It currently only accepts HDR10 as input.
  16688. It accepts the following parameters:
  16689. @table @option
  16690. @item format
  16691. Specify the output pixel format.
  16692. Currently supported formats are:
  16693. @table @var
  16694. @item p010
  16695. @item nv12
  16696. @end table
  16697. Default is nv12.
  16698. @item primaries, p
  16699. Set the output color primaries.
  16700. Default is same as input.
  16701. @item transfer, t
  16702. Set the output transfer characteristics.
  16703. Default is bt709.
  16704. @item matrix, m
  16705. Set the output colorspace matrix.
  16706. Default is same as input.
  16707. @end table
  16708. @subsection Example
  16709. @itemize
  16710. @item
  16711. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  16712. @example
  16713. tonemap_vaapi=format=p010:t=bt2020-10
  16714. @end example
  16715. @end itemize
  16716. @c man end VAAPI VIDEO FILTERS
  16717. @chapter Video Sources
  16718. @c man begin VIDEO SOURCES
  16719. Below is a description of the currently available video sources.
  16720. @section buffer
  16721. Buffer video frames, and make them available to the filter chain.
  16722. This source is mainly intended for a programmatic use, in particular
  16723. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  16724. It accepts the following parameters:
  16725. @table @option
  16726. @item video_size
  16727. Specify the size (width and height) of the buffered video frames. For the
  16728. syntax of this option, check the
  16729. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16730. @item width
  16731. The input video width.
  16732. @item height
  16733. The input video height.
  16734. @item pix_fmt
  16735. A string representing the pixel format of the buffered video frames.
  16736. It may be a number corresponding to a pixel format, or a pixel format
  16737. name.
  16738. @item time_base
  16739. Specify the timebase assumed by the timestamps of the buffered frames.
  16740. @item frame_rate
  16741. Specify the frame rate expected for the video stream.
  16742. @item pixel_aspect, sar
  16743. The sample (pixel) aspect ratio of the input video.
  16744. @item sws_param
  16745. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  16746. to the filtergraph description to specify swscale flags for automatically
  16747. inserted scalers. See @ref{Filtergraph syntax}.
  16748. @item hw_frames_ctx
  16749. When using a hardware pixel format, this should be a reference to an
  16750. AVHWFramesContext describing input frames.
  16751. @end table
  16752. For example:
  16753. @example
  16754. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  16755. @end example
  16756. will instruct the source to accept video frames with size 320x240 and
  16757. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  16758. square pixels (1:1 sample aspect ratio).
  16759. Since the pixel format with name "yuv410p" corresponds to the number 6
  16760. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  16761. this example corresponds to:
  16762. @example
  16763. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  16764. @end example
  16765. Alternatively, the options can be specified as a flat string, but this
  16766. syntax is deprecated:
  16767. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  16768. @section cellauto
  16769. Create a pattern generated by an elementary cellular automaton.
  16770. The initial state of the cellular automaton can be defined through the
  16771. @option{filename} and @option{pattern} options. If such options are
  16772. not specified an initial state is created randomly.
  16773. At each new frame a new row in the video is filled with the result of
  16774. the cellular automaton next generation. The behavior when the whole
  16775. frame is filled is defined by the @option{scroll} option.
  16776. This source accepts the following options:
  16777. @table @option
  16778. @item filename, f
  16779. Read the initial cellular automaton state, i.e. the starting row, from
  16780. the specified file.
  16781. In the file, each non-whitespace character is considered an alive
  16782. cell, a newline will terminate the row, and further characters in the
  16783. file will be ignored.
  16784. @item pattern, p
  16785. Read the initial cellular automaton state, i.e. the starting row, from
  16786. the specified string.
  16787. Each non-whitespace character in the string is considered an alive
  16788. cell, a newline will terminate the row, and further characters in the
  16789. string will be ignored.
  16790. @item rate, r
  16791. Set the video rate, that is the number of frames generated per second.
  16792. Default is 25.
  16793. @item random_fill_ratio, ratio
  16794. Set the random fill ratio for the initial cellular automaton row. It
  16795. is a floating point number value ranging from 0 to 1, defaults to
  16796. 1/PHI.
  16797. This option is ignored when a file or a pattern is specified.
  16798. @item random_seed, seed
  16799. Set the seed for filling randomly the initial row, must be an integer
  16800. included between 0 and UINT32_MAX. If not specified, or if explicitly
  16801. set to -1, the filter will try to use a good random seed on a best
  16802. effort basis.
  16803. @item rule
  16804. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  16805. Default value is 110.
  16806. @item size, s
  16807. Set the size of the output video. For the syntax of this option, check the
  16808. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16809. If @option{filename} or @option{pattern} is specified, the size is set
  16810. by default to the width of the specified initial state row, and the
  16811. height is set to @var{width} * PHI.
  16812. If @option{size} is set, it must contain the width of the specified
  16813. pattern string, and the specified pattern will be centered in the
  16814. larger row.
  16815. If a filename or a pattern string is not specified, the size value
  16816. defaults to "320x518" (used for a randomly generated initial state).
  16817. @item scroll
  16818. If set to 1, scroll the output upward when all the rows in the output
  16819. have been already filled. If set to 0, the new generated row will be
  16820. written over the top row just after the bottom row is filled.
  16821. Defaults to 1.
  16822. @item start_full, full
  16823. If set to 1, completely fill the output with generated rows before
  16824. outputting the first frame.
  16825. This is the default behavior, for disabling set the value to 0.
  16826. @item stitch
  16827. If set to 1, stitch the left and right row edges together.
  16828. This is the default behavior, for disabling set the value to 0.
  16829. @end table
  16830. @subsection Examples
  16831. @itemize
  16832. @item
  16833. Read the initial state from @file{pattern}, and specify an output of
  16834. size 200x400.
  16835. @example
  16836. cellauto=f=pattern:s=200x400
  16837. @end example
  16838. @item
  16839. Generate a random initial row with a width of 200 cells, with a fill
  16840. ratio of 2/3:
  16841. @example
  16842. cellauto=ratio=2/3:s=200x200
  16843. @end example
  16844. @item
  16845. Create a pattern generated by rule 18 starting by a single alive cell
  16846. centered on an initial row with width 100:
  16847. @example
  16848. cellauto=p=@@:s=100x400:full=0:rule=18
  16849. @end example
  16850. @item
  16851. Specify a more elaborated initial pattern:
  16852. @example
  16853. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  16854. @end example
  16855. @end itemize
  16856. @anchor{coreimagesrc}
  16857. @section coreimagesrc
  16858. Video source generated on GPU using Apple's CoreImage API on OSX.
  16859. This video source is a specialized version of the @ref{coreimage} video filter.
  16860. Use a core image generator at the beginning of the applied filterchain to
  16861. generate the content.
  16862. The coreimagesrc video source accepts the following options:
  16863. @table @option
  16864. @item list_generators
  16865. List all available generators along with all their respective options as well as
  16866. possible minimum and maximum values along with the default values.
  16867. @example
  16868. list_generators=true
  16869. @end example
  16870. @item size, s
  16871. Specify the size of the sourced video. For the syntax of this option, check the
  16872. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16873. The default value is @code{320x240}.
  16874. @item rate, r
  16875. Specify the frame rate of the sourced video, as the number of frames
  16876. generated per second. It has to be a string in the format
  16877. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16878. number or a valid video frame rate abbreviation. The default value is
  16879. "25".
  16880. @item sar
  16881. Set the sample aspect ratio of the sourced video.
  16882. @item duration, d
  16883. Set the duration of the sourced video. See
  16884. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16885. for the accepted syntax.
  16886. If not specified, or the expressed duration is negative, the video is
  16887. supposed to be generated forever.
  16888. @end table
  16889. Additionally, all options of the @ref{coreimage} video filter are accepted.
  16890. A complete filterchain can be used for further processing of the
  16891. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  16892. and examples for details.
  16893. @subsection Examples
  16894. @itemize
  16895. @item
  16896. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  16897. given as complete and escaped command-line for Apple's standard bash shell:
  16898. @example
  16899. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  16900. @end example
  16901. This example is equivalent to the QRCode example of @ref{coreimage} without the
  16902. need for a nullsrc video source.
  16903. @end itemize
  16904. @section mandelbrot
  16905. Generate a Mandelbrot set fractal, and progressively zoom towards the
  16906. point specified with @var{start_x} and @var{start_y}.
  16907. This source accepts the following options:
  16908. @table @option
  16909. @item end_pts
  16910. Set the terminal pts value. Default value is 400.
  16911. @item end_scale
  16912. Set the terminal scale value.
  16913. Must be a floating point value. Default value is 0.3.
  16914. @item inner
  16915. Set the inner coloring mode, that is the algorithm used to draw the
  16916. Mandelbrot fractal internal region.
  16917. It shall assume one of the following values:
  16918. @table @option
  16919. @item black
  16920. Set black mode.
  16921. @item convergence
  16922. Show time until convergence.
  16923. @item mincol
  16924. Set color based on point closest to the origin of the iterations.
  16925. @item period
  16926. Set period mode.
  16927. @end table
  16928. Default value is @var{mincol}.
  16929. @item bailout
  16930. Set the bailout value. Default value is 10.0.
  16931. @item maxiter
  16932. Set the maximum of iterations performed by the rendering
  16933. algorithm. Default value is 7189.
  16934. @item outer
  16935. Set outer coloring mode.
  16936. It shall assume one of following values:
  16937. @table @option
  16938. @item iteration_count
  16939. Set iteration count mode.
  16940. @item normalized_iteration_count
  16941. set normalized iteration count mode.
  16942. @end table
  16943. Default value is @var{normalized_iteration_count}.
  16944. @item rate, r
  16945. Set frame rate, expressed as number of frames per second. Default
  16946. value is "25".
  16947. @item size, s
  16948. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16949. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16950. @item start_scale
  16951. Set the initial scale value. Default value is 3.0.
  16952. @item start_x
  16953. Set the initial x position. Must be a floating point value between
  16954. -100 and 100. Default value is -0.743643887037158704752191506114774.
  16955. @item start_y
  16956. Set the initial y position. Must be a floating point value between
  16957. -100 and 100. Default value is -0.131825904205311970493132056385139.
  16958. @end table
  16959. @section mptestsrc
  16960. Generate various test patterns, as generated by the MPlayer test filter.
  16961. The size of the generated video is fixed, and is 256x256.
  16962. This source is useful in particular for testing encoding features.
  16963. This source accepts the following options:
  16964. @table @option
  16965. @item rate, r
  16966. Specify the frame rate of the sourced video, as the number of frames
  16967. generated per second. It has to be a string in the format
  16968. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16969. number or a valid video frame rate abbreviation. The default value is
  16970. "25".
  16971. @item duration, d
  16972. Set the duration of the sourced video. See
  16973. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16974. for the accepted syntax.
  16975. If not specified, or the expressed duration is negative, the video is
  16976. supposed to be generated forever.
  16977. @item test, t
  16978. Set the number or the name of the test to perform. Supported tests are:
  16979. @table @option
  16980. @item dc_luma
  16981. @item dc_chroma
  16982. @item freq_luma
  16983. @item freq_chroma
  16984. @item amp_luma
  16985. @item amp_chroma
  16986. @item cbp
  16987. @item mv
  16988. @item ring1
  16989. @item ring2
  16990. @item all
  16991. @item max_frames, m
  16992. Set the maximum number of frames generated for each test, default value is 30.
  16993. @end table
  16994. Default value is "all", which will cycle through the list of all tests.
  16995. @end table
  16996. Some examples:
  16997. @example
  16998. mptestsrc=t=dc_luma
  16999. @end example
  17000. will generate a "dc_luma" test pattern.
  17001. @section frei0r_src
  17002. Provide a frei0r source.
  17003. To enable compilation of this filter you need to install the frei0r
  17004. header and configure FFmpeg with @code{--enable-frei0r}.
  17005. This source accepts the following parameters:
  17006. @table @option
  17007. @item size
  17008. The size of the video to generate. For the syntax of this option, check the
  17009. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17010. @item framerate
  17011. The framerate of the generated video. It may be a string of the form
  17012. @var{num}/@var{den} or a frame rate abbreviation.
  17013. @item filter_name
  17014. The name to the frei0r source to load. For more information regarding frei0r and
  17015. how to set the parameters, read the @ref{frei0r} section in the video filters
  17016. documentation.
  17017. @item filter_params
  17018. A '|'-separated list of parameters to pass to the frei0r source.
  17019. @end table
  17020. For example, to generate a frei0r partik0l source with size 200x200
  17021. and frame rate 10 which is overlaid on the overlay filter main input:
  17022. @example
  17023. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  17024. @end example
  17025. @section life
  17026. Generate a life pattern.
  17027. This source is based on a generalization of John Conway's life game.
  17028. The sourced input represents a life grid, each pixel represents a cell
  17029. which can be in one of two possible states, alive or dead. Every cell
  17030. interacts with its eight neighbours, which are the cells that are
  17031. horizontally, vertically, or diagonally adjacent.
  17032. At each interaction the grid evolves according to the adopted rule,
  17033. which specifies the number of neighbor alive cells which will make a
  17034. cell stay alive or born. The @option{rule} option allows one to specify
  17035. the rule to adopt.
  17036. This source accepts the following options:
  17037. @table @option
  17038. @item filename, f
  17039. Set the file from which to read the initial grid state. In the file,
  17040. each non-whitespace character is considered an alive cell, and newline
  17041. is used to delimit the end of each row.
  17042. If this option is not specified, the initial grid is generated
  17043. randomly.
  17044. @item rate, r
  17045. Set the video rate, that is the number of frames generated per second.
  17046. Default is 25.
  17047. @item random_fill_ratio, ratio
  17048. Set the random fill ratio for the initial random grid. It is a
  17049. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  17050. It is ignored when a file is specified.
  17051. @item random_seed, seed
  17052. Set the seed for filling the initial random grid, must be an integer
  17053. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17054. set to -1, the filter will try to use a good random seed on a best
  17055. effort basis.
  17056. @item rule
  17057. Set the life rule.
  17058. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  17059. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  17060. @var{NS} specifies the number of alive neighbor cells which make a
  17061. live cell stay alive, and @var{NB} the number of alive neighbor cells
  17062. which make a dead cell to become alive (i.e. to "born").
  17063. "s" and "b" can be used in place of "S" and "B", respectively.
  17064. Alternatively a rule can be specified by an 18-bits integer. The 9
  17065. high order bits are used to encode the next cell state if it is alive
  17066. for each number of neighbor alive cells, the low order bits specify
  17067. the rule for "borning" new cells. Higher order bits encode for an
  17068. higher number of neighbor cells.
  17069. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  17070. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  17071. Default value is "S23/B3", which is the original Conway's game of life
  17072. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  17073. cells, and will born a new cell if there are three alive cells around
  17074. a dead cell.
  17075. @item size, s
  17076. Set the size of the output video. For the syntax of this option, check the
  17077. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17078. If @option{filename} is specified, the size is set by default to the
  17079. same size of the input file. If @option{size} is set, it must contain
  17080. the size specified in the input file, and the initial grid defined in
  17081. that file is centered in the larger resulting area.
  17082. If a filename is not specified, the size value defaults to "320x240"
  17083. (used for a randomly generated initial grid).
  17084. @item stitch
  17085. If set to 1, stitch the left and right grid edges together, and the
  17086. top and bottom edges also. Defaults to 1.
  17087. @item mold
  17088. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  17089. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  17090. value from 0 to 255.
  17091. @item life_color
  17092. Set the color of living (or new born) cells.
  17093. @item death_color
  17094. Set the color of dead cells. If @option{mold} is set, this is the first color
  17095. used to represent a dead cell.
  17096. @item mold_color
  17097. Set mold color, for definitely dead and moldy cells.
  17098. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  17099. ffmpeg-utils manual,ffmpeg-utils}.
  17100. @end table
  17101. @subsection Examples
  17102. @itemize
  17103. @item
  17104. Read a grid from @file{pattern}, and center it on a grid of size
  17105. 300x300 pixels:
  17106. @example
  17107. life=f=pattern:s=300x300
  17108. @end example
  17109. @item
  17110. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  17111. @example
  17112. life=ratio=2/3:s=200x200
  17113. @end example
  17114. @item
  17115. Specify a custom rule for evolving a randomly generated grid:
  17116. @example
  17117. life=rule=S14/B34
  17118. @end example
  17119. @item
  17120. Full example with slow death effect (mold) using @command{ffplay}:
  17121. @example
  17122. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  17123. @end example
  17124. @end itemize
  17125. @anchor{allrgb}
  17126. @anchor{allyuv}
  17127. @anchor{color}
  17128. @anchor{haldclutsrc}
  17129. @anchor{nullsrc}
  17130. @anchor{pal75bars}
  17131. @anchor{pal100bars}
  17132. @anchor{rgbtestsrc}
  17133. @anchor{smptebars}
  17134. @anchor{smptehdbars}
  17135. @anchor{testsrc}
  17136. @anchor{testsrc2}
  17137. @anchor{yuvtestsrc}
  17138. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  17139. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  17140. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  17141. The @code{color} source provides an uniformly colored input.
  17142. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  17143. @ref{haldclut} filter.
  17144. The @code{nullsrc} source returns unprocessed video frames. It is
  17145. mainly useful to be employed in analysis / debugging tools, or as the
  17146. source for filters which ignore the input data.
  17147. The @code{pal75bars} source generates a color bars pattern, based on
  17148. EBU PAL recommendations with 75% color levels.
  17149. The @code{pal100bars} source generates a color bars pattern, based on
  17150. EBU PAL recommendations with 100% color levels.
  17151. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  17152. detecting RGB vs BGR issues. You should see a red, green and blue
  17153. stripe from top to bottom.
  17154. The @code{smptebars} source generates a color bars pattern, based on
  17155. the SMPTE Engineering Guideline EG 1-1990.
  17156. The @code{smptehdbars} source generates a color bars pattern, based on
  17157. the SMPTE RP 219-2002.
  17158. The @code{testsrc} source generates a test video pattern, showing a
  17159. color pattern, a scrolling gradient and a timestamp. This is mainly
  17160. intended for testing purposes.
  17161. The @code{testsrc2} source is similar to testsrc, but supports more
  17162. pixel formats instead of just @code{rgb24}. This allows using it as an
  17163. input for other tests without requiring a format conversion.
  17164. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  17165. see a y, cb and cr stripe from top to bottom.
  17166. The sources accept the following parameters:
  17167. @table @option
  17168. @item level
  17169. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  17170. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  17171. pixels to be used as identity matrix for 3D lookup tables. Each component is
  17172. coded on a @code{1/(N*N)} scale.
  17173. @item color, c
  17174. Specify the color of the source, only available in the @code{color}
  17175. source. For the syntax of this option, check the
  17176. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17177. @item size, s
  17178. Specify the size of the sourced video. For the syntax of this option, check the
  17179. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17180. The default value is @code{320x240}.
  17181. This option is not available with the @code{allrgb}, @code{allyuv}, and
  17182. @code{haldclutsrc} filters.
  17183. @item rate, r
  17184. Specify the frame rate of the sourced video, as the number of frames
  17185. generated per second. It has to be a string in the format
  17186. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17187. number or a valid video frame rate abbreviation. The default value is
  17188. "25".
  17189. @item duration, d
  17190. Set the duration of the sourced video. See
  17191. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17192. for the accepted syntax.
  17193. If not specified, or the expressed duration is negative, the video is
  17194. supposed to be generated forever.
  17195. @item sar
  17196. Set the sample aspect ratio of the sourced video.
  17197. @item alpha
  17198. Specify the alpha (opacity) of the background, only available in the
  17199. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  17200. 255 (fully opaque, the default).
  17201. @item decimals, n
  17202. Set the number of decimals to show in the timestamp, only available in the
  17203. @code{testsrc} source.
  17204. The displayed timestamp value will correspond to the original
  17205. timestamp value multiplied by the power of 10 of the specified
  17206. value. Default value is 0.
  17207. @end table
  17208. @subsection Examples
  17209. @itemize
  17210. @item
  17211. Generate a video with a duration of 5.3 seconds, with size
  17212. 176x144 and a frame rate of 10 frames per second:
  17213. @example
  17214. testsrc=duration=5.3:size=qcif:rate=10
  17215. @end example
  17216. @item
  17217. The following graph description will generate a red source
  17218. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  17219. frames per second:
  17220. @example
  17221. color=c=red@@0.2:s=qcif:r=10
  17222. @end example
  17223. @item
  17224. If the input content is to be ignored, @code{nullsrc} can be used. The
  17225. following command generates noise in the luminance plane by employing
  17226. the @code{geq} filter:
  17227. @example
  17228. nullsrc=s=256x256, geq=random(1)*255:128:128
  17229. @end example
  17230. @end itemize
  17231. @subsection Commands
  17232. The @code{color} source supports the following commands:
  17233. @table @option
  17234. @item c, color
  17235. Set the color of the created image. Accepts the same syntax of the
  17236. corresponding @option{color} option.
  17237. @end table
  17238. @section openclsrc
  17239. Generate video using an OpenCL program.
  17240. @table @option
  17241. @item source
  17242. OpenCL program source file.
  17243. @item kernel
  17244. Kernel name in program.
  17245. @item size, s
  17246. Size of frames to generate. This must be set.
  17247. @item format
  17248. Pixel format to use for the generated frames. This must be set.
  17249. @item rate, r
  17250. Number of frames generated every second. Default value is '25'.
  17251. @end table
  17252. For details of how the program loading works, see the @ref{program_opencl}
  17253. filter.
  17254. Example programs:
  17255. @itemize
  17256. @item
  17257. Generate a colour ramp by setting pixel values from the position of the pixel
  17258. in the output image. (Note that this will work with all pixel formats, but
  17259. the generated output will not be the same.)
  17260. @verbatim
  17261. __kernel void ramp(__write_only image2d_t dst,
  17262. unsigned int index)
  17263. {
  17264. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17265. float4 val;
  17266. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  17267. write_imagef(dst, loc, val);
  17268. }
  17269. @end verbatim
  17270. @item
  17271. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  17272. @verbatim
  17273. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  17274. unsigned int index)
  17275. {
  17276. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17277. float4 value = 0.0f;
  17278. int x = loc.x + index;
  17279. int y = loc.y + index;
  17280. while (x > 0 || y > 0) {
  17281. if (x % 3 == 1 && y % 3 == 1) {
  17282. value = 1.0f;
  17283. break;
  17284. }
  17285. x /= 3;
  17286. y /= 3;
  17287. }
  17288. write_imagef(dst, loc, value);
  17289. }
  17290. @end verbatim
  17291. @end itemize
  17292. @section sierpinski
  17293. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  17294. This source accepts the following options:
  17295. @table @option
  17296. @item size, s
  17297. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17298. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17299. @item rate, r
  17300. Set frame rate, expressed as number of frames per second. Default
  17301. value is "25".
  17302. @item seed
  17303. Set seed which is used for random panning.
  17304. @item jump
  17305. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  17306. @item type
  17307. Set fractal type, can be default @code{carpet} or @code{triangle}.
  17308. @end table
  17309. @c man end VIDEO SOURCES
  17310. @chapter Video Sinks
  17311. @c man begin VIDEO SINKS
  17312. Below is a description of the currently available video sinks.
  17313. @section buffersink
  17314. Buffer video frames, and make them available to the end of the filter
  17315. graph.
  17316. This sink is mainly intended for programmatic use, in particular
  17317. through the interface defined in @file{libavfilter/buffersink.h}
  17318. or the options system.
  17319. It accepts a pointer to an AVBufferSinkContext structure, which
  17320. defines the incoming buffers' formats, to be passed as the opaque
  17321. parameter to @code{avfilter_init_filter} for initialization.
  17322. @section nullsink
  17323. Null video sink: do absolutely nothing with the input video. It is
  17324. mainly useful as a template and for use in analysis / debugging
  17325. tools.
  17326. @c man end VIDEO SINKS
  17327. @chapter Multimedia Filters
  17328. @c man begin MULTIMEDIA FILTERS
  17329. Below is a description of the currently available multimedia filters.
  17330. @section abitscope
  17331. Convert input audio to a video output, displaying the audio bit scope.
  17332. The filter accepts the following options:
  17333. @table @option
  17334. @item rate, r
  17335. Set frame rate, expressed as number of frames per second. Default
  17336. value is "25".
  17337. @item size, s
  17338. Specify the video size for the output. For the syntax of this option, check the
  17339. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17340. Default value is @code{1024x256}.
  17341. @item colors
  17342. Specify list of colors separated by space or by '|' which will be used to
  17343. draw channels. Unrecognized or missing colors will be replaced
  17344. by white color.
  17345. @end table
  17346. @section adrawgraph
  17347. Draw a graph using input audio metadata.
  17348. See @ref{drawgraph}
  17349. @section agraphmonitor
  17350. See @ref{graphmonitor}.
  17351. @section ahistogram
  17352. Convert input audio to a video output, displaying the volume histogram.
  17353. The filter accepts the following options:
  17354. @table @option
  17355. @item dmode
  17356. Specify how histogram is calculated.
  17357. It accepts the following values:
  17358. @table @samp
  17359. @item single
  17360. Use single histogram for all channels.
  17361. @item separate
  17362. Use separate histogram for each channel.
  17363. @end table
  17364. Default is @code{single}.
  17365. @item rate, r
  17366. Set frame rate, expressed as number of frames per second. Default
  17367. value is "25".
  17368. @item size, s
  17369. Specify the video size for the output. For the syntax of this option, check the
  17370. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17371. Default value is @code{hd720}.
  17372. @item scale
  17373. Set display scale.
  17374. It accepts the following values:
  17375. @table @samp
  17376. @item log
  17377. logarithmic
  17378. @item sqrt
  17379. square root
  17380. @item cbrt
  17381. cubic root
  17382. @item lin
  17383. linear
  17384. @item rlog
  17385. reverse logarithmic
  17386. @end table
  17387. Default is @code{log}.
  17388. @item ascale
  17389. Set amplitude scale.
  17390. It accepts the following values:
  17391. @table @samp
  17392. @item log
  17393. logarithmic
  17394. @item lin
  17395. linear
  17396. @end table
  17397. Default is @code{log}.
  17398. @item acount
  17399. Set how much frames to accumulate in histogram.
  17400. Default is 1. Setting this to -1 accumulates all frames.
  17401. @item rheight
  17402. Set histogram ratio of window height.
  17403. @item slide
  17404. Set sonogram sliding.
  17405. It accepts the following values:
  17406. @table @samp
  17407. @item replace
  17408. replace old rows with new ones.
  17409. @item scroll
  17410. scroll from top to bottom.
  17411. @end table
  17412. Default is @code{replace}.
  17413. @end table
  17414. @section aphasemeter
  17415. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  17416. representing mean phase of current audio frame. A video output can also be produced and is
  17417. enabled by default. The audio is passed through as first output.
  17418. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  17419. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  17420. and @code{1} means channels are in phase.
  17421. The filter accepts the following options, all related to its video output:
  17422. @table @option
  17423. @item rate, r
  17424. Set the output frame rate. Default value is @code{25}.
  17425. @item size, s
  17426. Set the video size for the output. For the syntax of this option, check the
  17427. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17428. Default value is @code{800x400}.
  17429. @item rc
  17430. @item gc
  17431. @item bc
  17432. Specify the red, green, blue contrast. Default values are @code{2},
  17433. @code{7} and @code{1}.
  17434. Allowed range is @code{[0, 255]}.
  17435. @item mpc
  17436. Set color which will be used for drawing median phase. If color is
  17437. @code{none} which is default, no median phase value will be drawn.
  17438. @item video
  17439. Enable video output. Default is enabled.
  17440. @end table
  17441. @section avectorscope
  17442. Convert input audio to a video output, representing the audio vector
  17443. scope.
  17444. The filter is used to measure the difference between channels of stereo
  17445. audio stream. A monaural signal, consisting of identical left and right
  17446. signal, results in straight vertical line. Any stereo separation is visible
  17447. as a deviation from this line, creating a Lissajous figure.
  17448. If the straight (or deviation from it) but horizontal line appears this
  17449. indicates that the left and right channels are out of phase.
  17450. The filter accepts the following options:
  17451. @table @option
  17452. @item mode, m
  17453. Set the vectorscope mode.
  17454. Available values are:
  17455. @table @samp
  17456. @item lissajous
  17457. Lissajous rotated by 45 degrees.
  17458. @item lissajous_xy
  17459. Same as above but not rotated.
  17460. @item polar
  17461. Shape resembling half of circle.
  17462. @end table
  17463. Default value is @samp{lissajous}.
  17464. @item size, s
  17465. Set the video size for the output. For the syntax of this option, check the
  17466. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17467. Default value is @code{400x400}.
  17468. @item rate, r
  17469. Set the output frame rate. Default value is @code{25}.
  17470. @item rc
  17471. @item gc
  17472. @item bc
  17473. @item ac
  17474. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  17475. @code{160}, @code{80} and @code{255}.
  17476. Allowed range is @code{[0, 255]}.
  17477. @item rf
  17478. @item gf
  17479. @item bf
  17480. @item af
  17481. Specify the red, green, blue and alpha fade. Default values are @code{15},
  17482. @code{10}, @code{5} and @code{5}.
  17483. Allowed range is @code{[0, 255]}.
  17484. @item zoom
  17485. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  17486. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  17487. @item draw
  17488. Set the vectorscope drawing mode.
  17489. Available values are:
  17490. @table @samp
  17491. @item dot
  17492. Draw dot for each sample.
  17493. @item line
  17494. Draw line between previous and current sample.
  17495. @end table
  17496. Default value is @samp{dot}.
  17497. @item scale
  17498. Specify amplitude scale of audio samples.
  17499. Available values are:
  17500. @table @samp
  17501. @item lin
  17502. Linear.
  17503. @item sqrt
  17504. Square root.
  17505. @item cbrt
  17506. Cubic root.
  17507. @item log
  17508. Logarithmic.
  17509. @end table
  17510. @item swap
  17511. Swap left channel axis with right channel axis.
  17512. @item mirror
  17513. Mirror axis.
  17514. @table @samp
  17515. @item none
  17516. No mirror.
  17517. @item x
  17518. Mirror only x axis.
  17519. @item y
  17520. Mirror only y axis.
  17521. @item xy
  17522. Mirror both axis.
  17523. @end table
  17524. @end table
  17525. @subsection Examples
  17526. @itemize
  17527. @item
  17528. Complete example using @command{ffplay}:
  17529. @example
  17530. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17531. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  17532. @end example
  17533. @end itemize
  17534. @section bench, abench
  17535. Benchmark part of a filtergraph.
  17536. The filter accepts the following options:
  17537. @table @option
  17538. @item action
  17539. Start or stop a timer.
  17540. Available values are:
  17541. @table @samp
  17542. @item start
  17543. Get the current time, set it as frame metadata (using the key
  17544. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  17545. @item stop
  17546. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  17547. the input frame metadata to get the time difference. Time difference, average,
  17548. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  17549. @code{min}) are then printed. The timestamps are expressed in seconds.
  17550. @end table
  17551. @end table
  17552. @subsection Examples
  17553. @itemize
  17554. @item
  17555. Benchmark @ref{selectivecolor} filter:
  17556. @example
  17557. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  17558. @end example
  17559. @end itemize
  17560. @section concat
  17561. Concatenate audio and video streams, joining them together one after the
  17562. other.
  17563. The filter works on segments of synchronized video and audio streams. All
  17564. segments must have the same number of streams of each type, and that will
  17565. also be the number of streams at output.
  17566. The filter accepts the following options:
  17567. @table @option
  17568. @item n
  17569. Set the number of segments. Default is 2.
  17570. @item v
  17571. Set the number of output video streams, that is also the number of video
  17572. streams in each segment. Default is 1.
  17573. @item a
  17574. Set the number of output audio streams, that is also the number of audio
  17575. streams in each segment. Default is 0.
  17576. @item unsafe
  17577. Activate unsafe mode: do not fail if segments have a different format.
  17578. @end table
  17579. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  17580. @var{a} audio outputs.
  17581. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  17582. segment, in the same order as the outputs, then the inputs for the second
  17583. segment, etc.
  17584. Related streams do not always have exactly the same duration, for various
  17585. reasons including codec frame size or sloppy authoring. For that reason,
  17586. related synchronized streams (e.g. a video and its audio track) should be
  17587. concatenated at once. The concat filter will use the duration of the longest
  17588. stream in each segment (except the last one), and if necessary pad shorter
  17589. audio streams with silence.
  17590. For this filter to work correctly, all segments must start at timestamp 0.
  17591. All corresponding streams must have the same parameters in all segments; the
  17592. filtering system will automatically select a common pixel format for video
  17593. streams, and a common sample format, sample rate and channel layout for
  17594. audio streams, but other settings, such as resolution, must be converted
  17595. explicitly by the user.
  17596. Different frame rates are acceptable but will result in variable frame rate
  17597. at output; be sure to configure the output file to handle it.
  17598. @subsection Examples
  17599. @itemize
  17600. @item
  17601. Concatenate an opening, an episode and an ending, all in bilingual version
  17602. (video in stream 0, audio in streams 1 and 2):
  17603. @example
  17604. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  17605. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  17606. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  17607. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  17608. @end example
  17609. @item
  17610. Concatenate two parts, handling audio and video separately, using the
  17611. (a)movie sources, and adjusting the resolution:
  17612. @example
  17613. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  17614. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  17615. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  17616. @end example
  17617. Note that a desync will happen at the stitch if the audio and video streams
  17618. do not have exactly the same duration in the first file.
  17619. @end itemize
  17620. @subsection Commands
  17621. This filter supports the following commands:
  17622. @table @option
  17623. @item next
  17624. Close the current segment and step to the next one
  17625. @end table
  17626. @anchor{ebur128}
  17627. @section ebur128
  17628. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  17629. level. By default, it logs a message at a frequency of 10Hz with the
  17630. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  17631. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  17632. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  17633. sample format is double-precision floating point. The input stream will be converted to
  17634. this specification, if needed. Users may need to insert aformat and/or aresample filters
  17635. after this filter to obtain the original parameters.
  17636. The filter also has a video output (see the @var{video} option) with a real
  17637. time graph to observe the loudness evolution. The graphic contains the logged
  17638. message mentioned above, so it is not printed anymore when this option is set,
  17639. unless the verbose logging is set. The main graphing area contains the
  17640. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  17641. the momentary loudness (400 milliseconds), but can optionally be configured
  17642. to instead display short-term loudness (see @var{gauge}).
  17643. The green area marks a +/- 1LU target range around the target loudness
  17644. (-23LUFS by default, unless modified through @var{target}).
  17645. More information about the Loudness Recommendation EBU R128 on
  17646. @url{http://tech.ebu.ch/loudness}.
  17647. The filter accepts the following options:
  17648. @table @option
  17649. @item video
  17650. Activate the video output. The audio stream is passed unchanged whether this
  17651. option is set or no. The video stream will be the first output stream if
  17652. activated. Default is @code{0}.
  17653. @item size
  17654. Set the video size. This option is for video only. For the syntax of this
  17655. option, check the
  17656. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17657. Default and minimum resolution is @code{640x480}.
  17658. @item meter
  17659. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  17660. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  17661. other integer value between this range is allowed.
  17662. @item metadata
  17663. Set metadata injection. If set to @code{1}, the audio input will be segmented
  17664. into 100ms output frames, each of them containing various loudness information
  17665. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  17666. Default is @code{0}.
  17667. @item framelog
  17668. Force the frame logging level.
  17669. Available values are:
  17670. @table @samp
  17671. @item info
  17672. information logging level
  17673. @item verbose
  17674. verbose logging level
  17675. @end table
  17676. By default, the logging level is set to @var{info}. If the @option{video} or
  17677. the @option{metadata} options are set, it switches to @var{verbose}.
  17678. @item peak
  17679. Set peak mode(s).
  17680. Available modes can be cumulated (the option is a @code{flag} type). Possible
  17681. values are:
  17682. @table @samp
  17683. @item none
  17684. Disable any peak mode (default).
  17685. @item sample
  17686. Enable sample-peak mode.
  17687. Simple peak mode looking for the higher sample value. It logs a message
  17688. for sample-peak (identified by @code{SPK}).
  17689. @item true
  17690. Enable true-peak mode.
  17691. If enabled, the peak lookup is done on an over-sampled version of the input
  17692. stream for better peak accuracy. It logs a message for true-peak.
  17693. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  17694. This mode requires a build with @code{libswresample}.
  17695. @end table
  17696. @item dualmono
  17697. Treat mono input files as "dual mono". If a mono file is intended for playback
  17698. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  17699. If set to @code{true}, this option will compensate for this effect.
  17700. Multi-channel input files are not affected by this option.
  17701. @item panlaw
  17702. Set a specific pan law to be used for the measurement of dual mono files.
  17703. This parameter is optional, and has a default value of -3.01dB.
  17704. @item target
  17705. Set a specific target level (in LUFS) used as relative zero in the visualization.
  17706. This parameter is optional and has a default value of -23LUFS as specified
  17707. by EBU R128. However, material published online may prefer a level of -16LUFS
  17708. (e.g. for use with podcasts or video platforms).
  17709. @item gauge
  17710. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  17711. @code{shortterm}. By default the momentary value will be used, but in certain
  17712. scenarios it may be more useful to observe the short term value instead (e.g.
  17713. live mixing).
  17714. @item scale
  17715. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  17716. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  17717. video output, not the summary or continuous log output.
  17718. @end table
  17719. @subsection Examples
  17720. @itemize
  17721. @item
  17722. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  17723. @example
  17724. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  17725. @end example
  17726. @item
  17727. Run an analysis with @command{ffmpeg}:
  17728. @example
  17729. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  17730. @end example
  17731. @end itemize
  17732. @section interleave, ainterleave
  17733. Temporally interleave frames from several inputs.
  17734. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  17735. These filters read frames from several inputs and send the oldest
  17736. queued frame to the output.
  17737. Input streams must have well defined, monotonically increasing frame
  17738. timestamp values.
  17739. In order to submit one frame to output, these filters need to enqueue
  17740. at least one frame for each input, so they cannot work in case one
  17741. input is not yet terminated and will not receive incoming frames.
  17742. For example consider the case when one input is a @code{select} filter
  17743. which always drops input frames. The @code{interleave} filter will keep
  17744. reading from that input, but it will never be able to send new frames
  17745. to output until the input sends an end-of-stream signal.
  17746. Also, depending on inputs synchronization, the filters will drop
  17747. frames in case one input receives more frames than the other ones, and
  17748. the queue is already filled.
  17749. These filters accept the following options:
  17750. @table @option
  17751. @item nb_inputs, n
  17752. Set the number of different inputs, it is 2 by default.
  17753. @item duration
  17754. How to determine the end-of-stream.
  17755. @table @option
  17756. @item longest
  17757. The duration of the longest input. (default)
  17758. @item shortest
  17759. The duration of the shortest input.
  17760. @item first
  17761. The duration of the first input.
  17762. @end table
  17763. @end table
  17764. @subsection Examples
  17765. @itemize
  17766. @item
  17767. Interleave frames belonging to different streams using @command{ffmpeg}:
  17768. @example
  17769. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  17770. @end example
  17771. @item
  17772. Add flickering blur effect:
  17773. @example
  17774. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  17775. @end example
  17776. @end itemize
  17777. @section metadata, ametadata
  17778. Manipulate frame metadata.
  17779. This filter accepts the following options:
  17780. @table @option
  17781. @item mode
  17782. Set mode of operation of the filter.
  17783. Can be one of the following:
  17784. @table @samp
  17785. @item select
  17786. If both @code{value} and @code{key} is set, select frames
  17787. which have such metadata. If only @code{key} is set, select
  17788. every frame that has such key in metadata.
  17789. @item add
  17790. Add new metadata @code{key} and @code{value}. If key is already available
  17791. do nothing.
  17792. @item modify
  17793. Modify value of already present key.
  17794. @item delete
  17795. If @code{value} is set, delete only keys that have such value.
  17796. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  17797. the frame.
  17798. @item print
  17799. Print key and its value if metadata was found. If @code{key} is not set print all
  17800. metadata values available in frame.
  17801. @end table
  17802. @item key
  17803. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  17804. @item value
  17805. Set metadata value which will be used. This option is mandatory for
  17806. @code{modify} and @code{add} mode.
  17807. @item function
  17808. Which function to use when comparing metadata value and @code{value}.
  17809. Can be one of following:
  17810. @table @samp
  17811. @item same_str
  17812. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  17813. @item starts_with
  17814. Values are interpreted as strings, returns true if metadata value starts with
  17815. the @code{value} option string.
  17816. @item less
  17817. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  17818. @item equal
  17819. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  17820. @item greater
  17821. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  17822. @item expr
  17823. Values are interpreted as floats, returns true if expression from option @code{expr}
  17824. evaluates to true.
  17825. @item ends_with
  17826. Values are interpreted as strings, returns true if metadata value ends with
  17827. the @code{value} option string.
  17828. @end table
  17829. @item expr
  17830. Set expression which is used when @code{function} is set to @code{expr}.
  17831. The expression is evaluated through the eval API and can contain the following
  17832. constants:
  17833. @table @option
  17834. @item VALUE1
  17835. Float representation of @code{value} from metadata key.
  17836. @item VALUE2
  17837. Float representation of @code{value} as supplied by user in @code{value} option.
  17838. @end table
  17839. @item file
  17840. If specified in @code{print} mode, output is written to the named file. Instead of
  17841. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  17842. for standard output. If @code{file} option is not set, output is written to the log
  17843. with AV_LOG_INFO loglevel.
  17844. @item direct
  17845. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  17846. @end table
  17847. @subsection Examples
  17848. @itemize
  17849. @item
  17850. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  17851. between 0 and 1.
  17852. @example
  17853. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  17854. @end example
  17855. @item
  17856. Print silencedetect output to file @file{metadata.txt}.
  17857. @example
  17858. silencedetect,ametadata=mode=print:file=metadata.txt
  17859. @end example
  17860. @item
  17861. Direct all metadata to a pipe with file descriptor 4.
  17862. @example
  17863. metadata=mode=print:file='pipe\:4'
  17864. @end example
  17865. @end itemize
  17866. @section perms, aperms
  17867. Set read/write permissions for the output frames.
  17868. These filters are mainly aimed at developers to test direct path in the
  17869. following filter in the filtergraph.
  17870. The filters accept the following options:
  17871. @table @option
  17872. @item mode
  17873. Select the permissions mode.
  17874. It accepts the following values:
  17875. @table @samp
  17876. @item none
  17877. Do nothing. This is the default.
  17878. @item ro
  17879. Set all the output frames read-only.
  17880. @item rw
  17881. Set all the output frames directly writable.
  17882. @item toggle
  17883. Make the frame read-only if writable, and writable if read-only.
  17884. @item random
  17885. Set each output frame read-only or writable randomly.
  17886. @end table
  17887. @item seed
  17888. Set the seed for the @var{random} mode, must be an integer included between
  17889. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  17890. @code{-1}, the filter will try to use a good random seed on a best effort
  17891. basis.
  17892. @end table
  17893. Note: in case of auto-inserted filter between the permission filter and the
  17894. following one, the permission might not be received as expected in that
  17895. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  17896. perms/aperms filter can avoid this problem.
  17897. @section realtime, arealtime
  17898. Slow down filtering to match real time approximately.
  17899. These filters will pause the filtering for a variable amount of time to
  17900. match the output rate with the input timestamps.
  17901. They are similar to the @option{re} option to @code{ffmpeg}.
  17902. They accept the following options:
  17903. @table @option
  17904. @item limit
  17905. Time limit for the pauses. Any pause longer than that will be considered
  17906. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  17907. @item speed
  17908. Speed factor for processing. The value must be a float larger than zero.
  17909. Values larger than 1.0 will result in faster than realtime processing,
  17910. smaller will slow processing down. The @var{limit} is automatically adapted
  17911. accordingly. Default is 1.0.
  17912. A processing speed faster than what is possible without these filters cannot
  17913. be achieved.
  17914. @end table
  17915. @anchor{select}
  17916. @section select, aselect
  17917. Select frames to pass in output.
  17918. This filter accepts the following options:
  17919. @table @option
  17920. @item expr, e
  17921. Set expression, which is evaluated for each input frame.
  17922. If the expression is evaluated to zero, the frame is discarded.
  17923. If the evaluation result is negative or NaN, the frame is sent to the
  17924. first output; otherwise it is sent to the output with index
  17925. @code{ceil(val)-1}, assuming that the input index starts from 0.
  17926. For example a value of @code{1.2} corresponds to the output with index
  17927. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  17928. @item outputs, n
  17929. Set the number of outputs. The output to which to send the selected
  17930. frame is based on the result of the evaluation. Default value is 1.
  17931. @end table
  17932. The expression can contain the following constants:
  17933. @table @option
  17934. @item n
  17935. The (sequential) number of the filtered frame, starting from 0.
  17936. @item selected_n
  17937. The (sequential) number of the selected frame, starting from 0.
  17938. @item prev_selected_n
  17939. The sequential number of the last selected frame. It's NAN if undefined.
  17940. @item TB
  17941. The timebase of the input timestamps.
  17942. @item pts
  17943. The PTS (Presentation TimeStamp) of the filtered video frame,
  17944. expressed in @var{TB} units. It's NAN if undefined.
  17945. @item t
  17946. The PTS of the filtered video frame,
  17947. expressed in seconds. It's NAN if undefined.
  17948. @item prev_pts
  17949. The PTS of the previously filtered video frame. It's NAN if undefined.
  17950. @item prev_selected_pts
  17951. The PTS of the last previously filtered video frame. It's NAN if undefined.
  17952. @item prev_selected_t
  17953. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  17954. @item start_pts
  17955. The PTS of the first video frame in the video. It's NAN if undefined.
  17956. @item start_t
  17957. The time of the first video frame in the video. It's NAN if undefined.
  17958. @item pict_type @emph{(video only)}
  17959. The type of the filtered frame. It can assume one of the following
  17960. values:
  17961. @table @option
  17962. @item I
  17963. @item P
  17964. @item B
  17965. @item S
  17966. @item SI
  17967. @item SP
  17968. @item BI
  17969. @end table
  17970. @item interlace_type @emph{(video only)}
  17971. The frame interlace type. It can assume one of the following values:
  17972. @table @option
  17973. @item PROGRESSIVE
  17974. The frame is progressive (not interlaced).
  17975. @item TOPFIRST
  17976. The frame is top-field-first.
  17977. @item BOTTOMFIRST
  17978. The frame is bottom-field-first.
  17979. @end table
  17980. @item consumed_sample_n @emph{(audio only)}
  17981. the number of selected samples before the current frame
  17982. @item samples_n @emph{(audio only)}
  17983. the number of samples in the current frame
  17984. @item sample_rate @emph{(audio only)}
  17985. the input sample rate
  17986. @item key
  17987. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  17988. @item pos
  17989. the position in the file of the filtered frame, -1 if the information
  17990. is not available (e.g. for synthetic video)
  17991. @item scene @emph{(video only)}
  17992. value between 0 and 1 to indicate a new scene; a low value reflects a low
  17993. probability for the current frame to introduce a new scene, while a higher
  17994. value means the current frame is more likely to be one (see the example below)
  17995. @item concatdec_select
  17996. The concat demuxer can select only part of a concat input file by setting an
  17997. inpoint and an outpoint, but the output packets may not be entirely contained
  17998. in the selected interval. By using this variable, it is possible to skip frames
  17999. generated by the concat demuxer which are not exactly contained in the selected
  18000. interval.
  18001. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  18002. and the @var{lavf.concat.duration} packet metadata values which are also
  18003. present in the decoded frames.
  18004. The @var{concatdec_select} variable is -1 if the frame pts is at least
  18005. start_time and either the duration metadata is missing or the frame pts is less
  18006. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  18007. missing.
  18008. That basically means that an input frame is selected if its pts is within the
  18009. interval set by the concat demuxer.
  18010. @end table
  18011. The default value of the select expression is "1".
  18012. @subsection Examples
  18013. @itemize
  18014. @item
  18015. Select all frames in input:
  18016. @example
  18017. select
  18018. @end example
  18019. The example above is the same as:
  18020. @example
  18021. select=1
  18022. @end example
  18023. @item
  18024. Skip all frames:
  18025. @example
  18026. select=0
  18027. @end example
  18028. @item
  18029. Select only I-frames:
  18030. @example
  18031. select='eq(pict_type\,I)'
  18032. @end example
  18033. @item
  18034. Select one frame every 100:
  18035. @example
  18036. select='not(mod(n\,100))'
  18037. @end example
  18038. @item
  18039. Select only frames contained in the 10-20 time interval:
  18040. @example
  18041. select=between(t\,10\,20)
  18042. @end example
  18043. @item
  18044. Select only I-frames contained in the 10-20 time interval:
  18045. @example
  18046. select=between(t\,10\,20)*eq(pict_type\,I)
  18047. @end example
  18048. @item
  18049. Select frames with a minimum distance of 10 seconds:
  18050. @example
  18051. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  18052. @end example
  18053. @item
  18054. Use aselect to select only audio frames with samples number > 100:
  18055. @example
  18056. aselect='gt(samples_n\,100)'
  18057. @end example
  18058. @item
  18059. Create a mosaic of the first scenes:
  18060. @example
  18061. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  18062. @end example
  18063. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  18064. choice.
  18065. @item
  18066. Send even and odd frames to separate outputs, and compose them:
  18067. @example
  18068. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  18069. @end example
  18070. @item
  18071. Select useful frames from an ffconcat file which is using inpoints and
  18072. outpoints but where the source files are not intra frame only.
  18073. @example
  18074. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  18075. @end example
  18076. @end itemize
  18077. @section sendcmd, asendcmd
  18078. Send commands to filters in the filtergraph.
  18079. These filters read commands to be sent to other filters in the
  18080. filtergraph.
  18081. @code{sendcmd} must be inserted between two video filters,
  18082. @code{asendcmd} must be inserted between two audio filters, but apart
  18083. from that they act the same way.
  18084. The specification of commands can be provided in the filter arguments
  18085. with the @var{commands} option, or in a file specified by the
  18086. @var{filename} option.
  18087. These filters accept the following options:
  18088. @table @option
  18089. @item commands, c
  18090. Set the commands to be read and sent to the other filters.
  18091. @item filename, f
  18092. Set the filename of the commands to be read and sent to the other
  18093. filters.
  18094. @end table
  18095. @subsection Commands syntax
  18096. A commands description consists of a sequence of interval
  18097. specifications, comprising a list of commands to be executed when a
  18098. particular event related to that interval occurs. The occurring event
  18099. is typically the current frame time entering or leaving a given time
  18100. interval.
  18101. An interval is specified by the following syntax:
  18102. @example
  18103. @var{START}[-@var{END}] @var{COMMANDS};
  18104. @end example
  18105. The time interval is specified by the @var{START} and @var{END} times.
  18106. @var{END} is optional and defaults to the maximum time.
  18107. The current frame time is considered within the specified interval if
  18108. it is included in the interval [@var{START}, @var{END}), that is when
  18109. the time is greater or equal to @var{START} and is lesser than
  18110. @var{END}.
  18111. @var{COMMANDS} consists of a sequence of one or more command
  18112. specifications, separated by ",", relating to that interval. The
  18113. syntax of a command specification is given by:
  18114. @example
  18115. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  18116. @end example
  18117. @var{FLAGS} is optional and specifies the type of events relating to
  18118. the time interval which enable sending the specified command, and must
  18119. be a non-null sequence of identifier flags separated by "+" or "|" and
  18120. enclosed between "[" and "]".
  18121. The following flags are recognized:
  18122. @table @option
  18123. @item enter
  18124. The command is sent when the current frame timestamp enters the
  18125. specified interval. In other words, the command is sent when the
  18126. previous frame timestamp was not in the given interval, and the
  18127. current is.
  18128. @item leave
  18129. The command is sent when the current frame timestamp leaves the
  18130. specified interval. In other words, the command is sent when the
  18131. previous frame timestamp was in the given interval, and the
  18132. current is not.
  18133. @item expr
  18134. The command @var{ARG} is interpreted as expression and result of
  18135. expression is passed as @var{ARG}.
  18136. The expression is evaluated through the eval API and can contain the following
  18137. constants:
  18138. @table @option
  18139. @item POS
  18140. Original position in the file of the frame, or undefined if undefined
  18141. for the current frame.
  18142. @item PTS
  18143. The presentation timestamp in input.
  18144. @item N
  18145. The count of the input frame for video or audio, starting from 0.
  18146. @item T
  18147. The time in seconds of the current frame.
  18148. @item TS
  18149. The start time in seconds of the current command interval.
  18150. @item TE
  18151. The end time in seconds of the current command interval.
  18152. @item TI
  18153. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  18154. @end table
  18155. @end table
  18156. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  18157. assumed.
  18158. @var{TARGET} specifies the target of the command, usually the name of
  18159. the filter class or a specific filter instance name.
  18160. @var{COMMAND} specifies the name of the command for the target filter.
  18161. @var{ARG} is optional and specifies the optional list of argument for
  18162. the given @var{COMMAND}.
  18163. Between one interval specification and another, whitespaces, or
  18164. sequences of characters starting with @code{#} until the end of line,
  18165. are ignored and can be used to annotate comments.
  18166. A simplified BNF description of the commands specification syntax
  18167. follows:
  18168. @example
  18169. @var{COMMAND_FLAG} ::= "enter" | "leave"
  18170. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  18171. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  18172. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  18173. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  18174. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  18175. @end example
  18176. @subsection Examples
  18177. @itemize
  18178. @item
  18179. Specify audio tempo change at second 4:
  18180. @example
  18181. asendcmd=c='4.0 atempo tempo 1.5',atempo
  18182. @end example
  18183. @item
  18184. Target a specific filter instance:
  18185. @example
  18186. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  18187. @end example
  18188. @item
  18189. Specify a list of drawtext and hue commands in a file.
  18190. @example
  18191. # show text in the interval 5-10
  18192. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  18193. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  18194. # desaturate the image in the interval 15-20
  18195. 15.0-20.0 [enter] hue s 0,
  18196. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  18197. [leave] hue s 1,
  18198. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  18199. # apply an exponential saturation fade-out effect, starting from time 25
  18200. 25 [enter] hue s exp(25-t)
  18201. @end example
  18202. A filtergraph allowing to read and process the above command list
  18203. stored in a file @file{test.cmd}, can be specified with:
  18204. @example
  18205. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  18206. @end example
  18207. @end itemize
  18208. @anchor{setpts}
  18209. @section setpts, asetpts
  18210. Change the PTS (presentation timestamp) of the input frames.
  18211. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  18212. This filter accepts the following options:
  18213. @table @option
  18214. @item expr
  18215. The expression which is evaluated for each frame to construct its timestamp.
  18216. @end table
  18217. The expression is evaluated through the eval API and can contain the following
  18218. constants:
  18219. @table @option
  18220. @item FRAME_RATE, FR
  18221. frame rate, only defined for constant frame-rate video
  18222. @item PTS
  18223. The presentation timestamp in input
  18224. @item N
  18225. The count of the input frame for video or the number of consumed samples,
  18226. not including the current frame for audio, starting from 0.
  18227. @item NB_CONSUMED_SAMPLES
  18228. The number of consumed samples, not including the current frame (only
  18229. audio)
  18230. @item NB_SAMPLES, S
  18231. The number of samples in the current frame (only audio)
  18232. @item SAMPLE_RATE, SR
  18233. The audio sample rate.
  18234. @item STARTPTS
  18235. The PTS of the first frame.
  18236. @item STARTT
  18237. the time in seconds of the first frame
  18238. @item INTERLACED
  18239. State whether the current frame is interlaced.
  18240. @item T
  18241. the time in seconds of the current frame
  18242. @item POS
  18243. original position in the file of the frame, or undefined if undefined
  18244. for the current frame
  18245. @item PREV_INPTS
  18246. The previous input PTS.
  18247. @item PREV_INT
  18248. previous input time in seconds
  18249. @item PREV_OUTPTS
  18250. The previous output PTS.
  18251. @item PREV_OUTT
  18252. previous output time in seconds
  18253. @item RTCTIME
  18254. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  18255. instead.
  18256. @item RTCSTART
  18257. The wallclock (RTC) time at the start of the movie in microseconds.
  18258. @item TB
  18259. The timebase of the input timestamps.
  18260. @end table
  18261. @subsection Examples
  18262. @itemize
  18263. @item
  18264. Start counting PTS from zero
  18265. @example
  18266. setpts=PTS-STARTPTS
  18267. @end example
  18268. @item
  18269. Apply fast motion effect:
  18270. @example
  18271. setpts=0.5*PTS
  18272. @end example
  18273. @item
  18274. Apply slow motion effect:
  18275. @example
  18276. setpts=2.0*PTS
  18277. @end example
  18278. @item
  18279. Set fixed rate of 25 frames per second:
  18280. @example
  18281. setpts=N/(25*TB)
  18282. @end example
  18283. @item
  18284. Set fixed rate 25 fps with some jitter:
  18285. @example
  18286. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  18287. @end example
  18288. @item
  18289. Apply an offset of 10 seconds to the input PTS:
  18290. @example
  18291. setpts=PTS+10/TB
  18292. @end example
  18293. @item
  18294. Generate timestamps from a "live source" and rebase onto the current timebase:
  18295. @example
  18296. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  18297. @end example
  18298. @item
  18299. Generate timestamps by counting samples:
  18300. @example
  18301. asetpts=N/SR/TB
  18302. @end example
  18303. @end itemize
  18304. @section setrange
  18305. Force color range for the output video frame.
  18306. The @code{setrange} filter marks the color range property for the
  18307. output frames. It does not change the input frame, but only sets the
  18308. corresponding property, which affects how the frame is treated by
  18309. following filters.
  18310. The filter accepts the following options:
  18311. @table @option
  18312. @item range
  18313. Available values are:
  18314. @table @samp
  18315. @item auto
  18316. Keep the same color range property.
  18317. @item unspecified, unknown
  18318. Set the color range as unspecified.
  18319. @item limited, tv, mpeg
  18320. Set the color range as limited.
  18321. @item full, pc, jpeg
  18322. Set the color range as full.
  18323. @end table
  18324. @end table
  18325. @section settb, asettb
  18326. Set the timebase to use for the output frames timestamps.
  18327. It is mainly useful for testing timebase configuration.
  18328. It accepts the following parameters:
  18329. @table @option
  18330. @item expr, tb
  18331. The expression which is evaluated into the output timebase.
  18332. @end table
  18333. The value for @option{tb} is an arithmetic expression representing a
  18334. rational. The expression can contain the constants "AVTB" (the default
  18335. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  18336. audio only). Default value is "intb".
  18337. @subsection Examples
  18338. @itemize
  18339. @item
  18340. Set the timebase to 1/25:
  18341. @example
  18342. settb=expr=1/25
  18343. @end example
  18344. @item
  18345. Set the timebase to 1/10:
  18346. @example
  18347. settb=expr=0.1
  18348. @end example
  18349. @item
  18350. Set the timebase to 1001/1000:
  18351. @example
  18352. settb=1+0.001
  18353. @end example
  18354. @item
  18355. Set the timebase to 2*intb:
  18356. @example
  18357. settb=2*intb
  18358. @end example
  18359. @item
  18360. Set the default timebase value:
  18361. @example
  18362. settb=AVTB
  18363. @end example
  18364. @end itemize
  18365. @section showcqt
  18366. Convert input audio to a video output representing frequency spectrum
  18367. logarithmically using Brown-Puckette constant Q transform algorithm with
  18368. direct frequency domain coefficient calculation (but the transform itself
  18369. is not really constant Q, instead the Q factor is actually variable/clamped),
  18370. with musical tone scale, from E0 to D#10.
  18371. The filter accepts the following options:
  18372. @table @option
  18373. @item size, s
  18374. Specify the video size for the output. It must be even. For the syntax of this option,
  18375. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18376. Default value is @code{1920x1080}.
  18377. @item fps, rate, r
  18378. Set the output frame rate. Default value is @code{25}.
  18379. @item bar_h
  18380. Set the bargraph height. It must be even. Default value is @code{-1} which
  18381. computes the bargraph height automatically.
  18382. @item axis_h
  18383. Set the axis height. It must be even. Default value is @code{-1} which computes
  18384. the axis height automatically.
  18385. @item sono_h
  18386. Set the sonogram height. It must be even. Default value is @code{-1} which
  18387. computes the sonogram height automatically.
  18388. @item fullhd
  18389. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  18390. instead. Default value is @code{1}.
  18391. @item sono_v, volume
  18392. Specify the sonogram volume expression. It can contain variables:
  18393. @table @option
  18394. @item bar_v
  18395. the @var{bar_v} evaluated expression
  18396. @item frequency, freq, f
  18397. the frequency where it is evaluated
  18398. @item timeclamp, tc
  18399. the value of @var{timeclamp} option
  18400. @end table
  18401. and functions:
  18402. @table @option
  18403. @item a_weighting(f)
  18404. A-weighting of equal loudness
  18405. @item b_weighting(f)
  18406. B-weighting of equal loudness
  18407. @item c_weighting(f)
  18408. C-weighting of equal loudness.
  18409. @end table
  18410. Default value is @code{16}.
  18411. @item bar_v, volume2
  18412. Specify the bargraph volume expression. It can contain variables:
  18413. @table @option
  18414. @item sono_v
  18415. the @var{sono_v} evaluated expression
  18416. @item frequency, freq, f
  18417. the frequency where it is evaluated
  18418. @item timeclamp, tc
  18419. the value of @var{timeclamp} option
  18420. @end table
  18421. and functions:
  18422. @table @option
  18423. @item a_weighting(f)
  18424. A-weighting of equal loudness
  18425. @item b_weighting(f)
  18426. B-weighting of equal loudness
  18427. @item c_weighting(f)
  18428. C-weighting of equal loudness.
  18429. @end table
  18430. Default value is @code{sono_v}.
  18431. @item sono_g, gamma
  18432. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  18433. higher gamma makes the spectrum having more range. Default value is @code{3}.
  18434. Acceptable range is @code{[1, 7]}.
  18435. @item bar_g, gamma2
  18436. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  18437. @code{[1, 7]}.
  18438. @item bar_t
  18439. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  18440. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  18441. @item timeclamp, tc
  18442. Specify the transform timeclamp. At low frequency, there is trade-off between
  18443. accuracy in time domain and frequency domain. If timeclamp is lower,
  18444. event in time domain is represented more accurately (such as fast bass drum),
  18445. otherwise event in frequency domain is represented more accurately
  18446. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  18447. @item attack
  18448. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  18449. limits future samples by applying asymmetric windowing in time domain, useful
  18450. when low latency is required. Accepted range is @code{[0, 1]}.
  18451. @item basefreq
  18452. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  18453. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  18454. @item endfreq
  18455. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  18456. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  18457. @item coeffclamp
  18458. This option is deprecated and ignored.
  18459. @item tlength
  18460. Specify the transform length in time domain. Use this option to control accuracy
  18461. trade-off between time domain and frequency domain at every frequency sample.
  18462. It can contain variables:
  18463. @table @option
  18464. @item frequency, freq, f
  18465. the frequency where it is evaluated
  18466. @item timeclamp, tc
  18467. the value of @var{timeclamp} option.
  18468. @end table
  18469. Default value is @code{384*tc/(384+tc*f)}.
  18470. @item count
  18471. Specify the transform count for every video frame. Default value is @code{6}.
  18472. Acceptable range is @code{[1, 30]}.
  18473. @item fcount
  18474. Specify the transform count for every single pixel. Default value is @code{0},
  18475. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  18476. @item fontfile
  18477. Specify font file for use with freetype to draw the axis. If not specified,
  18478. use embedded font. Note that drawing with font file or embedded font is not
  18479. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  18480. option instead.
  18481. @item font
  18482. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  18483. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  18484. escaping.
  18485. @item fontcolor
  18486. Specify font color expression. This is arithmetic expression that should return
  18487. integer value 0xRRGGBB. It can contain variables:
  18488. @table @option
  18489. @item frequency, freq, f
  18490. the frequency where it is evaluated
  18491. @item timeclamp, tc
  18492. the value of @var{timeclamp} option
  18493. @end table
  18494. and functions:
  18495. @table @option
  18496. @item midi(f)
  18497. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  18498. @item r(x), g(x), b(x)
  18499. red, green, and blue value of intensity x.
  18500. @end table
  18501. Default value is @code{st(0, (midi(f)-59.5)/12);
  18502. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  18503. r(1-ld(1)) + b(ld(1))}.
  18504. @item axisfile
  18505. Specify image file to draw the axis. This option override @var{fontfile} and
  18506. @var{fontcolor} option.
  18507. @item axis, text
  18508. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  18509. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  18510. Default value is @code{1}.
  18511. @item csp
  18512. Set colorspace. The accepted values are:
  18513. @table @samp
  18514. @item unspecified
  18515. Unspecified (default)
  18516. @item bt709
  18517. BT.709
  18518. @item fcc
  18519. FCC
  18520. @item bt470bg
  18521. BT.470BG or BT.601-6 625
  18522. @item smpte170m
  18523. SMPTE-170M or BT.601-6 525
  18524. @item smpte240m
  18525. SMPTE-240M
  18526. @item bt2020ncl
  18527. BT.2020 with non-constant luminance
  18528. @end table
  18529. @item cscheme
  18530. Set spectrogram color scheme. This is list of floating point values with format
  18531. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  18532. The default is @code{1|0.5|0|0|0.5|1}.
  18533. @end table
  18534. @subsection Examples
  18535. @itemize
  18536. @item
  18537. Playing audio while showing the spectrum:
  18538. @example
  18539. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  18540. @end example
  18541. @item
  18542. Same as above, but with frame rate 30 fps:
  18543. @example
  18544. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  18545. @end example
  18546. @item
  18547. Playing at 1280x720:
  18548. @example
  18549. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  18550. @end example
  18551. @item
  18552. Disable sonogram display:
  18553. @example
  18554. sono_h=0
  18555. @end example
  18556. @item
  18557. A1 and its harmonics: A1, A2, (near)E3, A3:
  18558. @example
  18559. 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),
  18560. asplit[a][out1]; [a] showcqt [out0]'
  18561. @end example
  18562. @item
  18563. Same as above, but with more accuracy in frequency domain:
  18564. @example
  18565. 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),
  18566. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  18567. @end example
  18568. @item
  18569. Custom volume:
  18570. @example
  18571. bar_v=10:sono_v=bar_v*a_weighting(f)
  18572. @end example
  18573. @item
  18574. Custom gamma, now spectrum is linear to the amplitude.
  18575. @example
  18576. bar_g=2:sono_g=2
  18577. @end example
  18578. @item
  18579. Custom tlength equation:
  18580. @example
  18581. 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)))'
  18582. @end example
  18583. @item
  18584. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  18585. @example
  18586. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  18587. @end example
  18588. @item
  18589. Custom font using fontconfig:
  18590. @example
  18591. font='Courier New,Monospace,mono|bold'
  18592. @end example
  18593. @item
  18594. Custom frequency range with custom axis using image file:
  18595. @example
  18596. axisfile=myaxis.png:basefreq=40:endfreq=10000
  18597. @end example
  18598. @end itemize
  18599. @section showfreqs
  18600. Convert input audio to video output representing the audio power spectrum.
  18601. Audio amplitude is on Y-axis while frequency is on X-axis.
  18602. The filter accepts the following options:
  18603. @table @option
  18604. @item size, s
  18605. Specify size of video. For the syntax of this option, check the
  18606. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18607. Default is @code{1024x512}.
  18608. @item mode
  18609. Set display mode.
  18610. This set how each frequency bin will be represented.
  18611. It accepts the following values:
  18612. @table @samp
  18613. @item line
  18614. @item bar
  18615. @item dot
  18616. @end table
  18617. Default is @code{bar}.
  18618. @item ascale
  18619. Set amplitude scale.
  18620. It accepts the following values:
  18621. @table @samp
  18622. @item lin
  18623. Linear scale.
  18624. @item sqrt
  18625. Square root scale.
  18626. @item cbrt
  18627. Cubic root scale.
  18628. @item log
  18629. Logarithmic scale.
  18630. @end table
  18631. Default is @code{log}.
  18632. @item fscale
  18633. Set frequency scale.
  18634. It accepts the following values:
  18635. @table @samp
  18636. @item lin
  18637. Linear scale.
  18638. @item log
  18639. Logarithmic scale.
  18640. @item rlog
  18641. Reverse logarithmic scale.
  18642. @end table
  18643. Default is @code{lin}.
  18644. @item win_size
  18645. Set window size. Allowed range is from 16 to 65536.
  18646. Default is @code{2048}
  18647. @item win_func
  18648. Set windowing function.
  18649. It accepts the following values:
  18650. @table @samp
  18651. @item rect
  18652. @item bartlett
  18653. @item hanning
  18654. @item hamming
  18655. @item blackman
  18656. @item welch
  18657. @item flattop
  18658. @item bharris
  18659. @item bnuttall
  18660. @item bhann
  18661. @item sine
  18662. @item nuttall
  18663. @item lanczos
  18664. @item gauss
  18665. @item tukey
  18666. @item dolph
  18667. @item cauchy
  18668. @item parzen
  18669. @item poisson
  18670. @item bohman
  18671. @end table
  18672. Default is @code{hanning}.
  18673. @item overlap
  18674. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18675. which means optimal overlap for selected window function will be picked.
  18676. @item averaging
  18677. Set time averaging. Setting this to 0 will display current maximal peaks.
  18678. Default is @code{1}, which means time averaging is disabled.
  18679. @item colors
  18680. Specify list of colors separated by space or by '|' which will be used to
  18681. draw channel frequencies. Unrecognized or missing colors will be replaced
  18682. by white color.
  18683. @item cmode
  18684. Set channel display mode.
  18685. It accepts the following values:
  18686. @table @samp
  18687. @item combined
  18688. @item separate
  18689. @end table
  18690. Default is @code{combined}.
  18691. @item minamp
  18692. Set minimum amplitude used in @code{log} amplitude scaler.
  18693. @end table
  18694. @section showspatial
  18695. Convert stereo input audio to a video output, representing the spatial relationship
  18696. between two channels.
  18697. The filter accepts the following options:
  18698. @table @option
  18699. @item size, s
  18700. Specify the video size for the output. For the syntax of this option, check the
  18701. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18702. Default value is @code{512x512}.
  18703. @item win_size
  18704. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  18705. @item win_func
  18706. Set window function.
  18707. It accepts the following values:
  18708. @table @samp
  18709. @item rect
  18710. @item bartlett
  18711. @item hann
  18712. @item hanning
  18713. @item hamming
  18714. @item blackman
  18715. @item welch
  18716. @item flattop
  18717. @item bharris
  18718. @item bnuttall
  18719. @item bhann
  18720. @item sine
  18721. @item nuttall
  18722. @item lanczos
  18723. @item gauss
  18724. @item tukey
  18725. @item dolph
  18726. @item cauchy
  18727. @item parzen
  18728. @item poisson
  18729. @item bohman
  18730. @end table
  18731. Default value is @code{hann}.
  18732. @item overlap
  18733. Set ratio of overlap window. Default value is @code{0.5}.
  18734. When value is @code{1} overlap is set to recommended size for specific
  18735. window function currently used.
  18736. @end table
  18737. @anchor{showspectrum}
  18738. @section showspectrum
  18739. Convert input audio to a video output, representing the audio frequency
  18740. spectrum.
  18741. The filter accepts the following options:
  18742. @table @option
  18743. @item size, s
  18744. Specify the video size for the output. For the syntax of this option, check the
  18745. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18746. Default value is @code{640x512}.
  18747. @item slide
  18748. Specify how the spectrum should slide along the window.
  18749. It accepts the following values:
  18750. @table @samp
  18751. @item replace
  18752. the samples start again on the left when they reach the right
  18753. @item scroll
  18754. the samples scroll from right to left
  18755. @item fullframe
  18756. frames are only produced when the samples reach the right
  18757. @item rscroll
  18758. the samples scroll from left to right
  18759. @end table
  18760. Default value is @code{replace}.
  18761. @item mode
  18762. Specify display mode.
  18763. It accepts the following values:
  18764. @table @samp
  18765. @item combined
  18766. all channels are displayed in the same row
  18767. @item separate
  18768. all channels are displayed in separate rows
  18769. @end table
  18770. Default value is @samp{combined}.
  18771. @item color
  18772. Specify display color mode.
  18773. It accepts the following values:
  18774. @table @samp
  18775. @item channel
  18776. each channel is displayed in a separate color
  18777. @item intensity
  18778. each channel is displayed using the same color scheme
  18779. @item rainbow
  18780. each channel is displayed using the rainbow color scheme
  18781. @item moreland
  18782. each channel is displayed using the moreland color scheme
  18783. @item nebulae
  18784. each channel is displayed using the nebulae color scheme
  18785. @item fire
  18786. each channel is displayed using the fire color scheme
  18787. @item fiery
  18788. each channel is displayed using the fiery color scheme
  18789. @item fruit
  18790. each channel is displayed using the fruit color scheme
  18791. @item cool
  18792. each channel is displayed using the cool color scheme
  18793. @item magma
  18794. each channel is displayed using the magma color scheme
  18795. @item green
  18796. each channel is displayed using the green color scheme
  18797. @item viridis
  18798. each channel is displayed using the viridis color scheme
  18799. @item plasma
  18800. each channel is displayed using the plasma color scheme
  18801. @item cividis
  18802. each channel is displayed using the cividis color scheme
  18803. @item terrain
  18804. each channel is displayed using the terrain color scheme
  18805. @end table
  18806. Default value is @samp{channel}.
  18807. @item scale
  18808. Specify scale used for calculating intensity color values.
  18809. It accepts the following values:
  18810. @table @samp
  18811. @item lin
  18812. linear
  18813. @item sqrt
  18814. square root, default
  18815. @item cbrt
  18816. cubic root
  18817. @item log
  18818. logarithmic
  18819. @item 4thrt
  18820. 4th root
  18821. @item 5thrt
  18822. 5th root
  18823. @end table
  18824. Default value is @samp{sqrt}.
  18825. @item fscale
  18826. Specify frequency scale.
  18827. It accepts the following values:
  18828. @table @samp
  18829. @item lin
  18830. linear
  18831. @item log
  18832. logarithmic
  18833. @end table
  18834. Default value is @samp{lin}.
  18835. @item saturation
  18836. Set saturation modifier for displayed colors. Negative values provide
  18837. alternative color scheme. @code{0} is no saturation at all.
  18838. Saturation must be in [-10.0, 10.0] range.
  18839. Default value is @code{1}.
  18840. @item win_func
  18841. Set window function.
  18842. It accepts the following values:
  18843. @table @samp
  18844. @item rect
  18845. @item bartlett
  18846. @item hann
  18847. @item hanning
  18848. @item hamming
  18849. @item blackman
  18850. @item welch
  18851. @item flattop
  18852. @item bharris
  18853. @item bnuttall
  18854. @item bhann
  18855. @item sine
  18856. @item nuttall
  18857. @item lanczos
  18858. @item gauss
  18859. @item tukey
  18860. @item dolph
  18861. @item cauchy
  18862. @item parzen
  18863. @item poisson
  18864. @item bohman
  18865. @end table
  18866. Default value is @code{hann}.
  18867. @item orientation
  18868. Set orientation of time vs frequency axis. Can be @code{vertical} or
  18869. @code{horizontal}. Default is @code{vertical}.
  18870. @item overlap
  18871. Set ratio of overlap window. Default value is @code{0}.
  18872. When value is @code{1} overlap is set to recommended size for specific
  18873. window function currently used.
  18874. @item gain
  18875. Set scale gain for calculating intensity color values.
  18876. Default value is @code{1}.
  18877. @item data
  18878. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  18879. @item rotation
  18880. Set color rotation, must be in [-1.0, 1.0] range.
  18881. Default value is @code{0}.
  18882. @item start
  18883. Set start frequency from which to display spectrogram. Default is @code{0}.
  18884. @item stop
  18885. Set stop frequency to which to display spectrogram. Default is @code{0}.
  18886. @item fps
  18887. Set upper frame rate limit. Default is @code{auto}, unlimited.
  18888. @item legend
  18889. Draw time and frequency axes and legends. Default is disabled.
  18890. @end table
  18891. The usage is very similar to the showwaves filter; see the examples in that
  18892. section.
  18893. @subsection Examples
  18894. @itemize
  18895. @item
  18896. Large window with logarithmic color scaling:
  18897. @example
  18898. showspectrum=s=1280x480:scale=log
  18899. @end example
  18900. @item
  18901. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  18902. @example
  18903. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  18904. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  18905. @end example
  18906. @end itemize
  18907. @section showspectrumpic
  18908. Convert input audio to a single video frame, representing the audio frequency
  18909. spectrum.
  18910. The filter accepts the following options:
  18911. @table @option
  18912. @item size, s
  18913. Specify the video size for the output. For the syntax of this option, check the
  18914. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18915. Default value is @code{4096x2048}.
  18916. @item mode
  18917. Specify display mode.
  18918. It accepts the following values:
  18919. @table @samp
  18920. @item combined
  18921. all channels are displayed in the same row
  18922. @item separate
  18923. all channels are displayed in separate rows
  18924. @end table
  18925. Default value is @samp{combined}.
  18926. @item color
  18927. Specify display color mode.
  18928. It accepts the following values:
  18929. @table @samp
  18930. @item channel
  18931. each channel is displayed in a separate color
  18932. @item intensity
  18933. each channel is displayed using the same color scheme
  18934. @item rainbow
  18935. each channel is displayed using the rainbow color scheme
  18936. @item moreland
  18937. each channel is displayed using the moreland color scheme
  18938. @item nebulae
  18939. each channel is displayed using the nebulae color scheme
  18940. @item fire
  18941. each channel is displayed using the fire color scheme
  18942. @item fiery
  18943. each channel is displayed using the fiery color scheme
  18944. @item fruit
  18945. each channel is displayed using the fruit color scheme
  18946. @item cool
  18947. each channel is displayed using the cool color scheme
  18948. @item magma
  18949. each channel is displayed using the magma color scheme
  18950. @item green
  18951. each channel is displayed using the green color scheme
  18952. @item viridis
  18953. each channel is displayed using the viridis color scheme
  18954. @item plasma
  18955. each channel is displayed using the plasma color scheme
  18956. @item cividis
  18957. each channel is displayed using the cividis color scheme
  18958. @item terrain
  18959. each channel is displayed using the terrain color scheme
  18960. @end table
  18961. Default value is @samp{intensity}.
  18962. @item scale
  18963. Specify scale used for calculating intensity color values.
  18964. It accepts the following values:
  18965. @table @samp
  18966. @item lin
  18967. linear
  18968. @item sqrt
  18969. square root, default
  18970. @item cbrt
  18971. cubic root
  18972. @item log
  18973. logarithmic
  18974. @item 4thrt
  18975. 4th root
  18976. @item 5thrt
  18977. 5th root
  18978. @end table
  18979. Default value is @samp{log}.
  18980. @item fscale
  18981. Specify frequency scale.
  18982. It accepts the following values:
  18983. @table @samp
  18984. @item lin
  18985. linear
  18986. @item log
  18987. logarithmic
  18988. @end table
  18989. Default value is @samp{lin}.
  18990. @item saturation
  18991. Set saturation modifier for displayed colors. Negative values provide
  18992. alternative color scheme. @code{0} is no saturation at all.
  18993. Saturation must be in [-10.0, 10.0] range.
  18994. Default value is @code{1}.
  18995. @item win_func
  18996. Set window function.
  18997. It accepts the following values:
  18998. @table @samp
  18999. @item rect
  19000. @item bartlett
  19001. @item hann
  19002. @item hanning
  19003. @item hamming
  19004. @item blackman
  19005. @item welch
  19006. @item flattop
  19007. @item bharris
  19008. @item bnuttall
  19009. @item bhann
  19010. @item sine
  19011. @item nuttall
  19012. @item lanczos
  19013. @item gauss
  19014. @item tukey
  19015. @item dolph
  19016. @item cauchy
  19017. @item parzen
  19018. @item poisson
  19019. @item bohman
  19020. @end table
  19021. Default value is @code{hann}.
  19022. @item orientation
  19023. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19024. @code{horizontal}. Default is @code{vertical}.
  19025. @item gain
  19026. Set scale gain for calculating intensity color values.
  19027. Default value is @code{1}.
  19028. @item legend
  19029. Draw time and frequency axes and legends. Default is enabled.
  19030. @item rotation
  19031. Set color rotation, must be in [-1.0, 1.0] range.
  19032. Default value is @code{0}.
  19033. @item start
  19034. Set start frequency from which to display spectrogram. Default is @code{0}.
  19035. @item stop
  19036. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19037. @end table
  19038. @subsection Examples
  19039. @itemize
  19040. @item
  19041. Extract an audio spectrogram of a whole audio track
  19042. in a 1024x1024 picture using @command{ffmpeg}:
  19043. @example
  19044. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  19045. @end example
  19046. @end itemize
  19047. @section showvolume
  19048. Convert input audio volume to a video output.
  19049. The filter accepts the following options:
  19050. @table @option
  19051. @item rate, r
  19052. Set video rate.
  19053. @item b
  19054. Set border width, allowed range is [0, 5]. Default is 1.
  19055. @item w
  19056. Set channel width, allowed range is [80, 8192]. Default is 400.
  19057. @item h
  19058. Set channel height, allowed range is [1, 900]. Default is 20.
  19059. @item f
  19060. Set fade, allowed range is [0, 1]. Default is 0.95.
  19061. @item c
  19062. Set volume color expression.
  19063. The expression can use the following variables:
  19064. @table @option
  19065. @item VOLUME
  19066. Current max volume of channel in dB.
  19067. @item PEAK
  19068. Current peak.
  19069. @item CHANNEL
  19070. Current channel number, starting from 0.
  19071. @end table
  19072. @item t
  19073. If set, displays channel names. Default is enabled.
  19074. @item v
  19075. If set, displays volume values. Default is enabled.
  19076. @item o
  19077. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  19078. default is @code{h}.
  19079. @item s
  19080. Set step size, allowed range is [0, 5]. Default is 0, which means
  19081. step is disabled.
  19082. @item p
  19083. Set background opacity, allowed range is [0, 1]. Default is 0.
  19084. @item m
  19085. Set metering mode, can be peak: @code{p} or rms: @code{r},
  19086. default is @code{p}.
  19087. @item ds
  19088. Set display scale, can be linear: @code{lin} or log: @code{log},
  19089. default is @code{lin}.
  19090. @item dm
  19091. In second.
  19092. If set to > 0., display a line for the max level
  19093. in the previous seconds.
  19094. default is disabled: @code{0.}
  19095. @item dmc
  19096. The color of the max line. Use when @code{dm} option is set to > 0.
  19097. default is: @code{orange}
  19098. @end table
  19099. @section showwaves
  19100. Convert input audio to a video output, representing the samples waves.
  19101. The filter accepts the following options:
  19102. @table @option
  19103. @item size, s
  19104. Specify the video size for the output. For the syntax of this option, check the
  19105. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19106. Default value is @code{600x240}.
  19107. @item mode
  19108. Set display mode.
  19109. Available values are:
  19110. @table @samp
  19111. @item point
  19112. Draw a point for each sample.
  19113. @item line
  19114. Draw a vertical line for each sample.
  19115. @item p2p
  19116. Draw a point for each sample and a line between them.
  19117. @item cline
  19118. Draw a centered vertical line for each sample.
  19119. @end table
  19120. Default value is @code{point}.
  19121. @item n
  19122. Set the number of samples which are printed on the same column. A
  19123. larger value will decrease the frame rate. Must be a positive
  19124. integer. This option can be set only if the value for @var{rate}
  19125. is not explicitly specified.
  19126. @item rate, r
  19127. Set the (approximate) output frame rate. This is done by setting the
  19128. option @var{n}. Default value is "25".
  19129. @item split_channels
  19130. Set if channels should be drawn separately or overlap. Default value is 0.
  19131. @item colors
  19132. Set colors separated by '|' which are going to be used for drawing of each channel.
  19133. @item scale
  19134. Set amplitude scale.
  19135. Available values are:
  19136. @table @samp
  19137. @item lin
  19138. Linear.
  19139. @item log
  19140. Logarithmic.
  19141. @item sqrt
  19142. Square root.
  19143. @item cbrt
  19144. Cubic root.
  19145. @end table
  19146. Default is linear.
  19147. @item draw
  19148. Set the draw mode. This is mostly useful to set for high @var{n}.
  19149. Available values are:
  19150. @table @samp
  19151. @item scale
  19152. Scale pixel values for each drawn sample.
  19153. @item full
  19154. Draw every sample directly.
  19155. @end table
  19156. Default value is @code{scale}.
  19157. @end table
  19158. @subsection Examples
  19159. @itemize
  19160. @item
  19161. Output the input file audio and the corresponding video representation
  19162. at the same time:
  19163. @example
  19164. amovie=a.mp3,asplit[out0],showwaves[out1]
  19165. @end example
  19166. @item
  19167. Create a synthetic signal and show it with showwaves, forcing a
  19168. frame rate of 30 frames per second:
  19169. @example
  19170. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  19171. @end example
  19172. @end itemize
  19173. @section showwavespic
  19174. Convert input audio to a single video frame, representing the samples waves.
  19175. The filter accepts the following options:
  19176. @table @option
  19177. @item size, s
  19178. Specify the video size for the output. For the syntax of this option, check the
  19179. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19180. Default value is @code{600x240}.
  19181. @item split_channels
  19182. Set if channels should be drawn separately or overlap. Default value is 0.
  19183. @item colors
  19184. Set colors separated by '|' which are going to be used for drawing of each channel.
  19185. @item scale
  19186. Set amplitude scale.
  19187. Available values are:
  19188. @table @samp
  19189. @item lin
  19190. Linear.
  19191. @item log
  19192. Logarithmic.
  19193. @item sqrt
  19194. Square root.
  19195. @item cbrt
  19196. Cubic root.
  19197. @end table
  19198. Default is linear.
  19199. @item draw
  19200. Set the draw mode.
  19201. Available values are:
  19202. @table @samp
  19203. @item scale
  19204. Scale pixel values for each drawn sample.
  19205. @item full
  19206. Draw every sample directly.
  19207. @end table
  19208. Default value is @code{scale}.
  19209. @end table
  19210. @subsection Examples
  19211. @itemize
  19212. @item
  19213. Extract a channel split representation of the wave form of a whole audio track
  19214. in a 1024x800 picture using @command{ffmpeg}:
  19215. @example
  19216. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  19217. @end example
  19218. @end itemize
  19219. @section sidedata, asidedata
  19220. Delete frame side data, or select frames based on it.
  19221. This filter accepts the following options:
  19222. @table @option
  19223. @item mode
  19224. Set mode of operation of the filter.
  19225. Can be one of the following:
  19226. @table @samp
  19227. @item select
  19228. Select every frame with side data of @code{type}.
  19229. @item delete
  19230. Delete side data of @code{type}. If @code{type} is not set, delete all side
  19231. data in the frame.
  19232. @end table
  19233. @item type
  19234. Set side data type used with all modes. Must be set for @code{select} mode. For
  19235. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  19236. in @file{libavutil/frame.h}. For example, to choose
  19237. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  19238. @end table
  19239. @section spectrumsynth
  19240. Synthesize audio from 2 input video spectrums, first input stream represents
  19241. magnitude across time and second represents phase across time.
  19242. The filter will transform from frequency domain as displayed in videos back
  19243. to time domain as presented in audio output.
  19244. This filter is primarily created for reversing processed @ref{showspectrum}
  19245. filter outputs, but can synthesize sound from other spectrograms too.
  19246. But in such case results are going to be poor if the phase data is not
  19247. available, because in such cases phase data need to be recreated, usually
  19248. it's just recreated from random noise.
  19249. For best results use gray only output (@code{channel} color mode in
  19250. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  19251. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  19252. @code{data} option. Inputs videos should generally use @code{fullframe}
  19253. slide mode as that saves resources needed for decoding video.
  19254. The filter accepts the following options:
  19255. @table @option
  19256. @item sample_rate
  19257. Specify sample rate of output audio, the sample rate of audio from which
  19258. spectrum was generated may differ.
  19259. @item channels
  19260. Set number of channels represented in input video spectrums.
  19261. @item scale
  19262. Set scale which was used when generating magnitude input spectrum.
  19263. Can be @code{lin} or @code{log}. Default is @code{log}.
  19264. @item slide
  19265. Set slide which was used when generating inputs spectrums.
  19266. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  19267. Default is @code{fullframe}.
  19268. @item win_func
  19269. Set window function used for resynthesis.
  19270. @item overlap
  19271. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19272. which means optimal overlap for selected window function will be picked.
  19273. @item orientation
  19274. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  19275. Default is @code{vertical}.
  19276. @end table
  19277. @subsection Examples
  19278. @itemize
  19279. @item
  19280. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  19281. then resynthesize videos back to audio with spectrumsynth:
  19282. @example
  19283. 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
  19284. 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
  19285. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  19286. @end example
  19287. @end itemize
  19288. @section split, asplit
  19289. Split input into several identical outputs.
  19290. @code{asplit} works with audio input, @code{split} with video.
  19291. The filter accepts a single parameter which specifies the number of outputs. If
  19292. unspecified, it defaults to 2.
  19293. @subsection Examples
  19294. @itemize
  19295. @item
  19296. Create two separate outputs from the same input:
  19297. @example
  19298. [in] split [out0][out1]
  19299. @end example
  19300. @item
  19301. To create 3 or more outputs, you need to specify the number of
  19302. outputs, like in:
  19303. @example
  19304. [in] asplit=3 [out0][out1][out2]
  19305. @end example
  19306. @item
  19307. Create two separate outputs from the same input, one cropped and
  19308. one padded:
  19309. @example
  19310. [in] split [splitout1][splitout2];
  19311. [splitout1] crop=100:100:0:0 [cropout];
  19312. [splitout2] pad=200:200:100:100 [padout];
  19313. @end example
  19314. @item
  19315. Create 5 copies of the input audio with @command{ffmpeg}:
  19316. @example
  19317. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  19318. @end example
  19319. @end itemize
  19320. @section zmq, azmq
  19321. Receive commands sent through a libzmq client, and forward them to
  19322. filters in the filtergraph.
  19323. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  19324. must be inserted between two video filters, @code{azmq} between two
  19325. audio filters. Both are capable to send messages to any filter type.
  19326. To enable these filters you need to install the libzmq library and
  19327. headers and configure FFmpeg with @code{--enable-libzmq}.
  19328. For more information about libzmq see:
  19329. @url{http://www.zeromq.org/}
  19330. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  19331. receives messages sent through a network interface defined by the
  19332. @option{bind_address} (or the abbreviation "@option{b}") option.
  19333. Default value of this option is @file{tcp://localhost:5555}. You may
  19334. want to alter this value to your needs, but do not forget to escape any
  19335. ':' signs (see @ref{filtergraph escaping}).
  19336. The received message must be in the form:
  19337. @example
  19338. @var{TARGET} @var{COMMAND} [@var{ARG}]
  19339. @end example
  19340. @var{TARGET} specifies the target of the command, usually the name of
  19341. the filter class or a specific filter instance name. The default
  19342. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  19343. but you can override this by using the @samp{filter_name@@id} syntax
  19344. (see @ref{Filtergraph syntax}).
  19345. @var{COMMAND} specifies the name of the command for the target filter.
  19346. @var{ARG} is optional and specifies the optional argument list for the
  19347. given @var{COMMAND}.
  19348. Upon reception, the message is processed and the corresponding command
  19349. is injected into the filtergraph. Depending on the result, the filter
  19350. will send a reply to the client, adopting the format:
  19351. @example
  19352. @var{ERROR_CODE} @var{ERROR_REASON}
  19353. @var{MESSAGE}
  19354. @end example
  19355. @var{MESSAGE} is optional.
  19356. @subsection Examples
  19357. Look at @file{tools/zmqsend} for an example of a zmq client which can
  19358. be used to send commands processed by these filters.
  19359. Consider the following filtergraph generated by @command{ffplay}.
  19360. In this example the last overlay filter has an instance name. All other
  19361. filters will have default instance names.
  19362. @example
  19363. ffplay -dumpgraph 1 -f lavfi "
  19364. color=s=100x100:c=red [l];
  19365. color=s=100x100:c=blue [r];
  19366. nullsrc=s=200x100, zmq [bg];
  19367. [bg][l] overlay [bg+l];
  19368. [bg+l][r] overlay@@my=x=100 "
  19369. @end example
  19370. To change the color of the left side of the video, the following
  19371. command can be used:
  19372. @example
  19373. echo Parsed_color_0 c yellow | tools/zmqsend
  19374. @end example
  19375. To change the right side:
  19376. @example
  19377. echo Parsed_color_1 c pink | tools/zmqsend
  19378. @end example
  19379. To change the position of the right side:
  19380. @example
  19381. echo overlay@@my x 150 | tools/zmqsend
  19382. @end example
  19383. @c man end MULTIMEDIA FILTERS
  19384. @chapter Multimedia Sources
  19385. @c man begin MULTIMEDIA SOURCES
  19386. Below is a description of the currently available multimedia sources.
  19387. @section amovie
  19388. This is the same as @ref{movie} source, except it selects an audio
  19389. stream by default.
  19390. @anchor{movie}
  19391. @section movie
  19392. Read audio and/or video stream(s) from a movie container.
  19393. It accepts the following parameters:
  19394. @table @option
  19395. @item filename
  19396. The name of the resource to read (not necessarily a file; it can also be a
  19397. device or a stream accessed through some protocol).
  19398. @item format_name, f
  19399. Specifies the format assumed for the movie to read, and can be either
  19400. the name of a container or an input device. If not specified, the
  19401. format is guessed from @var{movie_name} or by probing.
  19402. @item seek_point, sp
  19403. Specifies the seek point in seconds. The frames will be output
  19404. starting from this seek point. The parameter is evaluated with
  19405. @code{av_strtod}, so the numerical value may be suffixed by an IS
  19406. postfix. The default value is "0".
  19407. @item streams, s
  19408. Specifies the streams to read. Several streams can be specified,
  19409. separated by "+". The source will then have as many outputs, in the
  19410. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  19411. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  19412. respectively the default (best suited) video and audio stream. Default
  19413. is "dv", or "da" if the filter is called as "amovie".
  19414. @item stream_index, si
  19415. Specifies the index of the video stream to read. If the value is -1,
  19416. the most suitable video stream will be automatically selected. The default
  19417. value is "-1". Deprecated. If the filter is called "amovie", it will select
  19418. audio instead of video.
  19419. @item loop
  19420. Specifies how many times to read the stream in sequence.
  19421. If the value is 0, the stream will be looped infinitely.
  19422. Default value is "1".
  19423. Note that when the movie is looped the source timestamps are not
  19424. changed, so it will generate non monotonically increasing timestamps.
  19425. @item discontinuity
  19426. Specifies the time difference between frames above which the point is
  19427. considered a timestamp discontinuity which is removed by adjusting the later
  19428. timestamps.
  19429. @end table
  19430. It allows overlaying a second video on top of the main input of
  19431. a filtergraph, as shown in this graph:
  19432. @example
  19433. input -----------> deltapts0 --> overlay --> output
  19434. ^
  19435. |
  19436. movie --> scale--> deltapts1 -------+
  19437. @end example
  19438. @subsection Examples
  19439. @itemize
  19440. @item
  19441. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  19442. on top of the input labelled "in":
  19443. @example
  19444. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19445. [in] setpts=PTS-STARTPTS [main];
  19446. [main][over] overlay=16:16 [out]
  19447. @end example
  19448. @item
  19449. Read from a video4linux2 device, and overlay it on top of the input
  19450. labelled "in":
  19451. @example
  19452. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19453. [in] setpts=PTS-STARTPTS [main];
  19454. [main][over] overlay=16:16 [out]
  19455. @end example
  19456. @item
  19457. Read the first video stream and the audio stream with id 0x81 from
  19458. dvd.vob; the video is connected to the pad named "video" and the audio is
  19459. connected to the pad named "audio":
  19460. @example
  19461. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  19462. @end example
  19463. @end itemize
  19464. @subsection Commands
  19465. Both movie and amovie support the following commands:
  19466. @table @option
  19467. @item seek
  19468. Perform seek using "av_seek_frame".
  19469. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  19470. @itemize
  19471. @item
  19472. @var{stream_index}: If stream_index is -1, a default
  19473. stream is selected, and @var{timestamp} is automatically converted
  19474. from AV_TIME_BASE units to the stream specific time_base.
  19475. @item
  19476. @var{timestamp}: Timestamp in AVStream.time_base units
  19477. or, if no stream is specified, in AV_TIME_BASE units.
  19478. @item
  19479. @var{flags}: Flags which select direction and seeking mode.
  19480. @end itemize
  19481. @item get_duration
  19482. Get movie duration in AV_TIME_BASE units.
  19483. @end table
  19484. @c man end MULTIMEDIA SOURCES