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.

24283 lines
645KB

  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. @section acontrast
  356. Simple audio dynamic range compression/expansion filter.
  357. The filter accepts the following options:
  358. @table @option
  359. @item contrast
  360. Set contrast. Default is 33. Allowed range is between 0 and 100.
  361. @end table
  362. @section acopy
  363. Copy the input audio source unchanged to the output. This is mainly useful for
  364. testing purposes.
  365. @section acrossfade
  366. Apply cross fade from one input audio stream to another input audio stream.
  367. The cross fade is applied for specified duration near the end of first stream.
  368. The filter accepts the following options:
  369. @table @option
  370. @item nb_samples, ns
  371. Specify the number of samples for which the cross fade effect has to last.
  372. At the end of the cross fade effect the first input audio will be completely
  373. silent. Default is 44100.
  374. @item duration, d
  375. Specify the duration of the cross fade effect. See
  376. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  377. for the accepted syntax.
  378. By default the duration is determined by @var{nb_samples}.
  379. If set this option is used instead of @var{nb_samples}.
  380. @item overlap, o
  381. Should first stream end overlap with second stream start. Default is enabled.
  382. @item curve1
  383. Set curve for cross fade transition for first stream.
  384. @item curve2
  385. Set curve for cross fade transition for second stream.
  386. For description of available curve types see @ref{afade} filter description.
  387. @end table
  388. @subsection Examples
  389. @itemize
  390. @item
  391. Cross fade from one input to another:
  392. @example
  393. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  394. @end example
  395. @item
  396. Cross fade from one input to another but without overlapping:
  397. @example
  398. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  399. @end example
  400. @end itemize
  401. @section acrossover
  402. Split audio stream into several bands.
  403. This filter splits audio stream into two or more frequency ranges.
  404. Summing all streams back will give flat output.
  405. The filter accepts the following options:
  406. @table @option
  407. @item split
  408. Set split frequencies. Those must be positive and increasing.
  409. @item order
  410. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  411. Default is @var{4th}.
  412. @end table
  413. @section acrusher
  414. Reduce audio bit resolution.
  415. This filter is bit crusher with enhanced functionality. A bit crusher
  416. is used to audibly reduce number of bits an audio signal is sampled
  417. with. This doesn't change the bit depth at all, it just produces the
  418. effect. Material reduced in bit depth sounds more harsh and "digital".
  419. This filter is able to even round to continuous values instead of discrete
  420. bit depths.
  421. Additionally it has a D/C offset which results in different crushing of
  422. the lower and the upper half of the signal.
  423. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  424. Another feature of this filter is the logarithmic mode.
  425. This setting switches from linear distances between bits to logarithmic ones.
  426. The result is a much more "natural" sounding crusher which doesn't gate low
  427. signals for example. The human ear has a logarithmic perception,
  428. so this kind of crushing is much more pleasant.
  429. Logarithmic crushing is also able to get anti-aliased.
  430. The filter accepts the following options:
  431. @table @option
  432. @item level_in
  433. Set level in.
  434. @item level_out
  435. Set level out.
  436. @item bits
  437. Set bit reduction.
  438. @item mix
  439. Set mixing amount.
  440. @item mode
  441. Can be linear: @code{lin} or logarithmic: @code{log}.
  442. @item dc
  443. Set DC.
  444. @item aa
  445. Set anti-aliasing.
  446. @item samples
  447. Set sample reduction.
  448. @item lfo
  449. Enable LFO. By default disabled.
  450. @item lforange
  451. Set LFO range.
  452. @item lforate
  453. Set LFO rate.
  454. @end table
  455. @section acue
  456. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  457. filter.
  458. @section adeclick
  459. Remove impulsive noise from input audio.
  460. Samples detected as impulsive noise are replaced by interpolated samples using
  461. autoregressive modelling.
  462. @table @option
  463. @item w
  464. Set window size, in milliseconds. Allowed range is from @code{10} to
  465. @code{100}. Default value is @code{55} milliseconds.
  466. This sets size of window which will be processed at once.
  467. @item o
  468. Set window overlap, in percentage of window size. Allowed range is from
  469. @code{50} to @code{95}. Default value is @code{75} percent.
  470. Setting this to a very high value increases impulsive noise removal but makes
  471. whole process much slower.
  472. @item a
  473. Set autoregression order, in percentage of window size. Allowed range is from
  474. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  475. controls quality of interpolated samples using neighbour good samples.
  476. @item t
  477. Set threshold value. Allowed range is from @code{1} to @code{100}.
  478. Default value is @code{2}.
  479. This controls the strength of impulsive noise which is going to be removed.
  480. The lower value, the more samples will be detected as impulsive noise.
  481. @item b
  482. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  483. @code{10}. Default value is @code{2}.
  484. If any two samples detected as noise are spaced less than this value then any
  485. sample between those two samples will be also detected as noise.
  486. @item m
  487. Set overlap method.
  488. It accepts the following values:
  489. @table @option
  490. @item a
  491. Select overlap-add method. Even not interpolated samples are slightly
  492. changed with this method.
  493. @item s
  494. Select overlap-save method. Not interpolated samples remain unchanged.
  495. @end table
  496. Default value is @code{a}.
  497. @end table
  498. @section adeclip
  499. Remove clipped samples from input audio.
  500. Samples detected as clipped are replaced by interpolated samples using
  501. autoregressive modelling.
  502. @table @option
  503. @item w
  504. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  505. Default value is @code{55} milliseconds.
  506. This sets size of window which will be processed at once.
  507. @item o
  508. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  509. to @code{95}. Default value is @code{75} percent.
  510. @item a
  511. Set autoregression order, in percentage of window size. Allowed range is from
  512. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  513. quality of interpolated samples using neighbour good samples.
  514. @item t
  515. Set threshold value. Allowed range is from @code{1} to @code{100}.
  516. Default value is @code{10}. Higher values make clip detection less aggressive.
  517. @item n
  518. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  519. Default value is @code{1000}. Higher values make clip detection less aggressive.
  520. @item m
  521. Set overlap method.
  522. It accepts the following values:
  523. @table @option
  524. @item a
  525. Select overlap-add method. Even not interpolated samples are slightly changed
  526. with this method.
  527. @item s
  528. Select overlap-save method. Not interpolated samples remain unchanged.
  529. @end table
  530. Default value is @code{a}.
  531. @end table
  532. @section adelay
  533. Delay one or more audio channels.
  534. Samples in delayed channel are filled with silence.
  535. The filter accepts the following option:
  536. @table @option
  537. @item delays
  538. Set list of delays in milliseconds for each channel separated by '|'.
  539. Unused delays will be silently ignored. If number of given delays is
  540. smaller than number of channels all remaining channels will not be delayed.
  541. If you want to delay exact number of samples, append 'S' to number.
  542. If you want instead to delay in seconds, append 's' to number.
  543. @item all
  544. Use last set delay for all remaining channels. By default is disabled.
  545. This option if enabled changes how option @code{delays} is interpreted.
  546. @end table
  547. @subsection Examples
  548. @itemize
  549. @item
  550. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  551. the second channel (and any other channels that may be present) unchanged.
  552. @example
  553. adelay=1500|0|500
  554. @end example
  555. @item
  556. Delay second channel by 500 samples, the third channel by 700 samples and leave
  557. the first channel (and any other channels that may be present) unchanged.
  558. @example
  559. adelay=0|500S|700S
  560. @end example
  561. @item
  562. Delay all channels by same number of samples:
  563. @example
  564. adelay=delays=64S:all=1
  565. @end example
  566. @end itemize
  567. @section aderivative, aintegral
  568. Compute derivative/integral of audio stream.
  569. Applying both filters one after another produces original audio.
  570. @section aecho
  571. Apply echoing to the input audio.
  572. Echoes are reflected sound and can occur naturally amongst mountains
  573. (and sometimes large buildings) when talking or shouting; digital echo
  574. effects emulate this behaviour and are often used to help fill out the
  575. sound of a single instrument or vocal. The time difference between the
  576. original signal and the reflection is the @code{delay}, and the
  577. loudness of the reflected signal is the @code{decay}.
  578. Multiple echoes can have different delays and decays.
  579. A description of the accepted parameters follows.
  580. @table @option
  581. @item in_gain
  582. Set input gain of reflected signal. Default is @code{0.6}.
  583. @item out_gain
  584. Set output gain of reflected signal. Default is @code{0.3}.
  585. @item delays
  586. Set list of time intervals in milliseconds between original signal and reflections
  587. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  588. Default is @code{1000}.
  589. @item decays
  590. Set list of loudness of reflected signals separated by '|'.
  591. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  592. Default is @code{0.5}.
  593. @end table
  594. @subsection Examples
  595. @itemize
  596. @item
  597. Make it sound as if there are twice as many instruments as are actually playing:
  598. @example
  599. aecho=0.8:0.88:60:0.4
  600. @end example
  601. @item
  602. If delay is very short, then it sounds like a (metallic) robot playing music:
  603. @example
  604. aecho=0.8:0.88:6:0.4
  605. @end example
  606. @item
  607. A longer delay will sound like an open air concert in the mountains:
  608. @example
  609. aecho=0.8:0.9:1000:0.3
  610. @end example
  611. @item
  612. Same as above but with one more mountain:
  613. @example
  614. aecho=0.8:0.9:1000|1800:0.3|0.25
  615. @end example
  616. @end itemize
  617. @section aemphasis
  618. Audio emphasis filter creates or restores material directly taken from LPs or
  619. emphased CDs with different filter curves. E.g. to store music on vinyl the
  620. signal has to be altered by a filter first to even out the disadvantages of
  621. this recording medium.
  622. Once the material is played back the inverse filter has to be applied to
  623. restore the distortion of the frequency response.
  624. The filter accepts the following options:
  625. @table @option
  626. @item level_in
  627. Set input gain.
  628. @item level_out
  629. Set output gain.
  630. @item mode
  631. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  632. use @code{production} mode. Default is @code{reproduction} mode.
  633. @item type
  634. Set filter type. Selects medium. Can be one of the following:
  635. @table @option
  636. @item col
  637. select Columbia.
  638. @item emi
  639. select EMI.
  640. @item bsi
  641. select BSI (78RPM).
  642. @item riaa
  643. select RIAA.
  644. @item cd
  645. select Compact Disc (CD).
  646. @item 50fm
  647. select 50µs (FM).
  648. @item 75fm
  649. select 75µs (FM).
  650. @item 50kf
  651. select 50µs (FM-KF).
  652. @item 75kf
  653. select 75µs (FM-KF).
  654. @end table
  655. @end table
  656. @section aeval
  657. Modify an audio signal according to the specified expressions.
  658. This filter accepts one or more expressions (one for each channel),
  659. which are evaluated and used to modify a corresponding audio signal.
  660. It accepts the following parameters:
  661. @table @option
  662. @item exprs
  663. Set the '|'-separated expressions list for each separate channel. If
  664. the number of input channels is greater than the number of
  665. expressions, the last specified expression is used for the remaining
  666. output channels.
  667. @item channel_layout, c
  668. Set output channel layout. If not specified, the channel layout is
  669. specified by the number of expressions. If set to @samp{same}, it will
  670. use by default the same input channel layout.
  671. @end table
  672. Each expression in @var{exprs} can contain the following constants and functions:
  673. @table @option
  674. @item ch
  675. channel number of the current expression
  676. @item n
  677. number of the evaluated sample, starting from 0
  678. @item s
  679. sample rate
  680. @item t
  681. time of the evaluated sample expressed in seconds
  682. @item nb_in_channels
  683. @item nb_out_channels
  684. input and output number of channels
  685. @item val(CH)
  686. the value of input channel with number @var{CH}
  687. @end table
  688. Note: this filter is slow. For faster processing you should use a
  689. dedicated filter.
  690. @subsection Examples
  691. @itemize
  692. @item
  693. Half volume:
  694. @example
  695. aeval=val(ch)/2:c=same
  696. @end example
  697. @item
  698. Invert phase of the second channel:
  699. @example
  700. aeval=val(0)|-val(1)
  701. @end example
  702. @end itemize
  703. @anchor{afade}
  704. @section afade
  705. Apply fade-in/out effect to input audio.
  706. A description of the accepted parameters follows.
  707. @table @option
  708. @item type, t
  709. Specify the effect type, can be either @code{in} for fade-in, or
  710. @code{out} for a fade-out effect. Default is @code{in}.
  711. @item start_sample, ss
  712. Specify the number of the start sample for starting to apply the fade
  713. effect. Default is 0.
  714. @item nb_samples, ns
  715. Specify the number of samples for which the fade effect has to last. At
  716. the end of the fade-in effect the output audio will have the same
  717. volume as the input audio, at the end of the fade-out transition
  718. the output audio will be silence. Default is 44100.
  719. @item start_time, st
  720. Specify the start time of the fade effect. Default is 0.
  721. The value must be specified as a time duration; see
  722. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  723. for the accepted syntax.
  724. If set this option is used instead of @var{start_sample}.
  725. @item duration, d
  726. Specify the duration of the fade effect. See
  727. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  728. for the accepted syntax.
  729. At the end of the fade-in effect the output audio will have the same
  730. volume as the input audio, at the end of the fade-out transition
  731. the output audio will be silence.
  732. By default the duration is determined by @var{nb_samples}.
  733. If set this option is used instead of @var{nb_samples}.
  734. @item curve
  735. Set curve for fade transition.
  736. It accepts the following values:
  737. @table @option
  738. @item tri
  739. select triangular, linear slope (default)
  740. @item qsin
  741. select quarter of sine wave
  742. @item hsin
  743. select half of sine wave
  744. @item esin
  745. select exponential sine wave
  746. @item log
  747. select logarithmic
  748. @item ipar
  749. select inverted parabola
  750. @item qua
  751. select quadratic
  752. @item cub
  753. select cubic
  754. @item squ
  755. select square root
  756. @item cbr
  757. select cubic root
  758. @item par
  759. select parabola
  760. @item exp
  761. select exponential
  762. @item iqsin
  763. select inverted quarter of sine wave
  764. @item ihsin
  765. select inverted half of sine wave
  766. @item dese
  767. select double-exponential seat
  768. @item desi
  769. select double-exponential sigmoid
  770. @item losi
  771. select logistic sigmoid
  772. @item nofade
  773. no fade applied
  774. @end table
  775. @end table
  776. @subsection Examples
  777. @itemize
  778. @item
  779. Fade in first 15 seconds of audio:
  780. @example
  781. afade=t=in:ss=0:d=15
  782. @end example
  783. @item
  784. Fade out last 25 seconds of a 900 seconds audio:
  785. @example
  786. afade=t=out:st=875:d=25
  787. @end example
  788. @end itemize
  789. @section afftdn
  790. Denoise audio samples with FFT.
  791. A description of the accepted parameters follows.
  792. @table @option
  793. @item nr
  794. Set the noise reduction in dB, allowed range is 0.01 to 97.
  795. Default value is 12 dB.
  796. @item nf
  797. Set the noise floor in dB, allowed range is -80 to -20.
  798. Default value is -50 dB.
  799. @item nt
  800. Set the noise type.
  801. It accepts the following values:
  802. @table @option
  803. @item w
  804. Select white noise.
  805. @item v
  806. Select vinyl noise.
  807. @item s
  808. Select shellac noise.
  809. @item c
  810. Select custom noise, defined in @code{bn} option.
  811. Default value is white noise.
  812. @end table
  813. @item bn
  814. Set custom band noise for every one of 15 bands.
  815. Bands are separated by ' ' or '|'.
  816. @item rf
  817. Set the residual floor in dB, allowed range is -80 to -20.
  818. Default value is -38 dB.
  819. @item tn
  820. Enable noise tracking. By default is disabled.
  821. With this enabled, noise floor is automatically adjusted.
  822. @item tr
  823. Enable residual tracking. By default is disabled.
  824. @item om
  825. Set the output mode.
  826. It accepts the following values:
  827. @table @option
  828. @item i
  829. Pass input unchanged.
  830. @item o
  831. Pass noise filtered out.
  832. @item n
  833. Pass only noise.
  834. Default value is @var{o}.
  835. @end table
  836. @end table
  837. @subsection Commands
  838. This filter supports the following commands:
  839. @table @option
  840. @item sample_noise, sn
  841. Start or stop measuring noise profile.
  842. Syntax for the command is : "start" or "stop" string.
  843. After measuring noise profile is stopped it will be
  844. automatically applied in filtering.
  845. @item noise_reduction, nr
  846. Change noise reduction. Argument is single float number.
  847. Syntax for the command is : "@var{noise_reduction}"
  848. @item noise_floor, nf
  849. Change noise floor. Argument is single float number.
  850. Syntax for the command is : "@var{noise_floor}"
  851. @item output_mode, om
  852. Change output mode operation.
  853. Syntax for the command is : "i", "o" or "n" string.
  854. @end table
  855. @section afftfilt
  856. Apply arbitrary expressions to samples in frequency domain.
  857. @table @option
  858. @item real
  859. Set frequency domain real expression for each separate channel separated
  860. by '|'. Default is "re".
  861. If the number of input channels is greater than the number of
  862. expressions, the last specified expression is used for the remaining
  863. output channels.
  864. @item imag
  865. Set frequency domain imaginary expression for each separate channel
  866. separated by '|'. Default is "im".
  867. Each expression in @var{real} and @var{imag} can contain the following
  868. constants and functions:
  869. @table @option
  870. @item sr
  871. sample rate
  872. @item b
  873. current frequency bin number
  874. @item nb
  875. number of available bins
  876. @item ch
  877. channel number of the current expression
  878. @item chs
  879. number of channels
  880. @item pts
  881. current frame pts
  882. @item re
  883. current real part of frequency bin of current channel
  884. @item im
  885. current imaginary part of frequency bin of current channel
  886. @item real(b, ch)
  887. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  888. @item imag(b, ch)
  889. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  890. @end table
  891. @item win_size
  892. Set window size. Allowed range is from 16 to 131072.
  893. Default is @code{4096}
  894. @item win_func
  895. Set window function. Default is @code{hann}.
  896. @item overlap
  897. Set window overlap. If set to 1, the recommended overlap for selected
  898. window function will be picked. Default is @code{0.75}.
  899. @end table
  900. @subsection Examples
  901. @itemize
  902. @item
  903. Leave almost only low frequencies in audio:
  904. @example
  905. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  906. @end example
  907. @item
  908. Apply robotize effect:
  909. @example
  910. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  911. @end example
  912. @item
  913. Apply whisper effect:
  914. @example
  915. 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"
  916. @end example
  917. @end itemize
  918. @anchor{afir}
  919. @section afir
  920. Apply an arbitrary Frequency Impulse Response filter.
  921. This filter is designed for applying long FIR filters,
  922. up to 60 seconds long.
  923. It can be used as component for digital crossover filters,
  924. room equalization, cross talk cancellation, wavefield synthesis,
  925. auralization, ambiophonics, ambisonics and spatialization.
  926. This filter uses the second stream as FIR coefficients.
  927. If the second stream holds a single channel, it will be used
  928. for all input channels in the first stream, otherwise
  929. the number of channels in the second stream must be same as
  930. the number of channels in the first stream.
  931. It accepts the following parameters:
  932. @table @option
  933. @item dry
  934. Set dry gain. This sets input gain.
  935. @item wet
  936. Set wet gain. This sets final output gain.
  937. @item length
  938. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  939. @item gtype
  940. Enable applying gain measured from power of IR.
  941. Set which approach to use for auto gain measurement.
  942. @table @option
  943. @item none
  944. Do not apply any gain.
  945. @item peak
  946. select peak gain, very conservative approach. This is default value.
  947. @item dc
  948. select DC gain, limited application.
  949. @item gn
  950. select gain to noise approach, this is most popular one.
  951. @end table
  952. @item irgain
  953. Set gain to be applied to IR coefficients before filtering.
  954. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  955. @item irfmt
  956. Set format of IR stream. Can be @code{mono} or @code{input}.
  957. Default is @code{input}.
  958. @item maxir
  959. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  960. Allowed range is 0.1 to 60 seconds.
  961. @item response
  962. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  963. By default it is disabled.
  964. @item channel
  965. Set for which IR channel to display frequency response. By default is first channel
  966. displayed. This option is used only when @var{response} is enabled.
  967. @item size
  968. Set video stream size. This option is used only when @var{response} is enabled.
  969. @item rate
  970. Set video stream frame rate. This option is used only when @var{response} is enabled.
  971. @item minp
  972. Set minimal partition size used for convolution. Default is @var{8192}.
  973. Allowed range is from @var{8} to @var{32768}.
  974. Lower values decreases latency at cost of higher CPU usage.
  975. @item maxp
  976. Set maximal partition size used for convolution. Default is @var{8192}.
  977. Allowed range is from @var{8} to @var{32768}.
  978. Lower values may increase CPU usage.
  979. @end table
  980. @subsection Examples
  981. @itemize
  982. @item
  983. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  984. @example
  985. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  986. @end example
  987. @end itemize
  988. @anchor{aformat}
  989. @section aformat
  990. Set output format constraints for the input audio. The framework will
  991. negotiate the most appropriate format to minimize conversions.
  992. It accepts the following parameters:
  993. @table @option
  994. @item sample_fmts
  995. A '|'-separated list of requested sample formats.
  996. @item sample_rates
  997. A '|'-separated list of requested sample rates.
  998. @item channel_layouts
  999. A '|'-separated list of requested channel layouts.
  1000. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1001. for the required syntax.
  1002. @end table
  1003. If a parameter is omitted, all values are allowed.
  1004. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1005. @example
  1006. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1007. @end example
  1008. @section agate
  1009. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1010. processing reduces disturbing noise between useful signals.
  1011. Gating is done by detecting the volume below a chosen level @var{threshold}
  1012. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1013. floor is set via @var{range}. Because an exact manipulation of the signal
  1014. would cause distortion of the waveform the reduction can be levelled over
  1015. time. This is done by setting @var{attack} and @var{release}.
  1016. @var{attack} determines how long the signal has to fall below the threshold
  1017. before any reduction will occur and @var{release} sets the time the signal
  1018. has to rise above the threshold to reduce the reduction again.
  1019. Shorter signals than the chosen attack time will be left untouched.
  1020. @table @option
  1021. @item level_in
  1022. Set input level before filtering.
  1023. Default is 1. Allowed range is from 0.015625 to 64.
  1024. @item mode
  1025. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1026. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1027. will be amplified, expanding dynamic range in upward direction.
  1028. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1029. @item range
  1030. Set the level of gain reduction when the signal is below the threshold.
  1031. Default is 0.06125. Allowed range is from 0 to 1.
  1032. Setting this to 0 disables reduction and then filter behaves like expander.
  1033. @item threshold
  1034. If a signal rises above this level the gain reduction is released.
  1035. Default is 0.125. Allowed range is from 0 to 1.
  1036. @item ratio
  1037. Set a ratio by which the signal is reduced.
  1038. Default is 2. Allowed range is from 1 to 9000.
  1039. @item attack
  1040. Amount of milliseconds the signal has to rise above the threshold before gain
  1041. reduction stops.
  1042. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1043. @item release
  1044. Amount of milliseconds the signal has to fall below the threshold before the
  1045. reduction is increased again. Default is 250 milliseconds.
  1046. Allowed range is from 0.01 to 9000.
  1047. @item makeup
  1048. Set amount of amplification of signal after processing.
  1049. Default is 1. Allowed range is from 1 to 64.
  1050. @item knee
  1051. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1052. Default is 2.828427125. Allowed range is from 1 to 8.
  1053. @item detection
  1054. Choose if exact signal should be taken for detection or an RMS like one.
  1055. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1056. @item link
  1057. Choose if the average level between all channels or the louder channel affects
  1058. the reduction.
  1059. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1060. @end table
  1061. @section aiir
  1062. Apply an arbitrary Infinite Impulse Response filter.
  1063. It accepts the following parameters:
  1064. @table @option
  1065. @item z
  1066. Set numerator/zeros coefficients.
  1067. @item p
  1068. Set denominator/poles coefficients.
  1069. @item k
  1070. Set channels gains.
  1071. @item dry_gain
  1072. Set input gain.
  1073. @item wet_gain
  1074. Set output gain.
  1075. @item f
  1076. Set coefficients format.
  1077. @table @samp
  1078. @item tf
  1079. transfer function
  1080. @item zp
  1081. Z-plane zeros/poles, cartesian (default)
  1082. @item pr
  1083. Z-plane zeros/poles, polar radians
  1084. @item pd
  1085. Z-plane zeros/poles, polar degrees
  1086. @end table
  1087. @item r
  1088. Set kind of processing.
  1089. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1090. @item e
  1091. Set filtering precision.
  1092. @table @samp
  1093. @item dbl
  1094. double-precision floating-point (default)
  1095. @item flt
  1096. single-precision floating-point
  1097. @item i32
  1098. 32-bit integers
  1099. @item i16
  1100. 16-bit integers
  1101. @end table
  1102. @item mix
  1103. How much to use filtered signal in output. Default is 1.
  1104. Range is between 0 and 1.
  1105. @item response
  1106. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1107. By default it is disabled.
  1108. @item channel
  1109. Set for which IR channel to display frequency response. By default is first channel
  1110. displayed. This option is used only when @var{response} is enabled.
  1111. @item size
  1112. Set video stream size. This option is used only when @var{response} is enabled.
  1113. @end table
  1114. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1115. order.
  1116. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1117. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1118. imaginary unit.
  1119. Different coefficients and gains can be provided for every channel, in such case
  1120. use '|' to separate coefficients or gains. Last provided coefficients will be
  1121. used for all remaining channels.
  1122. @subsection Examples
  1123. @itemize
  1124. @item
  1125. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1126. @example
  1127. 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
  1128. @end example
  1129. @item
  1130. Same as above but in @code{zp} format:
  1131. @example
  1132. 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
  1133. @end example
  1134. @end itemize
  1135. @section alimiter
  1136. The limiter prevents an input signal from rising over a desired threshold.
  1137. This limiter uses lookahead technology to prevent your signal from distorting.
  1138. It means that there is a small delay after the signal is processed. Keep in mind
  1139. that the delay it produces is the attack time you set.
  1140. The filter accepts the following options:
  1141. @table @option
  1142. @item level_in
  1143. Set input gain. Default is 1.
  1144. @item level_out
  1145. Set output gain. Default is 1.
  1146. @item limit
  1147. Don't let signals above this level pass the limiter. Default is 1.
  1148. @item attack
  1149. The limiter will reach its attenuation level in this amount of time in
  1150. milliseconds. Default is 5 milliseconds.
  1151. @item release
  1152. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1153. Default is 50 milliseconds.
  1154. @item asc
  1155. When gain reduction is always needed ASC takes care of releasing to an
  1156. average reduction level rather than reaching a reduction of 0 in the release
  1157. time.
  1158. @item asc_level
  1159. Select how much the release time is affected by ASC, 0 means nearly no changes
  1160. in release time while 1 produces higher release times.
  1161. @item level
  1162. Auto level output signal. Default is enabled.
  1163. This normalizes audio back to 0dB if enabled.
  1164. @end table
  1165. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1166. with @ref{aresample} before applying this filter.
  1167. @section allpass
  1168. Apply a two-pole all-pass filter with central frequency (in Hz)
  1169. @var{frequency}, and filter-width @var{width}.
  1170. An all-pass filter changes the audio's frequency to phase relationship
  1171. without changing its frequency to amplitude relationship.
  1172. The filter accepts the following options:
  1173. @table @option
  1174. @item frequency, f
  1175. Set frequency in Hz.
  1176. @item width_type, t
  1177. Set method to specify band-width of filter.
  1178. @table @option
  1179. @item h
  1180. Hz
  1181. @item q
  1182. Q-Factor
  1183. @item o
  1184. octave
  1185. @item s
  1186. slope
  1187. @item k
  1188. kHz
  1189. @end table
  1190. @item width, w
  1191. Specify the band-width of a filter in width_type units.
  1192. @item mix, m
  1193. How much to use filtered signal in output. Default is 1.
  1194. Range is between 0 and 1.
  1195. @item channels, c
  1196. Specify which channels to filter, by default all available are filtered.
  1197. @end table
  1198. @subsection Commands
  1199. This filter supports the following commands:
  1200. @table @option
  1201. @item frequency, f
  1202. Change allpass frequency.
  1203. Syntax for the command is : "@var{frequency}"
  1204. @item width_type, t
  1205. Change allpass width_type.
  1206. Syntax for the command is : "@var{width_type}"
  1207. @item width, w
  1208. Change allpass width.
  1209. Syntax for the command is : "@var{width}"
  1210. @item mix, m
  1211. Change allpass mix.
  1212. Syntax for the command is : "@var{mix}"
  1213. @end table
  1214. @section aloop
  1215. Loop audio samples.
  1216. The filter accepts the following options:
  1217. @table @option
  1218. @item loop
  1219. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1220. Default is 0.
  1221. @item size
  1222. Set maximal number of samples. Default is 0.
  1223. @item start
  1224. Set first sample of loop. Default is 0.
  1225. @end table
  1226. @anchor{amerge}
  1227. @section amerge
  1228. Merge two or more audio streams into a single multi-channel stream.
  1229. The filter accepts the following options:
  1230. @table @option
  1231. @item inputs
  1232. Set the number of inputs. Default is 2.
  1233. @end table
  1234. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1235. the channel layout of the output will be set accordingly and the channels
  1236. will be reordered as necessary. If the channel layouts of the inputs are not
  1237. disjoint, the output will have all the channels of the first input then all
  1238. the channels of the second input, in that order, and the channel layout of
  1239. the output will be the default value corresponding to the total number of
  1240. channels.
  1241. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1242. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1243. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1244. first input, b1 is the first channel of the second input).
  1245. On the other hand, if both input are in stereo, the output channels will be
  1246. in the default order: a1, a2, b1, b2, and the channel layout will be
  1247. arbitrarily set to 4.0, which may or may not be the expected value.
  1248. All inputs must have the same sample rate, and format.
  1249. If inputs do not have the same duration, the output will stop with the
  1250. shortest.
  1251. @subsection Examples
  1252. @itemize
  1253. @item
  1254. Merge two mono files into a stereo stream:
  1255. @example
  1256. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1257. @end example
  1258. @item
  1259. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1260. @example
  1261. 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
  1262. @end example
  1263. @end itemize
  1264. @section amix
  1265. Mixes multiple audio inputs into a single output.
  1266. Note that this filter only supports float samples (the @var{amerge}
  1267. and @var{pan} audio filters support many formats). If the @var{amix}
  1268. input has integer samples then @ref{aresample} will be automatically
  1269. inserted to perform the conversion to float samples.
  1270. For example
  1271. @example
  1272. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1273. @end example
  1274. will mix 3 input audio streams to a single output with the same duration as the
  1275. first input and a dropout transition time of 3 seconds.
  1276. It accepts the following parameters:
  1277. @table @option
  1278. @item inputs
  1279. The number of inputs. If unspecified, it defaults to 2.
  1280. @item duration
  1281. How to determine the end-of-stream.
  1282. @table @option
  1283. @item longest
  1284. The duration of the longest input. (default)
  1285. @item shortest
  1286. The duration of the shortest input.
  1287. @item first
  1288. The duration of the first input.
  1289. @end table
  1290. @item dropout_transition
  1291. The transition time, in seconds, for volume renormalization when an input
  1292. stream ends. The default value is 2 seconds.
  1293. @item weights
  1294. Specify weight of each input audio stream as sequence.
  1295. Each weight is separated by space. By default all inputs have same weight.
  1296. @end table
  1297. @section amultiply
  1298. Multiply first audio stream with second audio stream and store result
  1299. in output audio stream. Multiplication is done by multiplying each
  1300. sample from first stream with sample at same position from second stream.
  1301. With this element-wise multiplication one can create amplitude fades and
  1302. amplitude modulations.
  1303. @section anequalizer
  1304. High-order parametric multiband equalizer for each channel.
  1305. It accepts the following parameters:
  1306. @table @option
  1307. @item params
  1308. This option string is in format:
  1309. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1310. Each equalizer band is separated by '|'.
  1311. @table @option
  1312. @item chn
  1313. Set channel number to which equalization will be applied.
  1314. If input doesn't have that channel the entry is ignored.
  1315. @item f
  1316. Set central frequency for band.
  1317. If input doesn't have that frequency the entry is ignored.
  1318. @item w
  1319. Set band width in hertz.
  1320. @item g
  1321. Set band gain in dB.
  1322. @item t
  1323. Set filter type for band, optional, can be:
  1324. @table @samp
  1325. @item 0
  1326. Butterworth, this is default.
  1327. @item 1
  1328. Chebyshev type 1.
  1329. @item 2
  1330. Chebyshev type 2.
  1331. @end table
  1332. @end table
  1333. @item curves
  1334. With this option activated frequency response of anequalizer is displayed
  1335. in video stream.
  1336. @item size
  1337. Set video stream size. Only useful if curves option is activated.
  1338. @item mgain
  1339. Set max gain that will be displayed. Only useful if curves option is activated.
  1340. Setting this to a reasonable value makes it possible to display gain which is derived from
  1341. neighbour bands which are too close to each other and thus produce higher gain
  1342. when both are activated.
  1343. @item fscale
  1344. Set frequency scale used to draw frequency response in video output.
  1345. Can be linear or logarithmic. Default is logarithmic.
  1346. @item colors
  1347. Set color for each channel curve which is going to be displayed in video stream.
  1348. This is list of color names separated by space or by '|'.
  1349. Unrecognised or missing colors will be replaced by white color.
  1350. @end table
  1351. @subsection Examples
  1352. @itemize
  1353. @item
  1354. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1355. for first 2 channels using Chebyshev type 1 filter:
  1356. @example
  1357. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1358. @end example
  1359. @end itemize
  1360. @subsection Commands
  1361. This filter supports the following commands:
  1362. @table @option
  1363. @item change
  1364. Alter existing filter parameters.
  1365. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1366. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1367. error is returned.
  1368. @var{freq} set new frequency parameter.
  1369. @var{width} set new width parameter in herz.
  1370. @var{gain} set new gain parameter in dB.
  1371. Full filter invocation with asendcmd may look like this:
  1372. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1373. @end table
  1374. @section anlmdn
  1375. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1376. Each sample is adjusted by looking for other samples with similar contexts. This
  1377. context similarity is defined by comparing their surrounding patches of size
  1378. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1379. The filter accepts the following options:
  1380. @table @option
  1381. @item s
  1382. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1383. @item p
  1384. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1385. Default value is 2 milliseconds.
  1386. @item r
  1387. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1388. Default value is 6 milliseconds.
  1389. @item o
  1390. Set the output mode.
  1391. It accepts the following values:
  1392. @table @option
  1393. @item i
  1394. Pass input unchanged.
  1395. @item o
  1396. Pass noise filtered out.
  1397. @item n
  1398. Pass only noise.
  1399. Default value is @var{o}.
  1400. @end table
  1401. @item m
  1402. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1403. @end table
  1404. @subsection Commands
  1405. This filter supports the following commands:
  1406. @table @option
  1407. @item s
  1408. Change denoise strength. Argument is single float number.
  1409. Syntax for the command is : "@var{s}"
  1410. @item o
  1411. Change output mode.
  1412. Syntax for the command is : "i", "o" or "n" string.
  1413. @end table
  1414. @section anlms
  1415. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1416. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1417. relate to producing the least mean square of the error signal (difference between the desired,
  1418. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1419. A description of the accepted options follows.
  1420. @table @option
  1421. @item order
  1422. Set filter order.
  1423. @item mu
  1424. Set filter mu.
  1425. @item eps
  1426. Set the filter eps.
  1427. @item leakage
  1428. Set the filter leakage.
  1429. @item out_mode
  1430. It accepts the following values:
  1431. @table @option
  1432. @item i
  1433. Pass the 1st input.
  1434. @item d
  1435. Pass the 2nd input.
  1436. @item o
  1437. Pass filtered samples.
  1438. @item n
  1439. Pass difference between desired and filtered samples.
  1440. Default value is @var{o}.
  1441. @end table
  1442. @end table
  1443. @subsection Examples
  1444. @itemize
  1445. @item
  1446. One of many usages of this filter is noise reduction, input audio is filtered
  1447. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1448. @example
  1449. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1450. @end example
  1451. @end itemize
  1452. @subsection Commands
  1453. This filter supports the same commands as options, excluding option @code{order}.
  1454. @section anull
  1455. Pass the audio source unchanged to the output.
  1456. @section apad
  1457. Pad the end of an audio stream with silence.
  1458. This can be used together with @command{ffmpeg} @option{-shortest} to
  1459. extend audio streams to the same length as the video stream.
  1460. A description of the accepted options follows.
  1461. @table @option
  1462. @item packet_size
  1463. Set silence packet size. Default value is 4096.
  1464. @item pad_len
  1465. Set the number of samples of silence to add to the end. After the
  1466. value is reached, the stream is terminated. This option is mutually
  1467. exclusive with @option{whole_len}.
  1468. @item whole_len
  1469. Set the minimum total number of samples in the output audio stream. If
  1470. the value is longer than the input audio length, silence is added to
  1471. the end, until the value is reached. This option is mutually exclusive
  1472. with @option{pad_len}.
  1473. @item pad_dur
  1474. Specify the duration of samples of silence to add. See
  1475. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1476. for the accepted syntax. Used only if set to non-zero value.
  1477. @item whole_dur
  1478. Specify the minimum total duration in the output audio stream. See
  1479. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1480. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1481. the input audio length, silence is added to the end, until the value is reached.
  1482. This option is mutually exclusive with @option{pad_dur}
  1483. @end table
  1484. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1485. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1486. the input stream indefinitely.
  1487. @subsection Examples
  1488. @itemize
  1489. @item
  1490. Add 1024 samples of silence to the end of the input:
  1491. @example
  1492. apad=pad_len=1024
  1493. @end example
  1494. @item
  1495. Make sure the audio output will contain at least 10000 samples, pad
  1496. the input with silence if required:
  1497. @example
  1498. apad=whole_len=10000
  1499. @end example
  1500. @item
  1501. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1502. video stream will always result the shortest and will be converted
  1503. until the end in the output file when using the @option{shortest}
  1504. option:
  1505. @example
  1506. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1507. @end example
  1508. @end itemize
  1509. @section aphaser
  1510. Add a phasing effect to the input audio.
  1511. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1512. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1513. A description of the accepted parameters follows.
  1514. @table @option
  1515. @item in_gain
  1516. Set input gain. Default is 0.4.
  1517. @item out_gain
  1518. Set output gain. Default is 0.74
  1519. @item delay
  1520. Set delay in milliseconds. Default is 3.0.
  1521. @item decay
  1522. Set decay. Default is 0.4.
  1523. @item speed
  1524. Set modulation speed in Hz. Default is 0.5.
  1525. @item type
  1526. Set modulation type. Default is triangular.
  1527. It accepts the following values:
  1528. @table @samp
  1529. @item triangular, t
  1530. @item sinusoidal, s
  1531. @end table
  1532. @end table
  1533. @section apulsator
  1534. Audio pulsator is something between an autopanner and a tremolo.
  1535. But it can produce funny stereo effects as well. Pulsator changes the volume
  1536. of the left and right channel based on a LFO (low frequency oscillator) with
  1537. different waveforms and shifted phases.
  1538. This filter have the ability to define an offset between left and right
  1539. channel. An offset of 0 means that both LFO shapes match each other.
  1540. The left and right channel are altered equally - a conventional tremolo.
  1541. An offset of 50% means that the shape of the right channel is exactly shifted
  1542. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1543. an autopanner. At 1 both curves match again. Every setting in between moves the
  1544. phase shift gapless between all stages and produces some "bypassing" sounds with
  1545. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1546. the 0.5) the faster the signal passes from the left to the right speaker.
  1547. The filter accepts the following options:
  1548. @table @option
  1549. @item level_in
  1550. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1551. @item level_out
  1552. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1553. @item mode
  1554. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1555. sawup or sawdown. Default is sine.
  1556. @item amount
  1557. Set modulation. Define how much of original signal is affected by the LFO.
  1558. @item offset_l
  1559. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1560. @item offset_r
  1561. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1562. @item width
  1563. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1564. @item timing
  1565. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1566. @item bpm
  1567. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1568. is set to bpm.
  1569. @item ms
  1570. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1571. is set to ms.
  1572. @item hz
  1573. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1574. if timing is set to hz.
  1575. @end table
  1576. @anchor{aresample}
  1577. @section aresample
  1578. Resample the input audio to the specified parameters, using the
  1579. libswresample library. If none are specified then the filter will
  1580. automatically convert between its input and output.
  1581. This filter is also able to stretch/squeeze the audio data to make it match
  1582. the timestamps or to inject silence / cut out audio to make it match the
  1583. timestamps, do a combination of both or do neither.
  1584. The filter accepts the syntax
  1585. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1586. expresses a sample rate and @var{resampler_options} is a list of
  1587. @var{key}=@var{value} pairs, separated by ":". See the
  1588. @ref{Resampler Options,,"Resampler Options" section in the
  1589. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1590. for the complete list of supported options.
  1591. @subsection Examples
  1592. @itemize
  1593. @item
  1594. Resample the input audio to 44100Hz:
  1595. @example
  1596. aresample=44100
  1597. @end example
  1598. @item
  1599. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1600. samples per second compensation:
  1601. @example
  1602. aresample=async=1000
  1603. @end example
  1604. @end itemize
  1605. @section areverse
  1606. Reverse an audio clip.
  1607. Warning: This filter requires memory to buffer the entire clip, so trimming
  1608. is suggested.
  1609. @subsection Examples
  1610. @itemize
  1611. @item
  1612. Take the first 5 seconds of a clip, and reverse it.
  1613. @example
  1614. atrim=end=5,areverse
  1615. @end example
  1616. @end itemize
  1617. @section arnndn
  1618. Reduce noise from speech using Recurrent Neural Networks.
  1619. This filter accepts the following options:
  1620. @table @option
  1621. @item model, m
  1622. Set train model file to load. This option is always required.
  1623. @end table
  1624. @section asetnsamples
  1625. Set the number of samples per each output audio frame.
  1626. The last output packet may contain a different number of samples, as
  1627. the filter will flush all the remaining samples when the input audio
  1628. signals its end.
  1629. The filter accepts the following options:
  1630. @table @option
  1631. @item nb_out_samples, n
  1632. Set the number of frames per each output audio frame. The number is
  1633. intended as the number of samples @emph{per each channel}.
  1634. Default value is 1024.
  1635. @item pad, p
  1636. If set to 1, the filter will pad the last audio frame with zeroes, so
  1637. that the last frame will contain the same number of samples as the
  1638. previous ones. Default value is 1.
  1639. @end table
  1640. For example, to set the number of per-frame samples to 1234 and
  1641. disable padding for the last frame, use:
  1642. @example
  1643. asetnsamples=n=1234:p=0
  1644. @end example
  1645. @section asetrate
  1646. Set the sample rate without altering the PCM data.
  1647. This will result in a change of speed and pitch.
  1648. The filter accepts the following options:
  1649. @table @option
  1650. @item sample_rate, r
  1651. Set the output sample rate. Default is 44100 Hz.
  1652. @end table
  1653. @section ashowinfo
  1654. Show a line containing various information for each input audio frame.
  1655. The input audio is not modified.
  1656. The shown line contains a sequence of key/value pairs of the form
  1657. @var{key}:@var{value}.
  1658. The following values are shown in the output:
  1659. @table @option
  1660. @item n
  1661. The (sequential) number of the input frame, starting from 0.
  1662. @item pts
  1663. The presentation timestamp of the input frame, in time base units; the time base
  1664. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1665. @item pts_time
  1666. The presentation timestamp of the input frame in seconds.
  1667. @item pos
  1668. position of the frame in the input stream, -1 if this information in
  1669. unavailable and/or meaningless (for example in case of synthetic audio)
  1670. @item fmt
  1671. The sample format.
  1672. @item chlayout
  1673. The channel layout.
  1674. @item rate
  1675. The sample rate for the audio frame.
  1676. @item nb_samples
  1677. The number of samples (per channel) in the frame.
  1678. @item checksum
  1679. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1680. audio, the data is treated as if all the planes were concatenated.
  1681. @item plane_checksums
  1682. A list of Adler-32 checksums for each data plane.
  1683. @end table
  1684. @section asoftclip
  1685. Apply audio soft clipping.
  1686. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1687. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1688. This filter accepts the following options:
  1689. @table @option
  1690. @item type
  1691. Set type of soft-clipping.
  1692. It accepts the following values:
  1693. @table @option
  1694. @item tanh
  1695. @item atan
  1696. @item cubic
  1697. @item exp
  1698. @item alg
  1699. @item quintic
  1700. @item sin
  1701. @end table
  1702. @item param
  1703. Set additional parameter which controls sigmoid function.
  1704. @end table
  1705. @section asr
  1706. Automatic Speech Recognition
  1707. This filter uses PocketSphinx for speech recognition. To enable
  1708. compilation of this filter, you need to configure FFmpeg with
  1709. @code{--enable-pocketsphinx}.
  1710. It accepts the following options:
  1711. @table @option
  1712. @item rate
  1713. Set sampling rate of input audio. Defaults is @code{16000}.
  1714. This need to match speech models, otherwise one will get poor results.
  1715. @item hmm
  1716. Set dictionary containing acoustic model files.
  1717. @item dict
  1718. Set pronunciation dictionary.
  1719. @item lm
  1720. Set language model file.
  1721. @item lmctl
  1722. Set language model set.
  1723. @item lmname
  1724. Set which language model to use.
  1725. @item logfn
  1726. Set output for log messages.
  1727. @end table
  1728. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1729. @anchor{astats}
  1730. @section astats
  1731. Display time domain statistical information about the audio channels.
  1732. Statistics are calculated and displayed for each audio channel and,
  1733. where applicable, an overall figure is also given.
  1734. It accepts the following option:
  1735. @table @option
  1736. @item length
  1737. Short window length in seconds, used for peak and trough RMS measurement.
  1738. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1739. @item metadata
  1740. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1741. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1742. disabled.
  1743. Available keys for each channel are:
  1744. DC_offset
  1745. Min_level
  1746. Max_level
  1747. Min_difference
  1748. Max_difference
  1749. Mean_difference
  1750. RMS_difference
  1751. Peak_level
  1752. RMS_peak
  1753. RMS_trough
  1754. Crest_factor
  1755. Flat_factor
  1756. Peak_count
  1757. Bit_depth
  1758. Dynamic_range
  1759. Zero_crossings
  1760. Zero_crossings_rate
  1761. Number_of_NaNs
  1762. Number_of_Infs
  1763. Number_of_denormals
  1764. and for Overall:
  1765. DC_offset
  1766. Min_level
  1767. Max_level
  1768. Min_difference
  1769. Max_difference
  1770. Mean_difference
  1771. RMS_difference
  1772. Peak_level
  1773. RMS_level
  1774. RMS_peak
  1775. RMS_trough
  1776. Flat_factor
  1777. Peak_count
  1778. Bit_depth
  1779. Number_of_samples
  1780. Number_of_NaNs
  1781. Number_of_Infs
  1782. Number_of_denormals
  1783. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1784. this @code{lavfi.astats.Overall.Peak_count}.
  1785. For description what each key means read below.
  1786. @item reset
  1787. Set number of frame after which stats are going to be recalculated.
  1788. Default is disabled.
  1789. @item measure_perchannel
  1790. Select the entries which need to be measured per channel. The metadata keys can
  1791. be used as flags, default is @option{all} which measures everything.
  1792. @option{none} disables all per channel measurement.
  1793. @item measure_overall
  1794. Select the entries which need to be measured overall. The metadata keys can
  1795. be used as flags, default is @option{all} which measures everything.
  1796. @option{none} disables all overall measurement.
  1797. @end table
  1798. A description of each shown parameter follows:
  1799. @table @option
  1800. @item DC offset
  1801. Mean amplitude displacement from zero.
  1802. @item Min level
  1803. Minimal sample level.
  1804. @item Max level
  1805. Maximal sample level.
  1806. @item Min difference
  1807. Minimal difference between two consecutive samples.
  1808. @item Max difference
  1809. Maximal difference between two consecutive samples.
  1810. @item Mean difference
  1811. Mean difference between two consecutive samples.
  1812. The average of each difference between two consecutive samples.
  1813. @item RMS difference
  1814. Root Mean Square difference between two consecutive samples.
  1815. @item Peak level dB
  1816. @item RMS level dB
  1817. Standard peak and RMS level measured in dBFS.
  1818. @item RMS peak dB
  1819. @item RMS trough dB
  1820. Peak and trough values for RMS level measured over a short window.
  1821. @item Crest factor
  1822. Standard ratio of peak to RMS level (note: not in dB).
  1823. @item Flat factor
  1824. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1825. (i.e. either @var{Min level} or @var{Max level}).
  1826. @item Peak count
  1827. Number of occasions (not the number of samples) that the signal attained either
  1828. @var{Min level} or @var{Max level}.
  1829. @item Bit depth
  1830. Overall bit depth of audio. Number of bits used for each sample.
  1831. @item Dynamic range
  1832. Measured dynamic range of audio in dB.
  1833. @item Zero crossings
  1834. Number of points where the waveform crosses the zero level axis.
  1835. @item Zero crossings rate
  1836. Rate of Zero crossings and number of audio samples.
  1837. @end table
  1838. @section atempo
  1839. Adjust audio tempo.
  1840. The filter accepts exactly one parameter, the audio tempo. If not
  1841. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1842. be in the [0.5, 100.0] range.
  1843. Note that tempo greater than 2 will skip some samples rather than
  1844. blend them in. If for any reason this is a concern it is always
  1845. possible to daisy-chain several instances of atempo to achieve the
  1846. desired product tempo.
  1847. @subsection Examples
  1848. @itemize
  1849. @item
  1850. Slow down audio to 80% tempo:
  1851. @example
  1852. atempo=0.8
  1853. @end example
  1854. @item
  1855. To speed up audio to 300% tempo:
  1856. @example
  1857. atempo=3
  1858. @end example
  1859. @item
  1860. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1861. @example
  1862. atempo=sqrt(3),atempo=sqrt(3)
  1863. @end example
  1864. @end itemize
  1865. @subsection Commands
  1866. This filter supports the following commands:
  1867. @table @option
  1868. @item tempo
  1869. Change filter tempo scale factor.
  1870. Syntax for the command is : "@var{tempo}"
  1871. @end table
  1872. @section atrim
  1873. Trim the input so that the output contains one continuous subpart of the input.
  1874. It accepts the following parameters:
  1875. @table @option
  1876. @item start
  1877. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1878. sample with the timestamp @var{start} will be the first sample in the output.
  1879. @item end
  1880. Specify time of the first audio sample that will be dropped, i.e. the
  1881. audio sample immediately preceding the one with the timestamp @var{end} will be
  1882. the last sample in the output.
  1883. @item start_pts
  1884. Same as @var{start}, except this option sets the start timestamp in samples
  1885. instead of seconds.
  1886. @item end_pts
  1887. Same as @var{end}, except this option sets the end timestamp in samples instead
  1888. of seconds.
  1889. @item duration
  1890. The maximum duration of the output in seconds.
  1891. @item start_sample
  1892. The number of the first sample that should be output.
  1893. @item end_sample
  1894. The number of the first sample that should be dropped.
  1895. @end table
  1896. @option{start}, @option{end}, and @option{duration} are expressed as time
  1897. duration specifications; see
  1898. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1899. Note that the first two sets of the start/end options and the @option{duration}
  1900. option look at the frame timestamp, while the _sample options simply count the
  1901. samples that pass through the filter. So start/end_pts and start/end_sample will
  1902. give different results when the timestamps are wrong, inexact or do not start at
  1903. zero. Also note that this filter does not modify the timestamps. If you wish
  1904. to have the output timestamps start at zero, insert the asetpts filter after the
  1905. atrim filter.
  1906. If multiple start or end options are set, this filter tries to be greedy and
  1907. keep all samples that match at least one of the specified constraints. To keep
  1908. only the part that matches all the constraints at once, chain multiple atrim
  1909. filters.
  1910. The defaults are such that all the input is kept. So it is possible to set e.g.
  1911. just the end values to keep everything before the specified time.
  1912. Examples:
  1913. @itemize
  1914. @item
  1915. Drop everything except the second minute of input:
  1916. @example
  1917. ffmpeg -i INPUT -af atrim=60:120
  1918. @end example
  1919. @item
  1920. Keep only the first 1000 samples:
  1921. @example
  1922. ffmpeg -i INPUT -af atrim=end_sample=1000
  1923. @end example
  1924. @end itemize
  1925. @section bandpass
  1926. Apply a two-pole Butterworth band-pass filter with central
  1927. frequency @var{frequency}, and (3dB-point) band-width width.
  1928. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1929. instead of the default: constant 0dB peak gain.
  1930. The filter roll off at 6dB per octave (20dB per decade).
  1931. The filter accepts the following options:
  1932. @table @option
  1933. @item frequency, f
  1934. Set the filter's central frequency. Default is @code{3000}.
  1935. @item csg
  1936. Constant skirt gain if set to 1. Defaults to 0.
  1937. @item width_type, t
  1938. Set method to specify band-width of filter.
  1939. @table @option
  1940. @item h
  1941. Hz
  1942. @item q
  1943. Q-Factor
  1944. @item o
  1945. octave
  1946. @item s
  1947. slope
  1948. @item k
  1949. kHz
  1950. @end table
  1951. @item width, w
  1952. Specify the band-width of a filter in width_type units.
  1953. @item mix, m
  1954. How much to use filtered signal in output. Default is 1.
  1955. Range is between 0 and 1.
  1956. @item channels, c
  1957. Specify which channels to filter, by default all available are filtered.
  1958. @end table
  1959. @subsection Commands
  1960. This filter supports the following commands:
  1961. @table @option
  1962. @item frequency, f
  1963. Change bandpass frequency.
  1964. Syntax for the command is : "@var{frequency}"
  1965. @item width_type, t
  1966. Change bandpass width_type.
  1967. Syntax for the command is : "@var{width_type}"
  1968. @item width, w
  1969. Change bandpass width.
  1970. Syntax for the command is : "@var{width}"
  1971. @item mix, m
  1972. Change bandpass mix.
  1973. Syntax for the command is : "@var{mix}"
  1974. @end table
  1975. @section bandreject
  1976. Apply a two-pole Butterworth band-reject filter with central
  1977. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1978. The filter roll off at 6dB per octave (20dB per decade).
  1979. The filter accepts the following options:
  1980. @table @option
  1981. @item frequency, f
  1982. Set the filter's central frequency. Default is @code{3000}.
  1983. @item width_type, t
  1984. Set method to specify band-width of filter.
  1985. @table @option
  1986. @item h
  1987. Hz
  1988. @item q
  1989. Q-Factor
  1990. @item o
  1991. octave
  1992. @item s
  1993. slope
  1994. @item k
  1995. kHz
  1996. @end table
  1997. @item width, w
  1998. Specify the band-width of a filter in width_type units.
  1999. @item mix, m
  2000. How much to use filtered signal in output. Default is 1.
  2001. Range is between 0 and 1.
  2002. @item channels, c
  2003. Specify which channels to filter, by default all available are filtered.
  2004. @end table
  2005. @subsection Commands
  2006. This filter supports the following commands:
  2007. @table @option
  2008. @item frequency, f
  2009. Change bandreject frequency.
  2010. Syntax for the command is : "@var{frequency}"
  2011. @item width_type, t
  2012. Change bandreject width_type.
  2013. Syntax for the command is : "@var{width_type}"
  2014. @item width, w
  2015. Change bandreject width.
  2016. Syntax for the command is : "@var{width}"
  2017. @item mix, m
  2018. Change bandreject mix.
  2019. Syntax for the command is : "@var{mix}"
  2020. @end table
  2021. @section bass, lowshelf
  2022. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2023. shelving filter with a response similar to that of a standard
  2024. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2025. The filter accepts the following options:
  2026. @table @option
  2027. @item gain, g
  2028. Give the gain at 0 Hz. Its useful range is about -20
  2029. (for a large cut) to +20 (for a large boost).
  2030. Beware of clipping when using a positive gain.
  2031. @item frequency, f
  2032. Set the filter's central frequency and so can be used
  2033. to extend or reduce the frequency range to be boosted or cut.
  2034. The default value is @code{100} Hz.
  2035. @item width_type, t
  2036. Set method to specify band-width of filter.
  2037. @table @option
  2038. @item h
  2039. Hz
  2040. @item q
  2041. Q-Factor
  2042. @item o
  2043. octave
  2044. @item s
  2045. slope
  2046. @item k
  2047. kHz
  2048. @end table
  2049. @item width, w
  2050. Determine how steep is the filter's shelf transition.
  2051. @item mix, m
  2052. How much to use filtered signal in output. Default is 1.
  2053. Range is between 0 and 1.
  2054. @item channels, c
  2055. Specify which channels to filter, by default all available are filtered.
  2056. @end table
  2057. @subsection Commands
  2058. This filter supports the following commands:
  2059. @table @option
  2060. @item frequency, f
  2061. Change bass frequency.
  2062. Syntax for the command is : "@var{frequency}"
  2063. @item width_type, t
  2064. Change bass width_type.
  2065. Syntax for the command is : "@var{width_type}"
  2066. @item width, w
  2067. Change bass width.
  2068. Syntax for the command is : "@var{width}"
  2069. @item gain, g
  2070. Change bass gain.
  2071. Syntax for the command is : "@var{gain}"
  2072. @item mix, m
  2073. Change bass mix.
  2074. Syntax for the command is : "@var{mix}"
  2075. @end table
  2076. @section biquad
  2077. Apply a biquad IIR filter with the given coefficients.
  2078. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2079. are the numerator and denominator coefficients respectively.
  2080. and @var{channels}, @var{c} specify which channels to filter, by default all
  2081. available are filtered.
  2082. @subsection Commands
  2083. This filter supports the following commands:
  2084. @table @option
  2085. @item a0
  2086. @item a1
  2087. @item a2
  2088. @item b0
  2089. @item b1
  2090. @item b2
  2091. Change biquad parameter.
  2092. Syntax for the command is : "@var{value}"
  2093. @item mix, m
  2094. How much to use filtered signal in output. Default is 1.
  2095. Range is between 0 and 1.
  2096. @end table
  2097. @section bs2b
  2098. Bauer stereo to binaural transformation, which improves headphone listening of
  2099. stereo audio records.
  2100. To enable compilation of this filter you need to configure FFmpeg with
  2101. @code{--enable-libbs2b}.
  2102. It accepts the following parameters:
  2103. @table @option
  2104. @item profile
  2105. Pre-defined crossfeed level.
  2106. @table @option
  2107. @item default
  2108. Default level (fcut=700, feed=50).
  2109. @item cmoy
  2110. Chu Moy circuit (fcut=700, feed=60).
  2111. @item jmeier
  2112. Jan Meier circuit (fcut=650, feed=95).
  2113. @end table
  2114. @item fcut
  2115. Cut frequency (in Hz).
  2116. @item feed
  2117. Feed level (in Hz).
  2118. @end table
  2119. @section channelmap
  2120. Remap input channels to new locations.
  2121. It accepts the following parameters:
  2122. @table @option
  2123. @item map
  2124. Map channels from input to output. The argument is a '|'-separated list of
  2125. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2126. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2127. channel (e.g. FL for front left) or its index in the input channel layout.
  2128. @var{out_channel} is the name of the output channel or its index in the output
  2129. channel layout. If @var{out_channel} is not given then it is implicitly an
  2130. index, starting with zero and increasing by one for each mapping.
  2131. @item channel_layout
  2132. The channel layout of the output stream.
  2133. @end table
  2134. If no mapping is present, the filter will implicitly map input channels to
  2135. output channels, preserving indices.
  2136. @subsection Examples
  2137. @itemize
  2138. @item
  2139. For example, assuming a 5.1+downmix input MOV file,
  2140. @example
  2141. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2142. @end example
  2143. will create an output WAV file tagged as stereo from the downmix channels of
  2144. the input.
  2145. @item
  2146. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2147. @example
  2148. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2149. @end example
  2150. @end itemize
  2151. @section channelsplit
  2152. Split each channel from an input audio stream into a separate output stream.
  2153. It accepts the following parameters:
  2154. @table @option
  2155. @item channel_layout
  2156. The channel layout of the input stream. The default is "stereo".
  2157. @item channels
  2158. A channel layout describing the channels to be extracted as separate output streams
  2159. or "all" to extract each input channel as a separate stream. The default is "all".
  2160. Choosing channels not present in channel layout in the input will result in an error.
  2161. @end table
  2162. @subsection Examples
  2163. @itemize
  2164. @item
  2165. For example, assuming a stereo input MP3 file,
  2166. @example
  2167. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2168. @end example
  2169. will create an output Matroska file with two audio streams, one containing only
  2170. the left channel and the other the right channel.
  2171. @item
  2172. Split a 5.1 WAV file into per-channel files:
  2173. @example
  2174. ffmpeg -i in.wav -filter_complex
  2175. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2176. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2177. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2178. side_right.wav
  2179. @end example
  2180. @item
  2181. Extract only LFE from a 5.1 WAV file:
  2182. @example
  2183. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2184. -map '[LFE]' lfe.wav
  2185. @end example
  2186. @end itemize
  2187. @section chorus
  2188. Add a chorus effect to the audio.
  2189. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2190. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2191. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2192. The modulation depth defines the range the modulated delay is played before or after
  2193. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2194. sound tuned around the original one, like in a chorus where some vocals are slightly
  2195. off key.
  2196. It accepts the following parameters:
  2197. @table @option
  2198. @item in_gain
  2199. Set input gain. Default is 0.4.
  2200. @item out_gain
  2201. Set output gain. Default is 0.4.
  2202. @item delays
  2203. Set delays. A typical delay is around 40ms to 60ms.
  2204. @item decays
  2205. Set decays.
  2206. @item speeds
  2207. Set speeds.
  2208. @item depths
  2209. Set depths.
  2210. @end table
  2211. @subsection Examples
  2212. @itemize
  2213. @item
  2214. A single delay:
  2215. @example
  2216. chorus=0.7:0.9:55:0.4:0.25:2
  2217. @end example
  2218. @item
  2219. Two delays:
  2220. @example
  2221. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2222. @end example
  2223. @item
  2224. Fuller sounding chorus with three delays:
  2225. @example
  2226. 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
  2227. @end example
  2228. @end itemize
  2229. @section compand
  2230. Compress or expand the audio's dynamic range.
  2231. It accepts the following parameters:
  2232. @table @option
  2233. @item attacks
  2234. @item decays
  2235. A list of times in seconds for each channel over which the instantaneous level
  2236. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2237. increase of volume and @var{decays} refers to decrease of volume. For most
  2238. situations, the attack time (response to the audio getting louder) should be
  2239. shorter than the decay time, because the human ear is more sensitive to sudden
  2240. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2241. a typical value for decay is 0.8 seconds.
  2242. If specified number of attacks & decays is lower than number of channels, the last
  2243. set attack/decay will be used for all remaining channels.
  2244. @item points
  2245. A list of points for the transfer function, specified in dB relative to the
  2246. maximum possible signal amplitude. Each key points list must be defined using
  2247. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2248. @code{x0/y0 x1/y1 x2/y2 ....}
  2249. The input values must be in strictly increasing order but the transfer function
  2250. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2251. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2252. function are @code{-70/-70|-60/-20|1/0}.
  2253. @item soft-knee
  2254. Set the curve radius in dB for all joints. It defaults to 0.01.
  2255. @item gain
  2256. Set the additional gain in dB to be applied at all points on the transfer
  2257. function. This allows for easy adjustment of the overall gain.
  2258. It defaults to 0.
  2259. @item volume
  2260. Set an initial volume, in dB, to be assumed for each channel when filtering
  2261. starts. This permits the user to supply a nominal level initially, so that, for
  2262. example, a very large gain is not applied to initial signal levels before the
  2263. companding has begun to operate. A typical value for audio which is initially
  2264. quiet is -90 dB. It defaults to 0.
  2265. @item delay
  2266. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2267. delayed before being fed to the volume adjuster. Specifying a delay
  2268. approximately equal to the attack/decay times allows the filter to effectively
  2269. operate in predictive rather than reactive mode. It defaults to 0.
  2270. @end table
  2271. @subsection Examples
  2272. @itemize
  2273. @item
  2274. Make music with both quiet and loud passages suitable for listening to in a
  2275. noisy environment:
  2276. @example
  2277. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2278. @end example
  2279. Another example for audio with whisper and explosion parts:
  2280. @example
  2281. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2282. @end example
  2283. @item
  2284. A noise gate for when the noise is at a lower level than the signal:
  2285. @example
  2286. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2287. @end example
  2288. @item
  2289. Here is another noise gate, this time for when the noise is at a higher level
  2290. than the signal (making it, in some ways, similar to squelch):
  2291. @example
  2292. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2293. @end example
  2294. @item
  2295. 2:1 compression starting at -6dB:
  2296. @example
  2297. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2298. @end example
  2299. @item
  2300. 2:1 compression starting at -9dB:
  2301. @example
  2302. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2303. @end example
  2304. @item
  2305. 2:1 compression starting at -12dB:
  2306. @example
  2307. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2308. @end example
  2309. @item
  2310. 2:1 compression starting at -18dB:
  2311. @example
  2312. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2313. @end example
  2314. @item
  2315. 3:1 compression starting at -15dB:
  2316. @example
  2317. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2318. @end example
  2319. @item
  2320. Compressor/Gate:
  2321. @example
  2322. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2323. @end example
  2324. @item
  2325. Expander:
  2326. @example
  2327. 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
  2328. @end example
  2329. @item
  2330. Hard limiter at -6dB:
  2331. @example
  2332. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2333. @end example
  2334. @item
  2335. Hard limiter at -12dB:
  2336. @example
  2337. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2338. @end example
  2339. @item
  2340. Hard noise gate at -35 dB:
  2341. @example
  2342. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2343. @end example
  2344. @item
  2345. Soft limiter:
  2346. @example
  2347. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2348. @end example
  2349. @end itemize
  2350. @section compensationdelay
  2351. Compensation Delay Line is a metric based delay to compensate differing
  2352. positions of microphones or speakers.
  2353. For example, you have recorded guitar with two microphones placed in
  2354. different locations. Because the front of sound wave has fixed speed in
  2355. normal conditions, the phasing of microphones can vary and depends on
  2356. their location and interposition. The best sound mix can be achieved when
  2357. these microphones are in phase (synchronized). Note that a distance of
  2358. ~30 cm between microphones makes one microphone capture the signal in
  2359. antiphase to the other microphone. That makes the final mix sound moody.
  2360. This filter helps to solve phasing problems by adding different delays
  2361. to each microphone track and make them synchronized.
  2362. The best result can be reached when you take one track as base and
  2363. synchronize other tracks one by one with it.
  2364. Remember that synchronization/delay tolerance depends on sample rate, too.
  2365. Higher sample rates will give more tolerance.
  2366. The filter accepts the following parameters:
  2367. @table @option
  2368. @item mm
  2369. Set millimeters distance. This is compensation distance for fine tuning.
  2370. Default is 0.
  2371. @item cm
  2372. Set cm distance. This is compensation distance for tightening distance setup.
  2373. Default is 0.
  2374. @item m
  2375. Set meters distance. This is compensation distance for hard distance setup.
  2376. Default is 0.
  2377. @item dry
  2378. Set dry amount. Amount of unprocessed (dry) signal.
  2379. Default is 0.
  2380. @item wet
  2381. Set wet amount. Amount of processed (wet) signal.
  2382. Default is 1.
  2383. @item temp
  2384. Set temperature in degrees Celsius. This is the temperature of the environment.
  2385. Default is 20.
  2386. @end table
  2387. @section crossfeed
  2388. Apply headphone crossfeed filter.
  2389. Crossfeed is the process of blending the left and right channels of stereo
  2390. audio recording.
  2391. It is mainly used to reduce extreme stereo separation of low frequencies.
  2392. The intent is to produce more speaker like sound to the listener.
  2393. The filter accepts the following options:
  2394. @table @option
  2395. @item strength
  2396. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2397. This sets gain of low shelf filter for side part of stereo image.
  2398. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2399. @item range
  2400. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2401. This sets cut off frequency of low shelf filter. Default is cut off near
  2402. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2403. @item level_in
  2404. Set input gain. Default is 0.9.
  2405. @item level_out
  2406. Set output gain. Default is 1.
  2407. @end table
  2408. @section crystalizer
  2409. Simple algorithm to expand audio dynamic range.
  2410. The filter accepts the following options:
  2411. @table @option
  2412. @item i
  2413. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2414. (unchanged sound) to 10.0 (maximum effect).
  2415. @item c
  2416. Enable clipping. By default is enabled.
  2417. @end table
  2418. @section dcshift
  2419. Apply a DC shift to the audio.
  2420. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2421. in the recording chain) from the audio. The effect of a DC offset is reduced
  2422. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2423. a signal has a DC offset.
  2424. @table @option
  2425. @item shift
  2426. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2427. the audio.
  2428. @item limitergain
  2429. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2430. used to prevent clipping.
  2431. @end table
  2432. @section deesser
  2433. Apply de-essing to the audio samples.
  2434. @table @option
  2435. @item i
  2436. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2437. Default is 0.
  2438. @item m
  2439. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2440. Default is 0.5.
  2441. @item f
  2442. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2443. Default is 0.5.
  2444. @item s
  2445. Set the output mode.
  2446. It accepts the following values:
  2447. @table @option
  2448. @item i
  2449. Pass input unchanged.
  2450. @item o
  2451. Pass ess filtered out.
  2452. @item e
  2453. Pass only ess.
  2454. Default value is @var{o}.
  2455. @end table
  2456. @end table
  2457. @section drmeter
  2458. Measure audio dynamic range.
  2459. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2460. is found in transition material. And anything less that 8 have very poor dynamics
  2461. and is very compressed.
  2462. The filter accepts the following options:
  2463. @table @option
  2464. @item length
  2465. Set window length in seconds used to split audio into segments of equal length.
  2466. Default is 3 seconds.
  2467. @end table
  2468. @section dynaudnorm
  2469. Dynamic Audio Normalizer.
  2470. This filter applies a certain amount of gain to the input audio in order
  2471. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2472. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2473. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2474. This allows for applying extra gain to the "quiet" sections of the audio
  2475. while avoiding distortions or clipping the "loud" sections. In other words:
  2476. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2477. sections, in the sense that the volume of each section is brought to the
  2478. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2479. this goal *without* applying "dynamic range compressing". It will retain 100%
  2480. of the dynamic range *within* each section of the audio file.
  2481. @table @option
  2482. @item framelen, f
  2483. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2484. Default is 500 milliseconds.
  2485. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2486. referred to as frames. This is required, because a peak magnitude has no
  2487. meaning for just a single sample value. Instead, we need to determine the
  2488. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2489. normalizer would simply use the peak magnitude of the complete file, the
  2490. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2491. frame. The length of a frame is specified in milliseconds. By default, the
  2492. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2493. been found to give good results with most files.
  2494. Note that the exact frame length, in number of samples, will be determined
  2495. automatically, based on the sampling rate of the individual input audio file.
  2496. @item gausssize, g
  2497. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2498. number. Default is 31.
  2499. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2500. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2501. is specified in frames, centered around the current frame. For the sake of
  2502. simplicity, this must be an odd number. Consequently, the default value of 31
  2503. takes into account the current frame, as well as the 15 preceding frames and
  2504. the 15 subsequent frames. Using a larger window results in a stronger
  2505. smoothing effect and thus in less gain variation, i.e. slower gain
  2506. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2507. effect and thus in more gain variation, i.e. faster gain adaptation.
  2508. In other words, the more you increase this value, the more the Dynamic Audio
  2509. Normalizer will behave like a "traditional" normalization filter. On the
  2510. contrary, the more you decrease this value, the more the Dynamic Audio
  2511. Normalizer will behave like a dynamic range compressor.
  2512. @item peak, p
  2513. Set the target peak value. This specifies the highest permissible magnitude
  2514. level for the normalized audio input. This filter will try to approach the
  2515. target peak magnitude as closely as possible, but at the same time it also
  2516. makes sure that the normalized signal will never exceed the peak magnitude.
  2517. A frame's maximum local gain factor is imposed directly by the target peak
  2518. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2519. It is not recommended to go above this value.
  2520. @item maxgain, m
  2521. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2522. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2523. factor for each input frame, i.e. the maximum gain factor that does not
  2524. result in clipping or distortion. The maximum gain factor is determined by
  2525. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2526. additionally bounds the frame's maximum gain factor by a predetermined
  2527. (global) maximum gain factor. This is done in order to avoid excessive gain
  2528. factors in "silent" or almost silent frames. By default, the maximum gain
  2529. factor is 10.0, For most inputs the default value should be sufficient and
  2530. it usually is not recommended to increase this value. Though, for input
  2531. with an extremely low overall volume level, it may be necessary to allow even
  2532. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2533. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2534. Instead, a "sigmoid" threshold function will be applied. This way, the
  2535. gain factors will smoothly approach the threshold value, but never exceed that
  2536. value.
  2537. @item targetrms, r
  2538. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2539. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2540. This means that the maximum local gain factor for each frame is defined
  2541. (only) by the frame's highest magnitude sample. This way, the samples can
  2542. be amplified as much as possible without exceeding the maximum signal
  2543. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2544. Normalizer can also take into account the frame's root mean square,
  2545. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2546. determine the power of a time-varying signal. It is therefore considered
  2547. that the RMS is a better approximation of the "perceived loudness" than
  2548. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2549. frames to a constant RMS value, a uniform "perceived loudness" can be
  2550. established. If a target RMS value has been specified, a frame's local gain
  2551. factor is defined as the factor that would result in exactly that RMS value.
  2552. Note, however, that the maximum local gain factor is still restricted by the
  2553. frame's highest magnitude sample, in order to prevent clipping.
  2554. @item coupling, n
  2555. Enable channels coupling. By default is enabled.
  2556. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2557. amount. This means the same gain factor will be applied to all channels, i.e.
  2558. the maximum possible gain factor is determined by the "loudest" channel.
  2559. However, in some recordings, it may happen that the volume of the different
  2560. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2561. In this case, this option can be used to disable the channel coupling. This way,
  2562. the gain factor will be determined independently for each channel, depending
  2563. only on the individual channel's highest magnitude sample. This allows for
  2564. harmonizing the volume of the different channels.
  2565. @item correctdc, c
  2566. Enable DC bias correction. By default is disabled.
  2567. An audio signal (in the time domain) is a sequence of sample values.
  2568. In the Dynamic Audio Normalizer these sample values are represented in the
  2569. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2570. audio signal, or "waveform", should be centered around the zero point.
  2571. That means if we calculate the mean value of all samples in a file, or in a
  2572. single frame, then the result should be 0.0 or at least very close to that
  2573. value. If, however, there is a significant deviation of the mean value from
  2574. 0.0, in either positive or negative direction, this is referred to as a
  2575. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2576. Audio Normalizer provides optional DC bias correction.
  2577. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2578. the mean value, or "DC correction" offset, of each input frame and subtract
  2579. that value from all of the frame's sample values which ensures those samples
  2580. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2581. boundaries, the DC correction offset values will be interpolated smoothly
  2582. between neighbouring frames.
  2583. @item altboundary, b
  2584. Enable alternative boundary mode. By default is disabled.
  2585. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2586. around each frame. This includes the preceding frames as well as the
  2587. subsequent frames. However, for the "boundary" frames, located at the very
  2588. beginning and at the very end of the audio file, not all neighbouring
  2589. frames are available. In particular, for the first few frames in the audio
  2590. file, the preceding frames are not known. And, similarly, for the last few
  2591. frames in the audio file, the subsequent frames are not known. Thus, the
  2592. question arises which gain factors should be assumed for the missing frames
  2593. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2594. to deal with this situation. The default boundary mode assumes a gain factor
  2595. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2596. "fade out" at the beginning and at the end of the input, respectively.
  2597. @item compress, s
  2598. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2599. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2600. compression. This means that signal peaks will not be pruned and thus the
  2601. full dynamic range will be retained within each local neighbourhood. However,
  2602. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2603. normalization algorithm with a more "traditional" compression.
  2604. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2605. (thresholding) function. If (and only if) the compression feature is enabled,
  2606. all input frames will be processed by a soft knee thresholding function prior
  2607. to the actual normalization process. Put simply, the thresholding function is
  2608. going to prune all samples whose magnitude exceeds a certain threshold value.
  2609. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2610. value. Instead, the threshold value will be adjusted for each individual
  2611. frame.
  2612. In general, smaller parameters result in stronger compression, and vice versa.
  2613. Values below 3.0 are not recommended, because audible distortion may appear.
  2614. @end table
  2615. @section earwax
  2616. Make audio easier to listen to on headphones.
  2617. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2618. so that when listened to on headphones the stereo image is moved from
  2619. inside your head (standard for headphones) to outside and in front of
  2620. the listener (standard for speakers).
  2621. Ported from SoX.
  2622. @section equalizer
  2623. Apply a two-pole peaking equalisation (EQ) filter. With this
  2624. filter, the signal-level at and around a selected frequency can
  2625. be increased or decreased, whilst (unlike bandpass and bandreject
  2626. filters) that at all other frequencies is unchanged.
  2627. In order to produce complex equalisation curves, this filter can
  2628. be given several times, each with a different central frequency.
  2629. The filter accepts the following options:
  2630. @table @option
  2631. @item frequency, f
  2632. Set the filter's central frequency in Hz.
  2633. @item width_type, t
  2634. Set method to specify band-width of filter.
  2635. @table @option
  2636. @item h
  2637. Hz
  2638. @item q
  2639. Q-Factor
  2640. @item o
  2641. octave
  2642. @item s
  2643. slope
  2644. @item k
  2645. kHz
  2646. @end table
  2647. @item width, w
  2648. Specify the band-width of a filter in width_type units.
  2649. @item gain, g
  2650. Set the required gain or attenuation in dB.
  2651. Beware of clipping when using a positive gain.
  2652. @item mix, m
  2653. How much to use filtered signal in output. Default is 1.
  2654. Range is between 0 and 1.
  2655. @item channels, c
  2656. Specify which channels to filter, by default all available are filtered.
  2657. @end table
  2658. @subsection Examples
  2659. @itemize
  2660. @item
  2661. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2662. @example
  2663. equalizer=f=1000:t=h:width=200:g=-10
  2664. @end example
  2665. @item
  2666. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2667. @example
  2668. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2669. @end example
  2670. @end itemize
  2671. @subsection Commands
  2672. This filter supports the following commands:
  2673. @table @option
  2674. @item frequency, f
  2675. Change equalizer frequency.
  2676. Syntax for the command is : "@var{frequency}"
  2677. @item width_type, t
  2678. Change equalizer width_type.
  2679. Syntax for the command is : "@var{width_type}"
  2680. @item width, w
  2681. Change equalizer width.
  2682. Syntax for the command is : "@var{width}"
  2683. @item gain, g
  2684. Change equalizer gain.
  2685. Syntax for the command is : "@var{gain}"
  2686. @item mix, m
  2687. Change equalizer mix.
  2688. Syntax for the command is : "@var{mix}"
  2689. @end table
  2690. @section extrastereo
  2691. Linearly increases the difference between left and right channels which
  2692. adds some sort of "live" effect to playback.
  2693. The filter accepts the following options:
  2694. @table @option
  2695. @item m
  2696. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2697. (average of both channels), with 1.0 sound will be unchanged, with
  2698. -1.0 left and right channels will be swapped.
  2699. @item c
  2700. Enable clipping. By default is enabled.
  2701. @end table
  2702. @section firequalizer
  2703. Apply FIR Equalization using arbitrary frequency response.
  2704. The filter accepts the following option:
  2705. @table @option
  2706. @item gain
  2707. Set gain curve equation (in dB). The expression can contain variables:
  2708. @table @option
  2709. @item f
  2710. the evaluated frequency
  2711. @item sr
  2712. sample rate
  2713. @item ch
  2714. channel number, set to 0 when multichannels evaluation is disabled
  2715. @item chid
  2716. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2717. multichannels evaluation is disabled
  2718. @item chs
  2719. number of channels
  2720. @item chlayout
  2721. channel_layout, see libavutil/channel_layout.h
  2722. @end table
  2723. and functions:
  2724. @table @option
  2725. @item gain_interpolate(f)
  2726. interpolate gain on frequency f based on gain_entry
  2727. @item cubic_interpolate(f)
  2728. same as gain_interpolate, but smoother
  2729. @end table
  2730. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2731. @item gain_entry
  2732. Set gain entry for gain_interpolate function. The expression can
  2733. contain functions:
  2734. @table @option
  2735. @item entry(f, g)
  2736. store gain entry at frequency f with value g
  2737. @end table
  2738. This option is also available as command.
  2739. @item delay
  2740. Set filter delay in seconds. Higher value means more accurate.
  2741. Default is @code{0.01}.
  2742. @item accuracy
  2743. Set filter accuracy in Hz. Lower value means more accurate.
  2744. Default is @code{5}.
  2745. @item wfunc
  2746. Set window function. Acceptable values are:
  2747. @table @option
  2748. @item rectangular
  2749. rectangular window, useful when gain curve is already smooth
  2750. @item hann
  2751. hann window (default)
  2752. @item hamming
  2753. hamming window
  2754. @item blackman
  2755. blackman window
  2756. @item nuttall3
  2757. 3-terms continuous 1st derivative nuttall window
  2758. @item mnuttall3
  2759. minimum 3-terms discontinuous nuttall window
  2760. @item nuttall
  2761. 4-terms continuous 1st derivative nuttall window
  2762. @item bnuttall
  2763. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2764. @item bharris
  2765. blackman-harris window
  2766. @item tukey
  2767. tukey window
  2768. @end table
  2769. @item fixed
  2770. If enabled, use fixed number of audio samples. This improves speed when
  2771. filtering with large delay. Default is disabled.
  2772. @item multi
  2773. Enable multichannels evaluation on gain. Default is disabled.
  2774. @item zero_phase
  2775. Enable zero phase mode by subtracting timestamp to compensate delay.
  2776. Default is disabled.
  2777. @item scale
  2778. Set scale used by gain. Acceptable values are:
  2779. @table @option
  2780. @item linlin
  2781. linear frequency, linear gain
  2782. @item linlog
  2783. linear frequency, logarithmic (in dB) gain (default)
  2784. @item loglin
  2785. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2786. @item loglog
  2787. logarithmic frequency, logarithmic gain
  2788. @end table
  2789. @item dumpfile
  2790. Set file for dumping, suitable for gnuplot.
  2791. @item dumpscale
  2792. Set scale for dumpfile. Acceptable values are same with scale option.
  2793. Default is linlog.
  2794. @item fft2
  2795. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2796. Default is disabled.
  2797. @item min_phase
  2798. Enable minimum phase impulse response. Default is disabled.
  2799. @end table
  2800. @subsection Examples
  2801. @itemize
  2802. @item
  2803. lowpass at 1000 Hz:
  2804. @example
  2805. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2806. @end example
  2807. @item
  2808. lowpass at 1000 Hz with gain_entry:
  2809. @example
  2810. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2811. @end example
  2812. @item
  2813. custom equalization:
  2814. @example
  2815. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2816. @end example
  2817. @item
  2818. higher delay with zero phase to compensate delay:
  2819. @example
  2820. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2821. @end example
  2822. @item
  2823. lowpass on left channel, highpass on right channel:
  2824. @example
  2825. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2826. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2827. @end example
  2828. @end itemize
  2829. @section flanger
  2830. Apply a flanging effect to the audio.
  2831. The filter accepts the following options:
  2832. @table @option
  2833. @item delay
  2834. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2835. @item depth
  2836. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2837. @item regen
  2838. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2839. Default value is 0.
  2840. @item width
  2841. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2842. Default value is 71.
  2843. @item speed
  2844. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2845. @item shape
  2846. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2847. Default value is @var{sinusoidal}.
  2848. @item phase
  2849. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2850. Default value is 25.
  2851. @item interp
  2852. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2853. Default is @var{linear}.
  2854. @end table
  2855. @section haas
  2856. Apply Haas effect to audio.
  2857. Note that this makes most sense to apply on mono signals.
  2858. With this filter applied to mono signals it give some directionality and
  2859. stretches its stereo image.
  2860. The filter accepts the following options:
  2861. @table @option
  2862. @item level_in
  2863. Set input level. By default is @var{1}, or 0dB
  2864. @item level_out
  2865. Set output level. By default is @var{1}, or 0dB.
  2866. @item side_gain
  2867. Set gain applied to side part of signal. By default is @var{1}.
  2868. @item middle_source
  2869. Set kind of middle source. Can be one of the following:
  2870. @table @samp
  2871. @item left
  2872. Pick left channel.
  2873. @item right
  2874. Pick right channel.
  2875. @item mid
  2876. Pick middle part signal of stereo image.
  2877. @item side
  2878. Pick side part signal of stereo image.
  2879. @end table
  2880. @item middle_phase
  2881. Change middle phase. By default is disabled.
  2882. @item left_delay
  2883. Set left channel delay. By default is @var{2.05} milliseconds.
  2884. @item left_balance
  2885. Set left channel balance. By default is @var{-1}.
  2886. @item left_gain
  2887. Set left channel gain. By default is @var{1}.
  2888. @item left_phase
  2889. Change left phase. By default is disabled.
  2890. @item right_delay
  2891. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2892. @item right_balance
  2893. Set right channel balance. By default is @var{1}.
  2894. @item right_gain
  2895. Set right channel gain. By default is @var{1}.
  2896. @item right_phase
  2897. Change right phase. By default is enabled.
  2898. @end table
  2899. @section hdcd
  2900. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2901. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2902. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2903. of HDCD, and detects the Transient Filter flag.
  2904. @example
  2905. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2906. @end example
  2907. When using the filter with wav, note the default encoding for wav is 16-bit,
  2908. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2909. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2910. @example
  2911. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2912. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2913. @end example
  2914. The filter accepts the following options:
  2915. @table @option
  2916. @item disable_autoconvert
  2917. Disable any automatic format conversion or resampling in the filter graph.
  2918. @item process_stereo
  2919. Process the stereo channels together. If target_gain does not match between
  2920. channels, consider it invalid and use the last valid target_gain.
  2921. @item cdt_ms
  2922. Set the code detect timer period in ms.
  2923. @item force_pe
  2924. Always extend peaks above -3dBFS even if PE isn't signaled.
  2925. @item analyze_mode
  2926. Replace audio with a solid tone and adjust the amplitude to signal some
  2927. specific aspect of the decoding process. The output file can be loaded in
  2928. an audio editor alongside the original to aid analysis.
  2929. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2930. Modes are:
  2931. @table @samp
  2932. @item 0, off
  2933. Disabled
  2934. @item 1, lle
  2935. Gain adjustment level at each sample
  2936. @item 2, pe
  2937. Samples where peak extend occurs
  2938. @item 3, cdt
  2939. Samples where the code detect timer is active
  2940. @item 4, tgm
  2941. Samples where the target gain does not match between channels
  2942. @end table
  2943. @end table
  2944. @section headphone
  2945. Apply head-related transfer functions (HRTFs) to create virtual
  2946. loudspeakers around the user for binaural listening via headphones.
  2947. The HRIRs are provided via additional streams, for each channel
  2948. one stereo input stream is needed.
  2949. The filter accepts the following options:
  2950. @table @option
  2951. @item map
  2952. Set mapping of input streams for convolution.
  2953. The argument is a '|'-separated list of channel names in order as they
  2954. are given as additional stream inputs for filter.
  2955. This also specify number of input streams. Number of input streams
  2956. must be not less than number of channels in first stream plus one.
  2957. @item gain
  2958. Set gain applied to audio. Value is in dB. Default is 0.
  2959. @item type
  2960. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2961. processing audio in time domain which is slow.
  2962. @var{freq} is processing audio in frequency domain which is fast.
  2963. Default is @var{freq}.
  2964. @item lfe
  2965. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2966. @item size
  2967. Set size of frame in number of samples which will be processed at once.
  2968. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2969. @item hrir
  2970. Set format of hrir stream.
  2971. Default value is @var{stereo}. Alternative value is @var{multich}.
  2972. If value is set to @var{stereo}, number of additional streams should
  2973. be greater or equal to number of input channels in first input stream.
  2974. Also each additional stream should have stereo number of channels.
  2975. If value is set to @var{multich}, number of additional streams should
  2976. be exactly one. Also number of input channels of additional stream
  2977. should be equal or greater than twice number of channels of first input
  2978. stream.
  2979. @end table
  2980. @subsection Examples
  2981. @itemize
  2982. @item
  2983. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2984. each amovie filter use stereo file with IR coefficients as input.
  2985. The files give coefficients for each position of virtual loudspeaker:
  2986. @example
  2987. ffmpeg -i input.wav
  2988. -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"
  2989. output.wav
  2990. @end example
  2991. @item
  2992. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2993. but now in @var{multich} @var{hrir} format.
  2994. @example
  2995. 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"
  2996. output.wav
  2997. @end example
  2998. @end itemize
  2999. @section highpass
  3000. Apply a high-pass filter with 3dB point frequency.
  3001. The filter can be either single-pole, or double-pole (the default).
  3002. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3003. The filter accepts the following options:
  3004. @table @option
  3005. @item frequency, f
  3006. Set frequency in Hz. Default is 3000.
  3007. @item poles, p
  3008. Set number of poles. Default is 2.
  3009. @item width_type, t
  3010. Set method to specify band-width of filter.
  3011. @table @option
  3012. @item h
  3013. Hz
  3014. @item q
  3015. Q-Factor
  3016. @item o
  3017. octave
  3018. @item s
  3019. slope
  3020. @item k
  3021. kHz
  3022. @end table
  3023. @item width, w
  3024. Specify the band-width of a filter in width_type units.
  3025. Applies only to double-pole filter.
  3026. The default is 0.707q and gives a Butterworth response.
  3027. @item mix, m
  3028. How much to use filtered signal in output. Default is 1.
  3029. Range is between 0 and 1.
  3030. @item channels, c
  3031. Specify which channels to filter, by default all available are filtered.
  3032. @end table
  3033. @subsection Commands
  3034. This filter supports the following commands:
  3035. @table @option
  3036. @item frequency, f
  3037. Change highpass frequency.
  3038. Syntax for the command is : "@var{frequency}"
  3039. @item width_type, t
  3040. Change highpass width_type.
  3041. Syntax for the command is : "@var{width_type}"
  3042. @item width, w
  3043. Change highpass width.
  3044. Syntax for the command is : "@var{width}"
  3045. @item mix, m
  3046. Change highpass mix.
  3047. Syntax for the command is : "@var{mix}"
  3048. @end table
  3049. @section join
  3050. Join multiple input streams into one multi-channel stream.
  3051. It accepts the following parameters:
  3052. @table @option
  3053. @item inputs
  3054. The number of input streams. It defaults to 2.
  3055. @item channel_layout
  3056. The desired output channel layout. It defaults to stereo.
  3057. @item map
  3058. Map channels from inputs to output. The argument is a '|'-separated list of
  3059. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3060. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3061. can be either the name of the input channel (e.g. FL for front left) or its
  3062. index in the specified input stream. @var{out_channel} is the name of the output
  3063. channel.
  3064. @end table
  3065. The filter will attempt to guess the mappings when they are not specified
  3066. explicitly. It does so by first trying to find an unused matching input channel
  3067. and if that fails it picks the first unused input channel.
  3068. Join 3 inputs (with properly set channel layouts):
  3069. @example
  3070. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3071. @end example
  3072. Build a 5.1 output from 6 single-channel streams:
  3073. @example
  3074. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3075. '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'
  3076. out
  3077. @end example
  3078. @section ladspa
  3079. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3080. To enable compilation of this filter you need to configure FFmpeg with
  3081. @code{--enable-ladspa}.
  3082. @table @option
  3083. @item file, f
  3084. Specifies the name of LADSPA plugin library to load. If the environment
  3085. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3086. each one of the directories specified by the colon separated list in
  3087. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3088. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3089. @file{/usr/lib/ladspa/}.
  3090. @item plugin, p
  3091. Specifies the plugin within the library. Some libraries contain only
  3092. one plugin, but others contain many of them. If this is not set filter
  3093. will list all available plugins within the specified library.
  3094. @item controls, c
  3095. Set the '|' separated list of controls which are zero or more floating point
  3096. values that determine the behavior of the loaded plugin (for example delay,
  3097. threshold or gain).
  3098. Controls need to be defined using the following syntax:
  3099. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3100. @var{valuei} is the value set on the @var{i}-th control.
  3101. Alternatively they can be also defined using the following syntax:
  3102. @var{value0}|@var{value1}|@var{value2}|..., where
  3103. @var{valuei} is the value set on the @var{i}-th control.
  3104. If @option{controls} is set to @code{help}, all available controls and
  3105. their valid ranges are printed.
  3106. @item sample_rate, s
  3107. Specify the sample rate, default to 44100. Only used if plugin have
  3108. zero inputs.
  3109. @item nb_samples, n
  3110. Set the number of samples per channel per each output frame, default
  3111. is 1024. Only used if plugin have zero inputs.
  3112. @item duration, d
  3113. Set the minimum duration of the sourced audio. See
  3114. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3115. for the accepted syntax.
  3116. Note that the resulting duration may be greater than the specified duration,
  3117. as the generated audio is always cut at the end of a complete frame.
  3118. If not specified, or the expressed duration is negative, the audio is
  3119. supposed to be generated forever.
  3120. Only used if plugin have zero inputs.
  3121. @end table
  3122. @subsection Examples
  3123. @itemize
  3124. @item
  3125. List all available plugins within amp (LADSPA example plugin) library:
  3126. @example
  3127. ladspa=file=amp
  3128. @end example
  3129. @item
  3130. List all available controls and their valid ranges for @code{vcf_notch}
  3131. plugin from @code{VCF} library:
  3132. @example
  3133. ladspa=f=vcf:p=vcf_notch:c=help
  3134. @end example
  3135. @item
  3136. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3137. plugin library:
  3138. @example
  3139. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3140. @end example
  3141. @item
  3142. Add reverberation to the audio using TAP-plugins
  3143. (Tom's Audio Processing plugins):
  3144. @example
  3145. ladspa=file=tap_reverb:tap_reverb
  3146. @end example
  3147. @item
  3148. Generate white noise, with 0.2 amplitude:
  3149. @example
  3150. ladspa=file=cmt:noise_source_white:c=c0=.2
  3151. @end example
  3152. @item
  3153. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3154. @code{C* Audio Plugin Suite} (CAPS) library:
  3155. @example
  3156. ladspa=file=caps:Click:c=c1=20'
  3157. @end example
  3158. @item
  3159. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3160. @example
  3161. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3162. @end example
  3163. @item
  3164. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3165. @code{SWH Plugins} collection:
  3166. @example
  3167. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3168. @end example
  3169. @item
  3170. Attenuate low frequencies using Multiband EQ from Steve Harris
  3171. @code{SWH Plugins} collection:
  3172. @example
  3173. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3174. @end example
  3175. @item
  3176. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3177. (CAPS) library:
  3178. @example
  3179. ladspa=caps:Narrower
  3180. @end example
  3181. @item
  3182. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3183. @example
  3184. ladspa=caps:White:.2
  3185. @end example
  3186. @item
  3187. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3188. @example
  3189. ladspa=caps:Fractal:c=c1=1
  3190. @end example
  3191. @item
  3192. Dynamic volume normalization using @code{VLevel} plugin:
  3193. @example
  3194. ladspa=vlevel-ladspa:vlevel_mono
  3195. @end example
  3196. @end itemize
  3197. @subsection Commands
  3198. This filter supports the following commands:
  3199. @table @option
  3200. @item cN
  3201. Modify the @var{N}-th control value.
  3202. If the specified value is not valid, it is ignored and prior one is kept.
  3203. @end table
  3204. @section loudnorm
  3205. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3206. Support for both single pass (livestreams, files) and double pass (files) modes.
  3207. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3208. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3209. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3210. The filter accepts the following options:
  3211. @table @option
  3212. @item I, i
  3213. Set integrated loudness target.
  3214. Range is -70.0 - -5.0. Default value is -24.0.
  3215. @item LRA, lra
  3216. Set loudness range target.
  3217. Range is 1.0 - 20.0. Default value is 7.0.
  3218. @item TP, tp
  3219. Set maximum true peak.
  3220. Range is -9.0 - +0.0. Default value is -2.0.
  3221. @item measured_I, measured_i
  3222. Measured IL of input file.
  3223. Range is -99.0 - +0.0.
  3224. @item measured_LRA, measured_lra
  3225. Measured LRA of input file.
  3226. Range is 0.0 - 99.0.
  3227. @item measured_TP, measured_tp
  3228. Measured true peak of input file.
  3229. Range is -99.0 - +99.0.
  3230. @item measured_thresh
  3231. Measured threshold of input file.
  3232. Range is -99.0 - +0.0.
  3233. @item offset
  3234. Set offset gain. Gain is applied before the true-peak limiter.
  3235. Range is -99.0 - +99.0. Default is +0.0.
  3236. @item linear
  3237. Normalize linearly if possible.
  3238. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3239. to be specified in order to use this mode.
  3240. Options are true or false. Default is true.
  3241. @item dual_mono
  3242. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3243. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3244. If set to @code{true}, this option will compensate for this effect.
  3245. Multi-channel input files are not affected by this option.
  3246. Options are true or false. Default is false.
  3247. @item print_format
  3248. Set print format for stats. Options are summary, json, or none.
  3249. Default value is none.
  3250. @end table
  3251. @section lowpass
  3252. Apply a low-pass filter with 3dB point frequency.
  3253. The filter can be either single-pole or double-pole (the default).
  3254. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3255. The filter accepts the following options:
  3256. @table @option
  3257. @item frequency, f
  3258. Set frequency in Hz. Default is 500.
  3259. @item poles, p
  3260. Set number of poles. Default is 2.
  3261. @item width_type, t
  3262. Set method to specify band-width of filter.
  3263. @table @option
  3264. @item h
  3265. Hz
  3266. @item q
  3267. Q-Factor
  3268. @item o
  3269. octave
  3270. @item s
  3271. slope
  3272. @item k
  3273. kHz
  3274. @end table
  3275. @item width, w
  3276. Specify the band-width of a filter in width_type units.
  3277. Applies only to double-pole filter.
  3278. The default is 0.707q and gives a Butterworth response.
  3279. @item mix, m
  3280. How much to use filtered signal in output. Default is 1.
  3281. Range is between 0 and 1.
  3282. @item channels, c
  3283. Specify which channels to filter, by default all available are filtered.
  3284. @end table
  3285. @subsection Examples
  3286. @itemize
  3287. @item
  3288. Lowpass only LFE channel, it LFE is not present it does nothing:
  3289. @example
  3290. lowpass=c=LFE
  3291. @end example
  3292. @end itemize
  3293. @subsection Commands
  3294. This filter supports the following commands:
  3295. @table @option
  3296. @item frequency, f
  3297. Change lowpass frequency.
  3298. Syntax for the command is : "@var{frequency}"
  3299. @item width_type, t
  3300. Change lowpass width_type.
  3301. Syntax for the command is : "@var{width_type}"
  3302. @item width, w
  3303. Change lowpass width.
  3304. Syntax for the command is : "@var{width}"
  3305. @item mix, m
  3306. Change lowpass mix.
  3307. Syntax for the command is : "@var{mix}"
  3308. @end table
  3309. @section lv2
  3310. Load a LV2 (LADSPA Version 2) plugin.
  3311. To enable compilation of this filter you need to configure FFmpeg with
  3312. @code{--enable-lv2}.
  3313. @table @option
  3314. @item plugin, p
  3315. Specifies the plugin URI. You may need to escape ':'.
  3316. @item controls, c
  3317. Set the '|' separated list of controls which are zero or more floating point
  3318. values that determine the behavior of the loaded plugin (for example delay,
  3319. threshold or gain).
  3320. If @option{controls} is set to @code{help}, all available controls and
  3321. their valid ranges are printed.
  3322. @item sample_rate, s
  3323. Specify the sample rate, default to 44100. Only used if plugin have
  3324. zero inputs.
  3325. @item nb_samples, n
  3326. Set the number of samples per channel per each output frame, default
  3327. is 1024. Only used if plugin have zero inputs.
  3328. @item duration, d
  3329. Set the minimum duration of the sourced audio. See
  3330. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3331. for the accepted syntax.
  3332. Note that the resulting duration may be greater than the specified duration,
  3333. as the generated audio is always cut at the end of a complete frame.
  3334. If not specified, or the expressed duration is negative, the audio is
  3335. supposed to be generated forever.
  3336. Only used if plugin have zero inputs.
  3337. @end table
  3338. @subsection Examples
  3339. @itemize
  3340. @item
  3341. Apply bass enhancer plugin from Calf:
  3342. @example
  3343. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3344. @end example
  3345. @item
  3346. Apply vinyl plugin from Calf:
  3347. @example
  3348. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3349. @end example
  3350. @item
  3351. Apply bit crusher plugin from ArtyFX:
  3352. @example
  3353. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3354. @end example
  3355. @end itemize
  3356. @section mcompand
  3357. Multiband Compress or expand the audio's dynamic range.
  3358. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3359. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3360. response when absent compander action.
  3361. It accepts the following parameters:
  3362. @table @option
  3363. @item args
  3364. This option syntax is:
  3365. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3366. For explanation of each item refer to compand filter documentation.
  3367. @end table
  3368. @anchor{pan}
  3369. @section pan
  3370. Mix channels with specific gain levels. The filter accepts the output
  3371. channel layout followed by a set of channels definitions.
  3372. This filter is also designed to efficiently remap the channels of an audio
  3373. stream.
  3374. The filter accepts parameters of the form:
  3375. "@var{l}|@var{outdef}|@var{outdef}|..."
  3376. @table @option
  3377. @item l
  3378. output channel layout or number of channels
  3379. @item outdef
  3380. output channel specification, of the form:
  3381. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3382. @item out_name
  3383. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3384. number (c0, c1, etc.)
  3385. @item gain
  3386. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3387. @item in_name
  3388. input channel to use, see out_name for details; it is not possible to mix
  3389. named and numbered input channels
  3390. @end table
  3391. If the `=' in a channel specification is replaced by `<', then the gains for
  3392. that specification will be renormalized so that the total is 1, thus
  3393. avoiding clipping noise.
  3394. @subsection Mixing examples
  3395. For example, if you want to down-mix from stereo to mono, but with a bigger
  3396. factor for the left channel:
  3397. @example
  3398. pan=1c|c0=0.9*c0+0.1*c1
  3399. @end example
  3400. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3401. 7-channels surround:
  3402. @example
  3403. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3404. @end example
  3405. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3406. that should be preferred (see "-ac" option) unless you have very specific
  3407. needs.
  3408. @subsection Remapping examples
  3409. The channel remapping will be effective if, and only if:
  3410. @itemize
  3411. @item gain coefficients are zeroes or ones,
  3412. @item only one input per channel output,
  3413. @end itemize
  3414. If all these conditions are satisfied, the filter will notify the user ("Pure
  3415. channel mapping detected"), and use an optimized and lossless method to do the
  3416. remapping.
  3417. For example, if you have a 5.1 source and want a stereo audio stream by
  3418. dropping the extra channels:
  3419. @example
  3420. pan="stereo| c0=FL | c1=FR"
  3421. @end example
  3422. Given the same source, you can also switch front left and front right channels
  3423. and keep the input channel layout:
  3424. @example
  3425. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3426. @end example
  3427. If the input is a stereo audio stream, you can mute the front left channel (and
  3428. still keep the stereo channel layout) with:
  3429. @example
  3430. pan="stereo|c1=c1"
  3431. @end example
  3432. Still with a stereo audio stream input, you can copy the right channel in both
  3433. front left and right:
  3434. @example
  3435. pan="stereo| c0=FR | c1=FR"
  3436. @end example
  3437. @section replaygain
  3438. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3439. outputs it unchanged.
  3440. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3441. @section resample
  3442. Convert the audio sample format, sample rate and channel layout. It is
  3443. not meant to be used directly.
  3444. @section rubberband
  3445. Apply time-stretching and pitch-shifting with librubberband.
  3446. To enable compilation of this filter, you need to configure FFmpeg with
  3447. @code{--enable-librubberband}.
  3448. The filter accepts the following options:
  3449. @table @option
  3450. @item tempo
  3451. Set tempo scale factor.
  3452. @item pitch
  3453. Set pitch scale factor.
  3454. @item transients
  3455. Set transients detector.
  3456. Possible values are:
  3457. @table @var
  3458. @item crisp
  3459. @item mixed
  3460. @item smooth
  3461. @end table
  3462. @item detector
  3463. Set detector.
  3464. Possible values are:
  3465. @table @var
  3466. @item compound
  3467. @item percussive
  3468. @item soft
  3469. @end table
  3470. @item phase
  3471. Set phase.
  3472. Possible values are:
  3473. @table @var
  3474. @item laminar
  3475. @item independent
  3476. @end table
  3477. @item window
  3478. Set processing window size.
  3479. Possible values are:
  3480. @table @var
  3481. @item standard
  3482. @item short
  3483. @item long
  3484. @end table
  3485. @item smoothing
  3486. Set smoothing.
  3487. Possible values are:
  3488. @table @var
  3489. @item off
  3490. @item on
  3491. @end table
  3492. @item formant
  3493. Enable formant preservation when shift pitching.
  3494. Possible values are:
  3495. @table @var
  3496. @item shifted
  3497. @item preserved
  3498. @end table
  3499. @item pitchq
  3500. Set pitch quality.
  3501. Possible values are:
  3502. @table @var
  3503. @item quality
  3504. @item speed
  3505. @item consistency
  3506. @end table
  3507. @item channels
  3508. Set channels.
  3509. Possible values are:
  3510. @table @var
  3511. @item apart
  3512. @item together
  3513. @end table
  3514. @end table
  3515. @subsection Commands
  3516. This filter supports the following commands:
  3517. @table @option
  3518. @item tempo
  3519. Change filter tempo scale factor.
  3520. Syntax for the command is : "@var{tempo}"
  3521. @item pitch
  3522. Change filter pitch scale factor.
  3523. Syntax for the command is : "@var{pitch}"
  3524. @end table
  3525. @section sidechaincompress
  3526. This filter acts like normal compressor but has the ability to compress
  3527. detected signal using second input signal.
  3528. It needs two input streams and returns one output stream.
  3529. First input stream will be processed depending on second stream signal.
  3530. The filtered signal then can be filtered with other filters in later stages of
  3531. processing. See @ref{pan} and @ref{amerge} filter.
  3532. The filter accepts the following options:
  3533. @table @option
  3534. @item level_in
  3535. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3536. @item mode
  3537. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3538. Default is @code{downward}.
  3539. @item threshold
  3540. If a signal of second stream raises above this level it will affect the gain
  3541. reduction of first stream.
  3542. By default is 0.125. Range is between 0.00097563 and 1.
  3543. @item ratio
  3544. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3545. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3546. Default is 2. Range is between 1 and 20.
  3547. @item attack
  3548. Amount of milliseconds the signal has to rise above the threshold before gain
  3549. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3550. @item release
  3551. Amount of milliseconds the signal has to fall below the threshold before
  3552. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3553. @item makeup
  3554. Set the amount by how much signal will be amplified after processing.
  3555. Default is 1. Range is from 1 to 64.
  3556. @item knee
  3557. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3558. Default is 2.82843. Range is between 1 and 8.
  3559. @item link
  3560. Choose if the @code{average} level between all channels of side-chain stream
  3561. or the louder(@code{maximum}) channel of side-chain stream affects the
  3562. reduction. Default is @code{average}.
  3563. @item detection
  3564. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3565. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3566. @item level_sc
  3567. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3568. @item mix
  3569. How much to use compressed signal in output. Default is 1.
  3570. Range is between 0 and 1.
  3571. @end table
  3572. @subsection Examples
  3573. @itemize
  3574. @item
  3575. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3576. depending on the signal of 2nd input and later compressed signal to be
  3577. merged with 2nd input:
  3578. @example
  3579. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3580. @end example
  3581. @end itemize
  3582. @section sidechaingate
  3583. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3584. filter the detected signal before sending it to the gain reduction stage.
  3585. Normally a gate uses the full range signal to detect a level above the
  3586. threshold.
  3587. For example: If you cut all lower frequencies from your sidechain signal
  3588. the gate will decrease the volume of your track only if not enough highs
  3589. appear. With this technique you are able to reduce the resonation of a
  3590. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3591. guitar.
  3592. It needs two input streams and returns one output stream.
  3593. First input stream will be processed depending on second stream signal.
  3594. The filter accepts the following options:
  3595. @table @option
  3596. @item level_in
  3597. Set input level before filtering.
  3598. Default is 1. Allowed range is from 0.015625 to 64.
  3599. @item mode
  3600. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3601. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3602. will be amplified, expanding dynamic range in upward direction.
  3603. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3604. @item range
  3605. Set the level of gain reduction when the signal is below the threshold.
  3606. Default is 0.06125. Allowed range is from 0 to 1.
  3607. Setting this to 0 disables reduction and then filter behaves like expander.
  3608. @item threshold
  3609. If a signal rises above this level the gain reduction is released.
  3610. Default is 0.125. Allowed range is from 0 to 1.
  3611. @item ratio
  3612. Set a ratio about which the signal is reduced.
  3613. Default is 2. Allowed range is from 1 to 9000.
  3614. @item attack
  3615. Amount of milliseconds the signal has to rise above the threshold before gain
  3616. reduction stops.
  3617. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3618. @item release
  3619. Amount of milliseconds the signal has to fall below the threshold before the
  3620. reduction is increased again. Default is 250 milliseconds.
  3621. Allowed range is from 0.01 to 9000.
  3622. @item makeup
  3623. Set amount of amplification of signal after processing.
  3624. Default is 1. Allowed range is from 1 to 64.
  3625. @item knee
  3626. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3627. Default is 2.828427125. Allowed range is from 1 to 8.
  3628. @item detection
  3629. Choose if exact signal should be taken for detection or an RMS like one.
  3630. Default is rms. Can be peak or rms.
  3631. @item link
  3632. Choose if the average level between all channels or the louder channel affects
  3633. the reduction.
  3634. Default is average. Can be average or maximum.
  3635. @item level_sc
  3636. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3637. @end table
  3638. @section silencedetect
  3639. Detect silence in an audio stream.
  3640. This filter logs a message when it detects that the input audio volume is less
  3641. or equal to a noise tolerance value for a duration greater or equal to the
  3642. minimum detected noise duration.
  3643. The printed times and duration are expressed in seconds. The
  3644. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  3645. is set on the first frame whose timestamp equals or exceeds the detection
  3646. duration and it contains the timestamp of the first frame of the silence.
  3647. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  3648. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  3649. keys are set on the first frame after the silence. If @option{mono} is
  3650. enabled, and each channel is evaluated separately, the @code{.X}
  3651. suffixed keys are used, and @code{X} corresponds to the channel number.
  3652. The filter accepts the following options:
  3653. @table @option
  3654. @item noise, n
  3655. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3656. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3657. @item duration, d
  3658. Set silence duration until notification (default is 2 seconds). See
  3659. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3660. for the accepted syntax.
  3661. @item mono, m
  3662. Process each channel separately, instead of combined. By default is disabled.
  3663. @end table
  3664. @subsection Examples
  3665. @itemize
  3666. @item
  3667. Detect 5 seconds of silence with -50dB noise tolerance:
  3668. @example
  3669. silencedetect=n=-50dB:d=5
  3670. @end example
  3671. @item
  3672. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3673. tolerance in @file{silence.mp3}:
  3674. @example
  3675. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3676. @end example
  3677. @end itemize
  3678. @section silenceremove
  3679. Remove silence from the beginning, middle or end of the audio.
  3680. The filter accepts the following options:
  3681. @table @option
  3682. @item start_periods
  3683. This value is used to indicate if audio should be trimmed at beginning of
  3684. the audio. A value of zero indicates no silence should be trimmed from the
  3685. beginning. When specifying a non-zero value, it trims audio up until it
  3686. finds non-silence. Normally, when trimming silence from beginning of audio
  3687. the @var{start_periods} will be @code{1} but it can be increased to higher
  3688. values to trim all audio up to specific count of non-silence periods.
  3689. Default value is @code{0}.
  3690. @item start_duration
  3691. Specify the amount of time that non-silence must be detected before it stops
  3692. trimming audio. By increasing the duration, bursts of noises can be treated
  3693. as silence and trimmed off. Default value is @code{0}.
  3694. @item start_threshold
  3695. This indicates what sample value should be treated as silence. For digital
  3696. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3697. you may wish to increase the value to account for background noise.
  3698. Can be specified in dB (in case "dB" is appended to the specified value)
  3699. or amplitude ratio. Default value is @code{0}.
  3700. @item start_silence
  3701. Specify max duration of silence at beginning that will be kept after
  3702. trimming. Default is 0, which is equal to trimming all samples detected
  3703. as silence.
  3704. @item start_mode
  3705. Specify mode of detection of silence end in start of multi-channel audio.
  3706. Can be @var{any} or @var{all}. Default is @var{any}.
  3707. With @var{any}, any sample that is detected as non-silence will cause
  3708. stopped trimming of silence.
  3709. With @var{all}, only if all channels are detected as non-silence will cause
  3710. stopped trimming of silence.
  3711. @item stop_periods
  3712. Set the count for trimming silence from the end of audio.
  3713. To remove silence from the middle of a file, specify a @var{stop_periods}
  3714. that is negative. This value is then treated as a positive value and is
  3715. used to indicate the effect should restart processing as specified by
  3716. @var{start_periods}, making it suitable for removing periods of silence
  3717. in the middle of the audio.
  3718. Default value is @code{0}.
  3719. @item stop_duration
  3720. Specify a duration of silence that must exist before audio is not copied any
  3721. more. By specifying a higher duration, silence that is wanted can be left in
  3722. the audio.
  3723. Default value is @code{0}.
  3724. @item stop_threshold
  3725. This is the same as @option{start_threshold} but for trimming silence from
  3726. the end of audio.
  3727. Can be specified in dB (in case "dB" is appended to the specified value)
  3728. or amplitude ratio. Default value is @code{0}.
  3729. @item stop_silence
  3730. Specify max duration of silence at end that will be kept after
  3731. trimming. Default is 0, which is equal to trimming all samples detected
  3732. as silence.
  3733. @item stop_mode
  3734. Specify mode of detection of silence start in end of multi-channel audio.
  3735. Can be @var{any} or @var{all}. Default is @var{any}.
  3736. With @var{any}, any sample that is detected as non-silence will cause
  3737. stopped trimming of silence.
  3738. With @var{all}, only if all channels are detected as non-silence will cause
  3739. stopped trimming of silence.
  3740. @item detection
  3741. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3742. and works better with digital silence which is exactly 0.
  3743. Default value is @code{rms}.
  3744. @item window
  3745. Set duration in number of seconds used to calculate size of window in number
  3746. of samples for detecting silence.
  3747. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3748. @end table
  3749. @subsection Examples
  3750. @itemize
  3751. @item
  3752. The following example shows how this filter can be used to start a recording
  3753. that does not contain the delay at the start which usually occurs between
  3754. pressing the record button and the start of the performance:
  3755. @example
  3756. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3757. @end example
  3758. @item
  3759. Trim all silence encountered from beginning to end where there is more than 1
  3760. second of silence in audio:
  3761. @example
  3762. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3763. @end example
  3764. @item
  3765. Trim all digital silence samples, using peak detection, from beginning to end
  3766. where there is more than 0 samples of digital silence in audio and digital
  3767. silence is detected in all channels at same positions in stream:
  3768. @example
  3769. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  3770. @end example
  3771. @end itemize
  3772. @section sofalizer
  3773. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3774. loudspeakers around the user for binaural listening via headphones (audio
  3775. formats up to 9 channels supported).
  3776. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3777. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3778. Austrian Academy of Sciences.
  3779. To enable compilation of this filter you need to configure FFmpeg with
  3780. @code{--enable-libmysofa}.
  3781. The filter accepts the following options:
  3782. @table @option
  3783. @item sofa
  3784. Set the SOFA file used for rendering.
  3785. @item gain
  3786. Set gain applied to audio. Value is in dB. Default is 0.
  3787. @item rotation
  3788. Set rotation of virtual loudspeakers in deg. Default is 0.
  3789. @item elevation
  3790. Set elevation of virtual speakers in deg. Default is 0.
  3791. @item radius
  3792. Set distance in meters between loudspeakers and the listener with near-field
  3793. HRTFs. Default is 1.
  3794. @item type
  3795. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3796. processing audio in time domain which is slow.
  3797. @var{freq} is processing audio in frequency domain which is fast.
  3798. Default is @var{freq}.
  3799. @item speakers
  3800. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3801. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3802. Each virtual loudspeaker is described with short channel name following with
  3803. azimuth and elevation in degrees.
  3804. Each virtual loudspeaker description is separated by '|'.
  3805. For example to override front left and front right channel positions use:
  3806. 'speakers=FL 45 15|FR 345 15'.
  3807. Descriptions with unrecognised channel names are ignored.
  3808. @item lfegain
  3809. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3810. @item framesize
  3811. Set custom frame size in number of samples. Default is 1024.
  3812. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3813. is set to @var{freq}.
  3814. @item normalize
  3815. Should all IRs be normalized upon importing SOFA file.
  3816. By default is enabled.
  3817. @item interpolate
  3818. Should nearest IRs be interpolated with neighbor IRs if exact position
  3819. does not match. By default is disabled.
  3820. @item minphase
  3821. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3822. @item anglestep
  3823. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3824. @item radstep
  3825. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3826. @end table
  3827. @subsection Examples
  3828. @itemize
  3829. @item
  3830. Using ClubFritz6 sofa file:
  3831. @example
  3832. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3833. @end example
  3834. @item
  3835. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3836. @example
  3837. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3838. @end example
  3839. @item
  3840. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3841. and also with custom gain:
  3842. @example
  3843. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3844. @end example
  3845. @end itemize
  3846. @section stereotools
  3847. This filter has some handy utilities to manage stereo signals, for converting
  3848. M/S stereo recordings to L/R signal while having control over the parameters
  3849. or spreading the stereo image of master track.
  3850. The filter accepts the following options:
  3851. @table @option
  3852. @item level_in
  3853. Set input level before filtering for both channels. Defaults is 1.
  3854. Allowed range is from 0.015625 to 64.
  3855. @item level_out
  3856. Set output level after filtering for both channels. Defaults is 1.
  3857. Allowed range is from 0.015625 to 64.
  3858. @item balance_in
  3859. Set input balance between both channels. Default is 0.
  3860. Allowed range is from -1 to 1.
  3861. @item balance_out
  3862. Set output balance between both channels. Default is 0.
  3863. Allowed range is from -1 to 1.
  3864. @item softclip
  3865. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3866. clipping. Disabled by default.
  3867. @item mutel
  3868. Mute the left channel. Disabled by default.
  3869. @item muter
  3870. Mute the right channel. Disabled by default.
  3871. @item phasel
  3872. Change the phase of the left channel. Disabled by default.
  3873. @item phaser
  3874. Change the phase of the right channel. Disabled by default.
  3875. @item mode
  3876. Set stereo mode. Available values are:
  3877. @table @samp
  3878. @item lr>lr
  3879. Left/Right to Left/Right, this is default.
  3880. @item lr>ms
  3881. Left/Right to Mid/Side.
  3882. @item ms>lr
  3883. Mid/Side to Left/Right.
  3884. @item lr>ll
  3885. Left/Right to Left/Left.
  3886. @item lr>rr
  3887. Left/Right to Right/Right.
  3888. @item lr>l+r
  3889. Left/Right to Left + Right.
  3890. @item lr>rl
  3891. Left/Right to Right/Left.
  3892. @item ms>ll
  3893. Mid/Side to Left/Left.
  3894. @item ms>rr
  3895. Mid/Side to Right/Right.
  3896. @end table
  3897. @item slev
  3898. Set level of side signal. Default is 1.
  3899. Allowed range is from 0.015625 to 64.
  3900. @item sbal
  3901. Set balance of side signal. Default is 0.
  3902. Allowed range is from -1 to 1.
  3903. @item mlev
  3904. Set level of the middle signal. Default is 1.
  3905. Allowed range is from 0.015625 to 64.
  3906. @item mpan
  3907. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3908. @item base
  3909. Set stereo base between mono and inversed channels. Default is 0.
  3910. Allowed range is from -1 to 1.
  3911. @item delay
  3912. Set delay in milliseconds how much to delay left from right channel and
  3913. vice versa. Default is 0. Allowed range is from -20 to 20.
  3914. @item sclevel
  3915. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3916. @item phase
  3917. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3918. @item bmode_in, bmode_out
  3919. Set balance mode for balance_in/balance_out option.
  3920. Can be one of the following:
  3921. @table @samp
  3922. @item balance
  3923. Classic balance mode. Attenuate one channel at time.
  3924. Gain is raised up to 1.
  3925. @item amplitude
  3926. Similar as classic mode above but gain is raised up to 2.
  3927. @item power
  3928. Equal power distribution, from -6dB to +6dB range.
  3929. @end table
  3930. @end table
  3931. @subsection Examples
  3932. @itemize
  3933. @item
  3934. Apply karaoke like effect:
  3935. @example
  3936. stereotools=mlev=0.015625
  3937. @end example
  3938. @item
  3939. Convert M/S signal to L/R:
  3940. @example
  3941. "stereotools=mode=ms>lr"
  3942. @end example
  3943. @end itemize
  3944. @section stereowiden
  3945. This filter enhance the stereo effect by suppressing signal common to both
  3946. channels and by delaying the signal of left into right and vice versa,
  3947. thereby widening the stereo effect.
  3948. The filter accepts the following options:
  3949. @table @option
  3950. @item delay
  3951. Time in milliseconds of the delay of left signal into right and vice versa.
  3952. Default is 20 milliseconds.
  3953. @item feedback
  3954. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3955. effect of left signal in right output and vice versa which gives widening
  3956. effect. Default is 0.3.
  3957. @item crossfeed
  3958. Cross feed of left into right with inverted phase. This helps in suppressing
  3959. the mono. If the value is 1 it will cancel all the signal common to both
  3960. channels. Default is 0.3.
  3961. @item drymix
  3962. Set level of input signal of original channel. Default is 0.8.
  3963. @end table
  3964. @section superequalizer
  3965. Apply 18 band equalizer.
  3966. The filter accepts the following options:
  3967. @table @option
  3968. @item 1b
  3969. Set 65Hz band gain.
  3970. @item 2b
  3971. Set 92Hz band gain.
  3972. @item 3b
  3973. Set 131Hz band gain.
  3974. @item 4b
  3975. Set 185Hz band gain.
  3976. @item 5b
  3977. Set 262Hz band gain.
  3978. @item 6b
  3979. Set 370Hz band gain.
  3980. @item 7b
  3981. Set 523Hz band gain.
  3982. @item 8b
  3983. Set 740Hz band gain.
  3984. @item 9b
  3985. Set 1047Hz band gain.
  3986. @item 10b
  3987. Set 1480Hz band gain.
  3988. @item 11b
  3989. Set 2093Hz band gain.
  3990. @item 12b
  3991. Set 2960Hz band gain.
  3992. @item 13b
  3993. Set 4186Hz band gain.
  3994. @item 14b
  3995. Set 5920Hz band gain.
  3996. @item 15b
  3997. Set 8372Hz band gain.
  3998. @item 16b
  3999. Set 11840Hz band gain.
  4000. @item 17b
  4001. Set 16744Hz band gain.
  4002. @item 18b
  4003. Set 20000Hz band gain.
  4004. @end table
  4005. @section surround
  4006. Apply audio surround upmix filter.
  4007. This filter allows to produce multichannel output from audio stream.
  4008. The filter accepts the following options:
  4009. @table @option
  4010. @item chl_out
  4011. Set output channel layout. By default, this is @var{5.1}.
  4012. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4013. for the required syntax.
  4014. @item chl_in
  4015. Set input channel layout. By default, this is @var{stereo}.
  4016. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4017. for the required syntax.
  4018. @item level_in
  4019. Set input volume level. By default, this is @var{1}.
  4020. @item level_out
  4021. Set output volume level. By default, this is @var{1}.
  4022. @item lfe
  4023. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4024. @item lfe_low
  4025. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4026. @item lfe_high
  4027. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4028. @item lfe_mode
  4029. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4030. In @var{add} mode, LFE channel is created from input audio and added to output.
  4031. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4032. also all non-LFE output channels are subtracted with output LFE channel.
  4033. @item angle
  4034. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4035. Default is @var{90}.
  4036. @item fc_in
  4037. Set front center input volume. By default, this is @var{1}.
  4038. @item fc_out
  4039. Set front center output volume. By default, this is @var{1}.
  4040. @item fl_in
  4041. Set front left input volume. By default, this is @var{1}.
  4042. @item fl_out
  4043. Set front left output volume. By default, this is @var{1}.
  4044. @item fr_in
  4045. Set front right input volume. By default, this is @var{1}.
  4046. @item fr_out
  4047. Set front right output volume. By default, this is @var{1}.
  4048. @item sl_in
  4049. Set side left input volume. By default, this is @var{1}.
  4050. @item sl_out
  4051. Set side left output volume. By default, this is @var{1}.
  4052. @item sr_in
  4053. Set side right input volume. By default, this is @var{1}.
  4054. @item sr_out
  4055. Set side right output volume. By default, this is @var{1}.
  4056. @item bl_in
  4057. Set back left input volume. By default, this is @var{1}.
  4058. @item bl_out
  4059. Set back left output volume. By default, this is @var{1}.
  4060. @item br_in
  4061. Set back right input volume. By default, this is @var{1}.
  4062. @item br_out
  4063. Set back right output volume. By default, this is @var{1}.
  4064. @item bc_in
  4065. Set back center input volume. By default, this is @var{1}.
  4066. @item bc_out
  4067. Set back center output volume. By default, this is @var{1}.
  4068. @item lfe_in
  4069. Set LFE input volume. By default, this is @var{1}.
  4070. @item lfe_out
  4071. Set LFE output volume. By default, this is @var{1}.
  4072. @item allx
  4073. Set spread usage of stereo image across X axis for all channels.
  4074. @item ally
  4075. Set spread usage of stereo image across Y axis for all channels.
  4076. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4077. Set spread usage of stereo image across X axis for each channel.
  4078. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4079. Set spread usage of stereo image across Y axis for each channel.
  4080. @item win_size
  4081. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4082. @item win_func
  4083. Set window function.
  4084. It accepts the following values:
  4085. @table @samp
  4086. @item rect
  4087. @item bartlett
  4088. @item hann, hanning
  4089. @item hamming
  4090. @item blackman
  4091. @item welch
  4092. @item flattop
  4093. @item bharris
  4094. @item bnuttall
  4095. @item bhann
  4096. @item sine
  4097. @item nuttall
  4098. @item lanczos
  4099. @item gauss
  4100. @item tukey
  4101. @item dolph
  4102. @item cauchy
  4103. @item parzen
  4104. @item poisson
  4105. @item bohman
  4106. @end table
  4107. Default is @code{hann}.
  4108. @item overlap
  4109. Set window overlap. If set to 1, the recommended overlap for selected
  4110. window function will be picked. Default is @code{0.5}.
  4111. @end table
  4112. @section treble, highshelf
  4113. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4114. shelving filter with a response similar to that of a standard
  4115. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4116. The filter accepts the following options:
  4117. @table @option
  4118. @item gain, g
  4119. Give the gain at whichever is the lower of ~22 kHz and the
  4120. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4121. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4122. @item frequency, f
  4123. Set the filter's central frequency and so can be used
  4124. to extend or reduce the frequency range to be boosted or cut.
  4125. The default value is @code{3000} Hz.
  4126. @item width_type, t
  4127. Set method to specify band-width of filter.
  4128. @table @option
  4129. @item h
  4130. Hz
  4131. @item q
  4132. Q-Factor
  4133. @item o
  4134. octave
  4135. @item s
  4136. slope
  4137. @item k
  4138. kHz
  4139. @end table
  4140. @item width, w
  4141. Determine how steep is the filter's shelf transition.
  4142. @item mix, m
  4143. How much to use filtered signal in output. Default is 1.
  4144. Range is between 0 and 1.
  4145. @item channels, c
  4146. Specify which channels to filter, by default all available are filtered.
  4147. @end table
  4148. @subsection Commands
  4149. This filter supports the following commands:
  4150. @table @option
  4151. @item frequency, f
  4152. Change treble frequency.
  4153. Syntax for the command is : "@var{frequency}"
  4154. @item width_type, t
  4155. Change treble width_type.
  4156. Syntax for the command is : "@var{width_type}"
  4157. @item width, w
  4158. Change treble width.
  4159. Syntax for the command is : "@var{width}"
  4160. @item gain, g
  4161. Change treble gain.
  4162. Syntax for the command is : "@var{gain}"
  4163. @item mix, m
  4164. Change treble mix.
  4165. Syntax for the command is : "@var{mix}"
  4166. @end table
  4167. @section tremolo
  4168. Sinusoidal amplitude modulation.
  4169. The filter accepts the following options:
  4170. @table @option
  4171. @item f
  4172. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4173. (20 Hz or lower) will result in a tremolo effect.
  4174. This filter may also be used as a ring modulator by specifying
  4175. a modulation frequency higher than 20 Hz.
  4176. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4177. @item d
  4178. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4179. Default value is 0.5.
  4180. @end table
  4181. @section vibrato
  4182. Sinusoidal phase modulation.
  4183. The filter accepts the following options:
  4184. @table @option
  4185. @item f
  4186. Modulation frequency in Hertz.
  4187. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4188. @item d
  4189. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4190. Default value is 0.5.
  4191. @end table
  4192. @section volume
  4193. Adjust the input audio volume.
  4194. It accepts the following parameters:
  4195. @table @option
  4196. @item volume
  4197. Set audio volume expression.
  4198. Output values are clipped to the maximum value.
  4199. The output audio volume is given by the relation:
  4200. @example
  4201. @var{output_volume} = @var{volume} * @var{input_volume}
  4202. @end example
  4203. The default value for @var{volume} is "1.0".
  4204. @item precision
  4205. This parameter represents the mathematical precision.
  4206. It determines which input sample formats will be allowed, which affects the
  4207. precision of the volume scaling.
  4208. @table @option
  4209. @item fixed
  4210. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4211. @item float
  4212. 32-bit floating-point; this limits input sample format to FLT. (default)
  4213. @item double
  4214. 64-bit floating-point; this limits input sample format to DBL.
  4215. @end table
  4216. @item replaygain
  4217. Choose the behaviour on encountering ReplayGain side data in input frames.
  4218. @table @option
  4219. @item drop
  4220. Remove ReplayGain side data, ignoring its contents (the default).
  4221. @item ignore
  4222. Ignore ReplayGain side data, but leave it in the frame.
  4223. @item track
  4224. Prefer the track gain, if present.
  4225. @item album
  4226. Prefer the album gain, if present.
  4227. @end table
  4228. @item replaygain_preamp
  4229. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4230. Default value for @var{replaygain_preamp} is 0.0.
  4231. @item eval
  4232. Set when the volume expression is evaluated.
  4233. It accepts the following values:
  4234. @table @samp
  4235. @item once
  4236. only evaluate expression once during the filter initialization, or
  4237. when the @samp{volume} command is sent
  4238. @item frame
  4239. evaluate expression for each incoming frame
  4240. @end table
  4241. Default value is @samp{once}.
  4242. @end table
  4243. The volume expression can contain the following parameters.
  4244. @table @option
  4245. @item n
  4246. frame number (starting at zero)
  4247. @item nb_channels
  4248. number of channels
  4249. @item nb_consumed_samples
  4250. number of samples consumed by the filter
  4251. @item nb_samples
  4252. number of samples in the current frame
  4253. @item pos
  4254. original frame position in the file
  4255. @item pts
  4256. frame PTS
  4257. @item sample_rate
  4258. sample rate
  4259. @item startpts
  4260. PTS at start of stream
  4261. @item startt
  4262. time at start of stream
  4263. @item t
  4264. frame time
  4265. @item tb
  4266. timestamp timebase
  4267. @item volume
  4268. last set volume value
  4269. @end table
  4270. Note that when @option{eval} is set to @samp{once} only the
  4271. @var{sample_rate} and @var{tb} variables are available, all other
  4272. variables will evaluate to NAN.
  4273. @subsection Commands
  4274. This filter supports the following commands:
  4275. @table @option
  4276. @item volume
  4277. Modify the volume expression.
  4278. The command accepts the same syntax of the corresponding option.
  4279. If the specified expression is not valid, it is kept at its current
  4280. value.
  4281. @item replaygain_noclip
  4282. Prevent clipping by limiting the gain applied.
  4283. Default value for @var{replaygain_noclip} is 1.
  4284. @end table
  4285. @subsection Examples
  4286. @itemize
  4287. @item
  4288. Halve the input audio volume:
  4289. @example
  4290. volume=volume=0.5
  4291. volume=volume=1/2
  4292. volume=volume=-6.0206dB
  4293. @end example
  4294. In all the above example the named key for @option{volume} can be
  4295. omitted, for example like in:
  4296. @example
  4297. volume=0.5
  4298. @end example
  4299. @item
  4300. Increase input audio power by 6 decibels using fixed-point precision:
  4301. @example
  4302. volume=volume=6dB:precision=fixed
  4303. @end example
  4304. @item
  4305. Fade volume after time 10 with an annihilation period of 5 seconds:
  4306. @example
  4307. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4308. @end example
  4309. @end itemize
  4310. @section volumedetect
  4311. Detect the volume of the input video.
  4312. The filter has no parameters. The input is not modified. Statistics about
  4313. the volume will be printed in the log when the input stream end is reached.
  4314. In particular it will show the mean volume (root mean square), maximum
  4315. volume (on a per-sample basis), and the beginning of a histogram of the
  4316. registered volume values (from the maximum value to a cumulated 1/1000 of
  4317. the samples).
  4318. All volumes are in decibels relative to the maximum PCM value.
  4319. @subsection Examples
  4320. Here is an excerpt of the output:
  4321. @example
  4322. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4323. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4324. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4325. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4326. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4327. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4328. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4329. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4330. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4331. @end example
  4332. It means that:
  4333. @itemize
  4334. @item
  4335. The mean square energy is approximately -27 dB, or 10^-2.7.
  4336. @item
  4337. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4338. @item
  4339. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4340. @end itemize
  4341. In other words, raising the volume by +4 dB does not cause any clipping,
  4342. raising it by +5 dB causes clipping for 6 samples, etc.
  4343. @c man end AUDIO FILTERS
  4344. @chapter Audio Sources
  4345. @c man begin AUDIO SOURCES
  4346. Below is a description of the currently available audio sources.
  4347. @section abuffer
  4348. Buffer audio frames, and make them available to the filter chain.
  4349. This source is mainly intended for a programmatic use, in particular
  4350. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4351. It accepts the following parameters:
  4352. @table @option
  4353. @item time_base
  4354. The timebase which will be used for timestamps of submitted frames. It must be
  4355. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4356. @item sample_rate
  4357. The sample rate of the incoming audio buffers.
  4358. @item sample_fmt
  4359. The sample format of the incoming audio buffers.
  4360. Either a sample format name or its corresponding integer representation from
  4361. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4362. @item channel_layout
  4363. The channel layout of the incoming audio buffers.
  4364. Either a channel layout name from channel_layout_map in
  4365. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4366. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4367. @item channels
  4368. The number of channels of the incoming audio buffers.
  4369. If both @var{channels} and @var{channel_layout} are specified, then they
  4370. must be consistent.
  4371. @end table
  4372. @subsection Examples
  4373. @example
  4374. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4375. @end example
  4376. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4377. Since the sample format with name "s16p" corresponds to the number
  4378. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4379. equivalent to:
  4380. @example
  4381. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4382. @end example
  4383. @section aevalsrc
  4384. Generate an audio signal specified by an expression.
  4385. This source accepts in input one or more expressions (one for each
  4386. channel), which are evaluated and used to generate a corresponding
  4387. audio signal.
  4388. This source accepts the following options:
  4389. @table @option
  4390. @item exprs
  4391. Set the '|'-separated expressions list for each separate channel. In case the
  4392. @option{channel_layout} option is not specified, the selected channel layout
  4393. depends on the number of provided expressions. Otherwise the last
  4394. specified expression is applied to the remaining output channels.
  4395. @item channel_layout, c
  4396. Set the channel layout. The number of channels in the specified layout
  4397. must be equal to the number of specified expressions.
  4398. @item duration, d
  4399. Set the minimum duration of the sourced audio. See
  4400. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4401. for the accepted syntax.
  4402. Note that the resulting duration may be greater than the specified
  4403. duration, as the generated audio is always cut at the end of a
  4404. complete frame.
  4405. If not specified, or the expressed duration is negative, the audio is
  4406. supposed to be generated forever.
  4407. @item nb_samples, n
  4408. Set the number of samples per channel per each output frame,
  4409. default to 1024.
  4410. @item sample_rate, s
  4411. Specify the sample rate, default to 44100.
  4412. @end table
  4413. Each expression in @var{exprs} can contain the following constants:
  4414. @table @option
  4415. @item n
  4416. number of the evaluated sample, starting from 0
  4417. @item t
  4418. time of the evaluated sample expressed in seconds, starting from 0
  4419. @item s
  4420. sample rate
  4421. @end table
  4422. @subsection Examples
  4423. @itemize
  4424. @item
  4425. Generate silence:
  4426. @example
  4427. aevalsrc=0
  4428. @end example
  4429. @item
  4430. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4431. 8000 Hz:
  4432. @example
  4433. aevalsrc="sin(440*2*PI*t):s=8000"
  4434. @end example
  4435. @item
  4436. Generate a two channels signal, specify the channel layout (Front
  4437. Center + Back Center) explicitly:
  4438. @example
  4439. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4440. @end example
  4441. @item
  4442. Generate white noise:
  4443. @example
  4444. aevalsrc="-2+random(0)"
  4445. @end example
  4446. @item
  4447. Generate an amplitude modulated signal:
  4448. @example
  4449. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4450. @end example
  4451. @item
  4452. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4453. @example
  4454. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4455. @end example
  4456. @end itemize
  4457. @section anullsrc
  4458. The null audio source, return unprocessed audio frames. It is mainly useful
  4459. as a template and to be employed in analysis / debugging tools, or as
  4460. the source for filters which ignore the input data (for example the sox
  4461. synth filter).
  4462. This source accepts the following options:
  4463. @table @option
  4464. @item channel_layout, cl
  4465. Specifies the channel layout, and can be either an integer or a string
  4466. representing a channel layout. The default value of @var{channel_layout}
  4467. is "stereo".
  4468. Check the channel_layout_map definition in
  4469. @file{libavutil/channel_layout.c} for the mapping between strings and
  4470. channel layout values.
  4471. @item sample_rate, r
  4472. Specifies the sample rate, and defaults to 44100.
  4473. @item nb_samples, n
  4474. Set the number of samples per requested frames.
  4475. @end table
  4476. @subsection Examples
  4477. @itemize
  4478. @item
  4479. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4480. @example
  4481. anullsrc=r=48000:cl=4
  4482. @end example
  4483. @item
  4484. Do the same operation with a more obvious syntax:
  4485. @example
  4486. anullsrc=r=48000:cl=mono
  4487. @end example
  4488. @end itemize
  4489. All the parameters need to be explicitly defined.
  4490. @section flite
  4491. Synthesize a voice utterance using the libflite library.
  4492. To enable compilation of this filter you need to configure FFmpeg with
  4493. @code{--enable-libflite}.
  4494. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4495. The filter accepts the following options:
  4496. @table @option
  4497. @item list_voices
  4498. If set to 1, list the names of the available voices and exit
  4499. immediately. Default value is 0.
  4500. @item nb_samples, n
  4501. Set the maximum number of samples per frame. Default value is 512.
  4502. @item textfile
  4503. Set the filename containing the text to speak.
  4504. @item text
  4505. Set the text to speak.
  4506. @item voice, v
  4507. Set the voice to use for the speech synthesis. Default value is
  4508. @code{kal}. See also the @var{list_voices} option.
  4509. @end table
  4510. @subsection Examples
  4511. @itemize
  4512. @item
  4513. Read from file @file{speech.txt}, and synthesize the text using the
  4514. standard flite voice:
  4515. @example
  4516. flite=textfile=speech.txt
  4517. @end example
  4518. @item
  4519. Read the specified text selecting the @code{slt} voice:
  4520. @example
  4521. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4522. @end example
  4523. @item
  4524. Input text to ffmpeg:
  4525. @example
  4526. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4527. @end example
  4528. @item
  4529. Make @file{ffplay} speak the specified text, using @code{flite} and
  4530. the @code{lavfi} device:
  4531. @example
  4532. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4533. @end example
  4534. @end itemize
  4535. For more information about libflite, check:
  4536. @url{http://www.festvox.org/flite/}
  4537. @section anoisesrc
  4538. Generate a noise audio signal.
  4539. The filter accepts the following options:
  4540. @table @option
  4541. @item sample_rate, r
  4542. Specify the sample rate. Default value is 48000 Hz.
  4543. @item amplitude, a
  4544. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4545. is 1.0.
  4546. @item duration, d
  4547. Specify the duration of the generated audio stream. Not specifying this option
  4548. results in noise with an infinite length.
  4549. @item color, colour, c
  4550. Specify the color of noise. Available noise colors are white, pink, brown,
  4551. blue and violet. Default color is white.
  4552. @item seed, s
  4553. Specify a value used to seed the PRNG.
  4554. @item nb_samples, n
  4555. Set the number of samples per each output frame, default is 1024.
  4556. @end table
  4557. @subsection Examples
  4558. @itemize
  4559. @item
  4560. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4561. @example
  4562. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4563. @end example
  4564. @end itemize
  4565. @section hilbert
  4566. Generate odd-tap Hilbert transform FIR coefficients.
  4567. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4568. the signal by 90 degrees.
  4569. This is used in many matrix coding schemes and for analytic signal generation.
  4570. The process is often written as a multiplication by i (or j), the imaginary unit.
  4571. The filter accepts the following options:
  4572. @table @option
  4573. @item sample_rate, s
  4574. Set sample rate, default is 44100.
  4575. @item taps, t
  4576. Set length of FIR filter, default is 22051.
  4577. @item nb_samples, n
  4578. Set number of samples per each frame.
  4579. @item win_func, w
  4580. Set window function to be used when generating FIR coefficients.
  4581. @end table
  4582. @section sinc
  4583. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4584. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4585. The filter accepts the following options:
  4586. @table @option
  4587. @item sample_rate, r
  4588. Set sample rate, default is 44100.
  4589. @item nb_samples, n
  4590. Set number of samples per each frame. Default is 1024.
  4591. @item hp
  4592. Set high-pass frequency. Default is 0.
  4593. @item lp
  4594. Set low-pass frequency. Default is 0.
  4595. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4596. is higher than 0 then filter will create band-pass filter coefficients,
  4597. otherwise band-reject filter coefficients.
  4598. @item phase
  4599. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4600. @item beta
  4601. Set Kaiser window beta.
  4602. @item att
  4603. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4604. @item round
  4605. Enable rounding, by default is disabled.
  4606. @item hptaps
  4607. Set number of taps for high-pass filter.
  4608. @item lptaps
  4609. Set number of taps for low-pass filter.
  4610. @end table
  4611. @section sine
  4612. Generate an audio signal made of a sine wave with amplitude 1/8.
  4613. The audio signal is bit-exact.
  4614. The filter accepts the following options:
  4615. @table @option
  4616. @item frequency, f
  4617. Set the carrier frequency. Default is 440 Hz.
  4618. @item beep_factor, b
  4619. Enable a periodic beep every second with frequency @var{beep_factor} times
  4620. the carrier frequency. Default is 0, meaning the beep is disabled.
  4621. @item sample_rate, r
  4622. Specify the sample rate, default is 44100.
  4623. @item duration, d
  4624. Specify the duration of the generated audio stream.
  4625. @item samples_per_frame
  4626. Set the number of samples per output frame.
  4627. The expression can contain the following constants:
  4628. @table @option
  4629. @item n
  4630. The (sequential) number of the output audio frame, starting from 0.
  4631. @item pts
  4632. The PTS (Presentation TimeStamp) of the output audio frame,
  4633. expressed in @var{TB} units.
  4634. @item t
  4635. The PTS of the output audio frame, expressed in seconds.
  4636. @item TB
  4637. The timebase of the output audio frames.
  4638. @end table
  4639. Default is @code{1024}.
  4640. @end table
  4641. @subsection Examples
  4642. @itemize
  4643. @item
  4644. Generate a simple 440 Hz sine wave:
  4645. @example
  4646. sine
  4647. @end example
  4648. @item
  4649. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4650. @example
  4651. sine=220:4:d=5
  4652. sine=f=220:b=4:d=5
  4653. sine=frequency=220:beep_factor=4:duration=5
  4654. @end example
  4655. @item
  4656. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4657. pattern:
  4658. @example
  4659. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4660. @end example
  4661. @end itemize
  4662. @c man end AUDIO SOURCES
  4663. @chapter Audio Sinks
  4664. @c man begin AUDIO SINKS
  4665. Below is a description of the currently available audio sinks.
  4666. @section abuffersink
  4667. Buffer audio frames, and make them available to the end of filter chain.
  4668. This sink is mainly intended for programmatic use, in particular
  4669. through the interface defined in @file{libavfilter/buffersink.h}
  4670. or the options system.
  4671. It accepts a pointer to an AVABufferSinkContext structure, which
  4672. defines the incoming buffers' formats, to be passed as the opaque
  4673. parameter to @code{avfilter_init_filter} for initialization.
  4674. @section anullsink
  4675. Null audio sink; do absolutely nothing with the input audio. It is
  4676. mainly useful as a template and for use in analysis / debugging
  4677. tools.
  4678. @c man end AUDIO SINKS
  4679. @chapter Video Filters
  4680. @c man begin VIDEO FILTERS
  4681. When you configure your FFmpeg build, you can disable any of the
  4682. existing filters using @code{--disable-filters}.
  4683. The configure output will show the video filters included in your
  4684. build.
  4685. Below is a description of the currently available video filters.
  4686. @section addroi
  4687. Mark a region of interest in a video frame.
  4688. The frame data is passed through unchanged, but metadata is attached
  4689. to the frame indicating regions of interest which can affect the
  4690. behaviour of later encoding. Multiple regions can be marked by
  4691. applying the filter multiple times.
  4692. @table @option
  4693. @item x
  4694. Region distance in pixels from the left edge of the frame.
  4695. @item y
  4696. Region distance in pixels from the top edge of the frame.
  4697. @item w
  4698. Region width in pixels.
  4699. @item h
  4700. Region height in pixels.
  4701. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4702. and may contain the following variables:
  4703. @table @option
  4704. @item iw
  4705. Width of the input frame.
  4706. @item ih
  4707. Height of the input frame.
  4708. @end table
  4709. @item qoffset
  4710. Quantisation offset to apply within the region.
  4711. This must be a real value in the range -1 to +1. A value of zero
  4712. indicates no quality change. A negative value asks for better quality
  4713. (less quantisation), while a positive value asks for worse quality
  4714. (greater quantisation).
  4715. The range is calibrated so that the extreme values indicate the
  4716. largest possible offset - if the rest of the frame is encoded with the
  4717. worst possible quality, an offset of -1 indicates that this region
  4718. should be encoded with the best possible quality anyway. Intermediate
  4719. values are then interpolated in some codec-dependent way.
  4720. For example, in 10-bit H.264 the quantisation parameter varies between
  4721. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4722. this region should be encoded with a QP around one-tenth of the full
  4723. range better than the rest of the frame. So, if most of the frame
  4724. were to be encoded with a QP of around 30, this region would get a QP
  4725. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4726. An extreme value of -1 would indicate that this region should be
  4727. encoded with the best possible quality regardless of the treatment of
  4728. the rest of the frame - that is, should be encoded at a QP of -12.
  4729. @item clear
  4730. If set to true, remove any existing regions of interest marked on the
  4731. frame before adding the new one.
  4732. @end table
  4733. @subsection Examples
  4734. @itemize
  4735. @item
  4736. Mark the centre quarter of the frame as interesting.
  4737. @example
  4738. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4739. @end example
  4740. @item
  4741. Mark the 100-pixel-wide region on the left edge of the frame as very
  4742. uninteresting (to be encoded at much lower quality than the rest of
  4743. the frame).
  4744. @example
  4745. addroi=0:0:100:ih:+1/5
  4746. @end example
  4747. @end itemize
  4748. @section alphaextract
  4749. Extract the alpha component from the input as a grayscale video. This
  4750. is especially useful with the @var{alphamerge} filter.
  4751. @section alphamerge
  4752. Add or replace the alpha component of the primary input with the
  4753. grayscale value of a second input. This is intended for use with
  4754. @var{alphaextract} to allow the transmission or storage of frame
  4755. sequences that have alpha in a format that doesn't support an alpha
  4756. channel.
  4757. For example, to reconstruct full frames from a normal YUV-encoded video
  4758. and a separate video created with @var{alphaextract}, you might use:
  4759. @example
  4760. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4761. @end example
  4762. Since this filter is designed for reconstruction, it operates on frame
  4763. sequences without considering timestamps, and terminates when either
  4764. input reaches end of stream. This will cause problems if your encoding
  4765. pipeline drops frames. If you're trying to apply an image as an
  4766. overlay to a video stream, consider the @var{overlay} filter instead.
  4767. @section amplify
  4768. Amplify differences between current pixel and pixels of adjacent frames in
  4769. same pixel location.
  4770. This filter accepts the following options:
  4771. @table @option
  4772. @item radius
  4773. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4774. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4775. @item factor
  4776. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4777. @item threshold
  4778. Set threshold for difference amplification. Any difference greater or equal to
  4779. this value will not alter source pixel. Default is 10.
  4780. Allowed range is from 0 to 65535.
  4781. @item tolerance
  4782. Set tolerance for difference amplification. Any difference lower to
  4783. this value will not alter source pixel. Default is 0.
  4784. Allowed range is from 0 to 65535.
  4785. @item low
  4786. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4787. This option controls maximum possible value that will decrease source pixel value.
  4788. @item high
  4789. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4790. This option controls maximum possible value that will increase source pixel value.
  4791. @item planes
  4792. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4793. @end table
  4794. @subsection Commands
  4795. This filter supports the following @ref{commands} that corresponds to option of same name:
  4796. @table @option
  4797. @item factor
  4798. @item threshold
  4799. @item tolerance
  4800. @item low
  4801. @item high
  4802. @item planes
  4803. @end table
  4804. @section ass
  4805. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4806. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4807. Substation Alpha) subtitles files.
  4808. This filter accepts the following option in addition to the common options from
  4809. the @ref{subtitles} filter:
  4810. @table @option
  4811. @item shaping
  4812. Set the shaping engine
  4813. Available values are:
  4814. @table @samp
  4815. @item auto
  4816. The default libass shaping engine, which is the best available.
  4817. @item simple
  4818. Fast, font-agnostic shaper that can do only substitutions
  4819. @item complex
  4820. Slower shaper using OpenType for substitutions and positioning
  4821. @end table
  4822. The default is @code{auto}.
  4823. @end table
  4824. @section atadenoise
  4825. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4826. The filter accepts the following options:
  4827. @table @option
  4828. @item 0a
  4829. Set threshold A for 1st plane. Default is 0.02.
  4830. Valid range is 0 to 0.3.
  4831. @item 0b
  4832. Set threshold B for 1st plane. Default is 0.04.
  4833. Valid range is 0 to 5.
  4834. @item 1a
  4835. Set threshold A for 2nd plane. Default is 0.02.
  4836. Valid range is 0 to 0.3.
  4837. @item 1b
  4838. Set threshold B for 2nd plane. Default is 0.04.
  4839. Valid range is 0 to 5.
  4840. @item 2a
  4841. Set threshold A for 3rd plane. Default is 0.02.
  4842. Valid range is 0 to 0.3.
  4843. @item 2b
  4844. Set threshold B for 3rd plane. Default is 0.04.
  4845. Valid range is 0 to 5.
  4846. Threshold A is designed to react on abrupt changes in the input signal and
  4847. threshold B is designed to react on continuous changes in the input signal.
  4848. @item s
  4849. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4850. number in range [5, 129].
  4851. @item p
  4852. Set what planes of frame filter will use for averaging. Default is all.
  4853. @item a
  4854. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  4855. Alternatively can be set to @code{s} serial.
  4856. Parallel can be faster then serial, while other way around is never true.
  4857. Parallel will abort early on first change being greater then thresholds, while serial
  4858. will continue processing other side of frames if they are equal or bellow thresholds.
  4859. @end table
  4860. @subsection Commands
  4861. This filter supports same @ref{commands} as options except option @code{s}.
  4862. The command accepts the same syntax of the corresponding option.
  4863. @section avgblur
  4864. Apply average blur filter.
  4865. The filter accepts the following options:
  4866. @table @option
  4867. @item sizeX
  4868. Set horizontal radius size.
  4869. @item planes
  4870. Set which planes to filter. By default all planes are filtered.
  4871. @item sizeY
  4872. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4873. Default is @code{0}.
  4874. @end table
  4875. @subsection Commands
  4876. This filter supports same commands as options.
  4877. The command accepts the same syntax of the corresponding option.
  4878. If the specified expression is not valid, it is kept at its current
  4879. value.
  4880. @section bbox
  4881. Compute the bounding box for the non-black pixels in the input frame
  4882. luminance plane.
  4883. This filter computes the bounding box containing all the pixels with a
  4884. luminance value greater than the minimum allowed value.
  4885. The parameters describing the bounding box are printed on the filter
  4886. log.
  4887. The filter accepts the following option:
  4888. @table @option
  4889. @item min_val
  4890. Set the minimal luminance value. Default is @code{16}.
  4891. @end table
  4892. @section bilateral
  4893. Apply bilateral filter, spatial smoothing while preserving edges.
  4894. The filter accepts the following options:
  4895. @table @option
  4896. @item sigmaS
  4897. Set sigma of gaussian function to calculate spatial weight.
  4898. Allowed range is 0 to 10. Default is 0.1.
  4899. @item sigmaR
  4900. Set sigma of gaussian function to calculate range weight.
  4901. Allowed range is 0 to 1. Default is 0.1.
  4902. @item planes
  4903. Set planes to filter. Default is first only.
  4904. @end table
  4905. @section bitplanenoise
  4906. Show and measure bit plane noise.
  4907. The filter accepts the following options:
  4908. @table @option
  4909. @item bitplane
  4910. Set which plane to analyze. Default is @code{1}.
  4911. @item filter
  4912. Filter out noisy pixels from @code{bitplane} set above.
  4913. Default is disabled.
  4914. @end table
  4915. @section blackdetect
  4916. Detect video intervals that are (almost) completely black. Can be
  4917. useful to detect chapter transitions, commercials, or invalid
  4918. recordings. Output lines contains the time for the start, end and
  4919. duration of the detected black interval expressed in seconds.
  4920. In order to display the output lines, you need to set the loglevel at
  4921. least to the AV_LOG_INFO value.
  4922. The filter accepts the following options:
  4923. @table @option
  4924. @item black_min_duration, d
  4925. Set the minimum detected black duration expressed in seconds. It must
  4926. be a non-negative floating point number.
  4927. Default value is 2.0.
  4928. @item picture_black_ratio_th, pic_th
  4929. Set the threshold for considering a picture "black".
  4930. Express the minimum value for the ratio:
  4931. @example
  4932. @var{nb_black_pixels} / @var{nb_pixels}
  4933. @end example
  4934. for which a picture is considered black.
  4935. Default value is 0.98.
  4936. @item pixel_black_th, pix_th
  4937. Set the threshold for considering a pixel "black".
  4938. The threshold expresses the maximum pixel luminance value for which a
  4939. pixel is considered "black". The provided value is scaled according to
  4940. the following equation:
  4941. @example
  4942. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4943. @end example
  4944. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4945. the input video format, the range is [0-255] for YUV full-range
  4946. formats and [16-235] for YUV non full-range formats.
  4947. Default value is 0.10.
  4948. @end table
  4949. The following example sets the maximum pixel threshold to the minimum
  4950. value, and detects only black intervals of 2 or more seconds:
  4951. @example
  4952. blackdetect=d=2:pix_th=0.00
  4953. @end example
  4954. @section blackframe
  4955. Detect frames that are (almost) completely black. Can be useful to
  4956. detect chapter transitions or commercials. Output lines consist of
  4957. the frame number of the detected frame, the percentage of blackness,
  4958. the position in the file if known or -1 and the timestamp in seconds.
  4959. In order to display the output lines, you need to set the loglevel at
  4960. least to the AV_LOG_INFO value.
  4961. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4962. The value represents the percentage of pixels in the picture that
  4963. are below the threshold value.
  4964. It accepts the following parameters:
  4965. @table @option
  4966. @item amount
  4967. The percentage of the pixels that have to be below the threshold; it defaults to
  4968. @code{98}.
  4969. @item threshold, thresh
  4970. The threshold below which a pixel value is considered black; it defaults to
  4971. @code{32}.
  4972. @end table
  4973. @section blend, tblend
  4974. Blend two video frames into each other.
  4975. The @code{blend} filter takes two input streams and outputs one
  4976. stream, the first input is the "top" layer and second input is
  4977. "bottom" layer. By default, the output terminates when the longest input terminates.
  4978. The @code{tblend} (time blend) filter takes two consecutive frames
  4979. from one single stream, and outputs the result obtained by blending
  4980. the new frame on top of the old frame.
  4981. A description of the accepted options follows.
  4982. @table @option
  4983. @item c0_mode
  4984. @item c1_mode
  4985. @item c2_mode
  4986. @item c3_mode
  4987. @item all_mode
  4988. Set blend mode for specific pixel component or all pixel components in case
  4989. of @var{all_mode}. Default value is @code{normal}.
  4990. Available values for component modes are:
  4991. @table @samp
  4992. @item addition
  4993. @item grainmerge
  4994. @item and
  4995. @item average
  4996. @item burn
  4997. @item darken
  4998. @item difference
  4999. @item grainextract
  5000. @item divide
  5001. @item dodge
  5002. @item freeze
  5003. @item exclusion
  5004. @item extremity
  5005. @item glow
  5006. @item hardlight
  5007. @item hardmix
  5008. @item heat
  5009. @item lighten
  5010. @item linearlight
  5011. @item multiply
  5012. @item multiply128
  5013. @item negation
  5014. @item normal
  5015. @item or
  5016. @item overlay
  5017. @item phoenix
  5018. @item pinlight
  5019. @item reflect
  5020. @item screen
  5021. @item softlight
  5022. @item subtract
  5023. @item vividlight
  5024. @item xor
  5025. @end table
  5026. @item c0_opacity
  5027. @item c1_opacity
  5028. @item c2_opacity
  5029. @item c3_opacity
  5030. @item all_opacity
  5031. Set blend opacity for specific pixel component or all pixel components in case
  5032. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5033. @item c0_expr
  5034. @item c1_expr
  5035. @item c2_expr
  5036. @item c3_expr
  5037. @item all_expr
  5038. Set blend expression for specific pixel component or all pixel components in case
  5039. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5040. The expressions can use the following variables:
  5041. @table @option
  5042. @item N
  5043. The sequential number of the filtered frame, starting from @code{0}.
  5044. @item X
  5045. @item Y
  5046. the coordinates of the current sample
  5047. @item W
  5048. @item H
  5049. the width and height of currently filtered plane
  5050. @item SW
  5051. @item SH
  5052. Width and height scale for the plane being filtered. It is the
  5053. ratio between the dimensions of the current plane to the luma plane,
  5054. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5055. the luma plane and @code{0.5,0.5} for the chroma planes.
  5056. @item T
  5057. Time of the current frame, expressed in seconds.
  5058. @item TOP, A
  5059. Value of pixel component at current location for first video frame (top layer).
  5060. @item BOTTOM, B
  5061. Value of pixel component at current location for second video frame (bottom layer).
  5062. @end table
  5063. @end table
  5064. The @code{blend} filter also supports the @ref{framesync} options.
  5065. @subsection Examples
  5066. @itemize
  5067. @item
  5068. Apply transition from bottom layer to top layer in first 10 seconds:
  5069. @example
  5070. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5071. @end example
  5072. @item
  5073. Apply linear horizontal transition from top layer to bottom layer:
  5074. @example
  5075. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5076. @end example
  5077. @item
  5078. Apply 1x1 checkerboard effect:
  5079. @example
  5080. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5081. @end example
  5082. @item
  5083. Apply uncover left effect:
  5084. @example
  5085. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5086. @end example
  5087. @item
  5088. Apply uncover down effect:
  5089. @example
  5090. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5091. @end example
  5092. @item
  5093. Apply uncover up-left effect:
  5094. @example
  5095. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5096. @end example
  5097. @item
  5098. Split diagonally video and shows top and bottom layer on each side:
  5099. @example
  5100. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5101. @end example
  5102. @item
  5103. Display differences between the current and the previous frame:
  5104. @example
  5105. tblend=all_mode=grainextract
  5106. @end example
  5107. @end itemize
  5108. @section bm3d
  5109. Denoise frames using Block-Matching 3D algorithm.
  5110. The filter accepts the following options.
  5111. @table @option
  5112. @item sigma
  5113. Set denoising strength. Default value is 1.
  5114. Allowed range is from 0 to 999.9.
  5115. The denoising algorithm is very sensitive to sigma, so adjust it
  5116. according to the source.
  5117. @item block
  5118. Set local patch size. This sets dimensions in 2D.
  5119. @item bstep
  5120. Set sliding step for processing blocks. Default value is 4.
  5121. Allowed range is from 1 to 64.
  5122. Smaller values allows processing more reference blocks and is slower.
  5123. @item group
  5124. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5125. When set to 1, no block matching is done. Larger values allows more blocks
  5126. in single group.
  5127. Allowed range is from 1 to 256.
  5128. @item range
  5129. Set radius for search block matching. Default is 9.
  5130. Allowed range is from 1 to INT32_MAX.
  5131. @item mstep
  5132. Set step between two search locations for block matching. Default is 1.
  5133. Allowed range is from 1 to 64. Smaller is slower.
  5134. @item thmse
  5135. Set threshold of mean square error for block matching. Valid range is 0 to
  5136. INT32_MAX.
  5137. @item hdthr
  5138. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5139. Larger values results in stronger hard-thresholding filtering in frequency
  5140. domain.
  5141. @item estim
  5142. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5143. Default is @code{basic}.
  5144. @item ref
  5145. If enabled, filter will use 2nd stream for block matching.
  5146. Default is disabled for @code{basic} value of @var{estim} option,
  5147. and always enabled if value of @var{estim} is @code{final}.
  5148. @item planes
  5149. Set planes to filter. Default is all available except alpha.
  5150. @end table
  5151. @subsection Examples
  5152. @itemize
  5153. @item
  5154. Basic filtering with bm3d:
  5155. @example
  5156. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5157. @end example
  5158. @item
  5159. Same as above, but filtering only luma:
  5160. @example
  5161. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5162. @end example
  5163. @item
  5164. Same as above, but with both estimation modes:
  5165. @example
  5166. 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
  5167. @end example
  5168. @item
  5169. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5170. @example
  5171. 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
  5172. @end example
  5173. @end itemize
  5174. @section boxblur
  5175. Apply a boxblur algorithm to the input video.
  5176. It accepts the following parameters:
  5177. @table @option
  5178. @item luma_radius, lr
  5179. @item luma_power, lp
  5180. @item chroma_radius, cr
  5181. @item chroma_power, cp
  5182. @item alpha_radius, ar
  5183. @item alpha_power, ap
  5184. @end table
  5185. A description of the accepted options follows.
  5186. @table @option
  5187. @item luma_radius, lr
  5188. @item chroma_radius, cr
  5189. @item alpha_radius, ar
  5190. Set an expression for the box radius in pixels used for blurring the
  5191. corresponding input plane.
  5192. The radius value must be a non-negative number, and must not be
  5193. greater than the value of the expression @code{min(w,h)/2} for the
  5194. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5195. planes.
  5196. Default value for @option{luma_radius} is "2". If not specified,
  5197. @option{chroma_radius} and @option{alpha_radius} default to the
  5198. corresponding value set for @option{luma_radius}.
  5199. The expressions can contain the following constants:
  5200. @table @option
  5201. @item w
  5202. @item h
  5203. The input width and height in pixels.
  5204. @item cw
  5205. @item ch
  5206. The input chroma image width and height in pixels.
  5207. @item hsub
  5208. @item vsub
  5209. The horizontal and vertical chroma subsample values. For example, for the
  5210. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5211. @end table
  5212. @item luma_power, lp
  5213. @item chroma_power, cp
  5214. @item alpha_power, ap
  5215. Specify how many times the boxblur filter is applied to the
  5216. corresponding plane.
  5217. Default value for @option{luma_power} is 2. If not specified,
  5218. @option{chroma_power} and @option{alpha_power} default to the
  5219. corresponding value set for @option{luma_power}.
  5220. A value of 0 will disable the effect.
  5221. @end table
  5222. @subsection Examples
  5223. @itemize
  5224. @item
  5225. Apply a boxblur filter with the luma, chroma, and alpha radii
  5226. set to 2:
  5227. @example
  5228. boxblur=luma_radius=2:luma_power=1
  5229. boxblur=2:1
  5230. @end example
  5231. @item
  5232. Set the luma radius to 2, and alpha and chroma radius to 0:
  5233. @example
  5234. boxblur=2:1:cr=0:ar=0
  5235. @end example
  5236. @item
  5237. Set the luma and chroma radii to a fraction of the video dimension:
  5238. @example
  5239. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5240. @end example
  5241. @end itemize
  5242. @section bwdif
  5243. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5244. Deinterlacing Filter").
  5245. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5246. interpolation algorithms.
  5247. It accepts the following parameters:
  5248. @table @option
  5249. @item mode
  5250. The interlacing mode to adopt. It accepts one of the following values:
  5251. @table @option
  5252. @item 0, send_frame
  5253. Output one frame for each frame.
  5254. @item 1, send_field
  5255. Output one frame for each field.
  5256. @end table
  5257. The default value is @code{send_field}.
  5258. @item parity
  5259. The picture field parity assumed for the input interlaced video. It accepts one
  5260. of the following values:
  5261. @table @option
  5262. @item 0, tff
  5263. Assume the top field is first.
  5264. @item 1, bff
  5265. Assume the bottom field is first.
  5266. @item -1, auto
  5267. Enable automatic detection of field parity.
  5268. @end table
  5269. The default value is @code{auto}.
  5270. If the interlacing is unknown or the decoder does not export this information,
  5271. top field first will be assumed.
  5272. @item deint
  5273. Specify which frames to deinterlace. Accepts one of the following
  5274. values:
  5275. @table @option
  5276. @item 0, all
  5277. Deinterlace all frames.
  5278. @item 1, interlaced
  5279. Only deinterlace frames marked as interlaced.
  5280. @end table
  5281. The default value is @code{all}.
  5282. @end table
  5283. @section chromahold
  5284. Remove all color information for all colors except for certain one.
  5285. The filter accepts the following options:
  5286. @table @option
  5287. @item color
  5288. The color which will not be replaced with neutral chroma.
  5289. @item similarity
  5290. Similarity percentage with the above color.
  5291. 0.01 matches only the exact key color, while 1.0 matches everything.
  5292. @item blend
  5293. Blend percentage.
  5294. 0.0 makes pixels either fully gray, or not gray at all.
  5295. Higher values result in more preserved color.
  5296. @item yuv
  5297. Signals that the color passed is already in YUV instead of RGB.
  5298. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5299. This can be used to pass exact YUV values as hexadecimal numbers.
  5300. @end table
  5301. @section chromakey
  5302. YUV colorspace color/chroma keying.
  5303. The filter accepts the following options:
  5304. @table @option
  5305. @item color
  5306. The color which will be replaced with transparency.
  5307. @item similarity
  5308. Similarity percentage with the key color.
  5309. 0.01 matches only the exact key color, while 1.0 matches everything.
  5310. @item blend
  5311. Blend percentage.
  5312. 0.0 makes pixels either fully transparent, or not transparent at all.
  5313. Higher values result in semi-transparent pixels, with a higher transparency
  5314. the more similar the pixels color is to the key color.
  5315. @item yuv
  5316. Signals that the color passed is already in YUV instead of RGB.
  5317. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5318. This can be used to pass exact YUV values as hexadecimal numbers.
  5319. @end table
  5320. @subsection Examples
  5321. @itemize
  5322. @item
  5323. Make every green pixel in the input image transparent:
  5324. @example
  5325. ffmpeg -i input.png -vf chromakey=green out.png
  5326. @end example
  5327. @item
  5328. Overlay a greenscreen-video on top of a static black background.
  5329. @example
  5330. 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
  5331. @end example
  5332. @end itemize
  5333. @section chromashift
  5334. Shift chroma pixels horizontally and/or vertically.
  5335. The filter accepts the following options:
  5336. @table @option
  5337. @item cbh
  5338. Set amount to shift chroma-blue horizontally.
  5339. @item cbv
  5340. Set amount to shift chroma-blue vertically.
  5341. @item crh
  5342. Set amount to shift chroma-red horizontally.
  5343. @item crv
  5344. Set amount to shift chroma-red vertically.
  5345. @item edge
  5346. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5347. @end table
  5348. @section ciescope
  5349. Display CIE color diagram with pixels overlaid onto it.
  5350. The filter accepts the following options:
  5351. @table @option
  5352. @item system
  5353. Set color system.
  5354. @table @samp
  5355. @item ntsc, 470m
  5356. @item ebu, 470bg
  5357. @item smpte
  5358. @item 240m
  5359. @item apple
  5360. @item widergb
  5361. @item cie1931
  5362. @item rec709, hdtv
  5363. @item uhdtv, rec2020
  5364. @item dcip3
  5365. @end table
  5366. @item cie
  5367. Set CIE system.
  5368. @table @samp
  5369. @item xyy
  5370. @item ucs
  5371. @item luv
  5372. @end table
  5373. @item gamuts
  5374. Set what gamuts to draw.
  5375. See @code{system} option for available values.
  5376. @item size, s
  5377. Set ciescope size, by default set to 512.
  5378. @item intensity, i
  5379. Set intensity used to map input pixel values to CIE diagram.
  5380. @item contrast
  5381. Set contrast used to draw tongue colors that are out of active color system gamut.
  5382. @item corrgamma
  5383. Correct gamma displayed on scope, by default enabled.
  5384. @item showwhite
  5385. Show white point on CIE diagram, by default disabled.
  5386. @item gamma
  5387. Set input gamma. Used only with XYZ input color space.
  5388. @end table
  5389. @section codecview
  5390. Visualize information exported by some codecs.
  5391. Some codecs can export information through frames using side-data or other
  5392. means. For example, some MPEG based codecs export motion vectors through the
  5393. @var{export_mvs} flag in the codec @option{flags2} option.
  5394. The filter accepts the following option:
  5395. @table @option
  5396. @item mv
  5397. Set motion vectors to visualize.
  5398. Available flags for @var{mv} are:
  5399. @table @samp
  5400. @item pf
  5401. forward predicted MVs of P-frames
  5402. @item bf
  5403. forward predicted MVs of B-frames
  5404. @item bb
  5405. backward predicted MVs of B-frames
  5406. @end table
  5407. @item qp
  5408. Display quantization parameters using the chroma planes.
  5409. @item mv_type, mvt
  5410. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5411. Available flags for @var{mv_type} are:
  5412. @table @samp
  5413. @item fp
  5414. forward predicted MVs
  5415. @item bp
  5416. backward predicted MVs
  5417. @end table
  5418. @item frame_type, ft
  5419. Set frame type to visualize motion vectors of.
  5420. Available flags for @var{frame_type} are:
  5421. @table @samp
  5422. @item if
  5423. intra-coded frames (I-frames)
  5424. @item pf
  5425. predicted frames (P-frames)
  5426. @item bf
  5427. bi-directionally predicted frames (B-frames)
  5428. @end table
  5429. @end table
  5430. @subsection Examples
  5431. @itemize
  5432. @item
  5433. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5434. @example
  5435. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5436. @end example
  5437. @item
  5438. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5439. @example
  5440. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5441. @end example
  5442. @end itemize
  5443. @section colorbalance
  5444. Modify intensity of primary colors (red, green and blue) of input frames.
  5445. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5446. regions for the red-cyan, green-magenta or blue-yellow balance.
  5447. A positive adjustment value shifts the balance towards the primary color, a negative
  5448. value towards the complementary color.
  5449. The filter accepts the following options:
  5450. @table @option
  5451. @item rs
  5452. @item gs
  5453. @item bs
  5454. Adjust red, green and blue shadows (darkest pixels).
  5455. @item rm
  5456. @item gm
  5457. @item bm
  5458. Adjust red, green and blue midtones (medium pixels).
  5459. @item rh
  5460. @item gh
  5461. @item bh
  5462. Adjust red, green and blue highlights (brightest pixels).
  5463. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5464. @end table
  5465. @subsection Examples
  5466. @itemize
  5467. @item
  5468. Add red color cast to shadows:
  5469. @example
  5470. colorbalance=rs=.3
  5471. @end example
  5472. @end itemize
  5473. @section colorchannelmixer
  5474. Adjust video input frames by re-mixing color channels.
  5475. This filter modifies a color channel by adding the values associated to
  5476. the other channels of the same pixels. For example if the value to
  5477. modify is red, the output value will be:
  5478. @example
  5479. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5480. @end example
  5481. The filter accepts the following options:
  5482. @table @option
  5483. @item rr
  5484. @item rg
  5485. @item rb
  5486. @item ra
  5487. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5488. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5489. @item gr
  5490. @item gg
  5491. @item gb
  5492. @item ga
  5493. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5494. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5495. @item br
  5496. @item bg
  5497. @item bb
  5498. @item ba
  5499. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5500. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5501. @item ar
  5502. @item ag
  5503. @item ab
  5504. @item aa
  5505. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5506. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5507. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5508. @end table
  5509. @subsection Examples
  5510. @itemize
  5511. @item
  5512. Convert source to grayscale:
  5513. @example
  5514. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5515. @end example
  5516. @item
  5517. Simulate sepia tones:
  5518. @example
  5519. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5520. @end example
  5521. @end itemize
  5522. @subsection Commands
  5523. This filter supports the all above options as @ref{commands}.
  5524. @section colorkey
  5525. RGB colorspace color keying.
  5526. The filter accepts the following options:
  5527. @table @option
  5528. @item color
  5529. The color which will be replaced with transparency.
  5530. @item similarity
  5531. Similarity percentage with the key color.
  5532. 0.01 matches only the exact key color, while 1.0 matches everything.
  5533. @item blend
  5534. Blend percentage.
  5535. 0.0 makes pixels either fully transparent, or not transparent at all.
  5536. Higher values result in semi-transparent pixels, with a higher transparency
  5537. the more similar the pixels color is to the key color.
  5538. @end table
  5539. @subsection Examples
  5540. @itemize
  5541. @item
  5542. Make every green pixel in the input image transparent:
  5543. @example
  5544. ffmpeg -i input.png -vf colorkey=green out.png
  5545. @end example
  5546. @item
  5547. Overlay a greenscreen-video on top of a static background image.
  5548. @example
  5549. 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
  5550. @end example
  5551. @end itemize
  5552. @section colorhold
  5553. Remove all color information for all RGB colors except for certain one.
  5554. The filter accepts the following options:
  5555. @table @option
  5556. @item color
  5557. The color which will not be replaced with neutral gray.
  5558. @item similarity
  5559. Similarity percentage with the above color.
  5560. 0.01 matches only the exact key color, while 1.0 matches everything.
  5561. @item blend
  5562. Blend percentage. 0.0 makes pixels fully gray.
  5563. Higher values result in more preserved color.
  5564. @end table
  5565. @section colorlevels
  5566. Adjust video input frames using levels.
  5567. The filter accepts the following options:
  5568. @table @option
  5569. @item rimin
  5570. @item gimin
  5571. @item bimin
  5572. @item aimin
  5573. Adjust red, green, blue and alpha input black point.
  5574. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5575. @item rimax
  5576. @item gimax
  5577. @item bimax
  5578. @item aimax
  5579. Adjust red, green, blue and alpha input white point.
  5580. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5581. Input levels are used to lighten highlights (bright tones), darken shadows
  5582. (dark tones), change the balance of bright and dark tones.
  5583. @item romin
  5584. @item gomin
  5585. @item bomin
  5586. @item aomin
  5587. Adjust red, green, blue and alpha output black point.
  5588. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5589. @item romax
  5590. @item gomax
  5591. @item bomax
  5592. @item aomax
  5593. Adjust red, green, blue and alpha output white point.
  5594. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5595. Output levels allows manual selection of a constrained output level range.
  5596. @end table
  5597. @subsection Examples
  5598. @itemize
  5599. @item
  5600. Make video output darker:
  5601. @example
  5602. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5603. @end example
  5604. @item
  5605. Increase contrast:
  5606. @example
  5607. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5608. @end example
  5609. @item
  5610. Make video output lighter:
  5611. @example
  5612. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5613. @end example
  5614. @item
  5615. Increase brightness:
  5616. @example
  5617. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5618. @end example
  5619. @end itemize
  5620. @section colormatrix
  5621. Convert color matrix.
  5622. The filter accepts the following options:
  5623. @table @option
  5624. @item src
  5625. @item dst
  5626. Specify the source and destination color matrix. Both values must be
  5627. specified.
  5628. The accepted values are:
  5629. @table @samp
  5630. @item bt709
  5631. BT.709
  5632. @item fcc
  5633. FCC
  5634. @item bt601
  5635. BT.601
  5636. @item bt470
  5637. BT.470
  5638. @item bt470bg
  5639. BT.470BG
  5640. @item smpte170m
  5641. SMPTE-170M
  5642. @item smpte240m
  5643. SMPTE-240M
  5644. @item bt2020
  5645. BT.2020
  5646. @end table
  5647. @end table
  5648. For example to convert from BT.601 to SMPTE-240M, use the command:
  5649. @example
  5650. colormatrix=bt601:smpte240m
  5651. @end example
  5652. @section colorspace
  5653. Convert colorspace, transfer characteristics or color primaries.
  5654. Input video needs to have an even size.
  5655. The filter accepts the following options:
  5656. @table @option
  5657. @anchor{all}
  5658. @item all
  5659. Specify all color properties at once.
  5660. The accepted values are:
  5661. @table @samp
  5662. @item bt470m
  5663. BT.470M
  5664. @item bt470bg
  5665. BT.470BG
  5666. @item bt601-6-525
  5667. BT.601-6 525
  5668. @item bt601-6-625
  5669. BT.601-6 625
  5670. @item bt709
  5671. BT.709
  5672. @item smpte170m
  5673. SMPTE-170M
  5674. @item smpte240m
  5675. SMPTE-240M
  5676. @item bt2020
  5677. BT.2020
  5678. @end table
  5679. @anchor{space}
  5680. @item space
  5681. Specify output colorspace.
  5682. The accepted values are:
  5683. @table @samp
  5684. @item bt709
  5685. BT.709
  5686. @item fcc
  5687. FCC
  5688. @item bt470bg
  5689. BT.470BG or BT.601-6 625
  5690. @item smpte170m
  5691. SMPTE-170M or BT.601-6 525
  5692. @item smpte240m
  5693. SMPTE-240M
  5694. @item ycgco
  5695. YCgCo
  5696. @item bt2020ncl
  5697. BT.2020 with non-constant luminance
  5698. @end table
  5699. @anchor{trc}
  5700. @item trc
  5701. Specify output transfer characteristics.
  5702. The accepted values are:
  5703. @table @samp
  5704. @item bt709
  5705. BT.709
  5706. @item bt470m
  5707. BT.470M
  5708. @item bt470bg
  5709. BT.470BG
  5710. @item gamma22
  5711. Constant gamma of 2.2
  5712. @item gamma28
  5713. Constant gamma of 2.8
  5714. @item smpte170m
  5715. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5716. @item smpte240m
  5717. SMPTE-240M
  5718. @item srgb
  5719. SRGB
  5720. @item iec61966-2-1
  5721. iec61966-2-1
  5722. @item iec61966-2-4
  5723. iec61966-2-4
  5724. @item xvycc
  5725. xvycc
  5726. @item bt2020-10
  5727. BT.2020 for 10-bits content
  5728. @item bt2020-12
  5729. BT.2020 for 12-bits content
  5730. @end table
  5731. @anchor{primaries}
  5732. @item primaries
  5733. Specify output color primaries.
  5734. The accepted values are:
  5735. @table @samp
  5736. @item bt709
  5737. BT.709
  5738. @item bt470m
  5739. BT.470M
  5740. @item bt470bg
  5741. BT.470BG or BT.601-6 625
  5742. @item smpte170m
  5743. SMPTE-170M or BT.601-6 525
  5744. @item smpte240m
  5745. SMPTE-240M
  5746. @item film
  5747. film
  5748. @item smpte431
  5749. SMPTE-431
  5750. @item smpte432
  5751. SMPTE-432
  5752. @item bt2020
  5753. BT.2020
  5754. @item jedec-p22
  5755. JEDEC P22 phosphors
  5756. @end table
  5757. @anchor{range}
  5758. @item range
  5759. Specify output color range.
  5760. The accepted values are:
  5761. @table @samp
  5762. @item tv
  5763. TV (restricted) range
  5764. @item mpeg
  5765. MPEG (restricted) range
  5766. @item pc
  5767. PC (full) range
  5768. @item jpeg
  5769. JPEG (full) range
  5770. @end table
  5771. @item format
  5772. Specify output color format.
  5773. The accepted values are:
  5774. @table @samp
  5775. @item yuv420p
  5776. YUV 4:2:0 planar 8-bits
  5777. @item yuv420p10
  5778. YUV 4:2:0 planar 10-bits
  5779. @item yuv420p12
  5780. YUV 4:2:0 planar 12-bits
  5781. @item yuv422p
  5782. YUV 4:2:2 planar 8-bits
  5783. @item yuv422p10
  5784. YUV 4:2:2 planar 10-bits
  5785. @item yuv422p12
  5786. YUV 4:2:2 planar 12-bits
  5787. @item yuv444p
  5788. YUV 4:4:4 planar 8-bits
  5789. @item yuv444p10
  5790. YUV 4:4:4 planar 10-bits
  5791. @item yuv444p12
  5792. YUV 4:4:4 planar 12-bits
  5793. @end table
  5794. @item fast
  5795. Do a fast conversion, which skips gamma/primary correction. This will take
  5796. significantly less CPU, but will be mathematically incorrect. To get output
  5797. compatible with that produced by the colormatrix filter, use fast=1.
  5798. @item dither
  5799. Specify dithering mode.
  5800. The accepted values are:
  5801. @table @samp
  5802. @item none
  5803. No dithering
  5804. @item fsb
  5805. Floyd-Steinberg dithering
  5806. @end table
  5807. @item wpadapt
  5808. Whitepoint adaptation mode.
  5809. The accepted values are:
  5810. @table @samp
  5811. @item bradford
  5812. Bradford whitepoint adaptation
  5813. @item vonkries
  5814. von Kries whitepoint adaptation
  5815. @item identity
  5816. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5817. @end table
  5818. @item iall
  5819. Override all input properties at once. Same accepted values as @ref{all}.
  5820. @item ispace
  5821. Override input colorspace. Same accepted values as @ref{space}.
  5822. @item iprimaries
  5823. Override input color primaries. Same accepted values as @ref{primaries}.
  5824. @item itrc
  5825. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5826. @item irange
  5827. Override input color range. Same accepted values as @ref{range}.
  5828. @end table
  5829. The filter converts the transfer characteristics, color space and color
  5830. primaries to the specified user values. The output value, if not specified,
  5831. is set to a default value based on the "all" property. If that property is
  5832. also not specified, the filter will log an error. The output color range and
  5833. format default to the same value as the input color range and format. The
  5834. input transfer characteristics, color space, color primaries and color range
  5835. should be set on the input data. If any of these are missing, the filter will
  5836. log an error and no conversion will take place.
  5837. For example to convert the input to SMPTE-240M, use the command:
  5838. @example
  5839. colorspace=smpte240m
  5840. @end example
  5841. @section convolution
  5842. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5843. The filter accepts the following options:
  5844. @table @option
  5845. @item 0m
  5846. @item 1m
  5847. @item 2m
  5848. @item 3m
  5849. Set matrix for each plane.
  5850. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5851. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5852. @item 0rdiv
  5853. @item 1rdiv
  5854. @item 2rdiv
  5855. @item 3rdiv
  5856. Set multiplier for calculated value for each plane.
  5857. If unset or 0, it will be sum of all matrix elements.
  5858. @item 0bias
  5859. @item 1bias
  5860. @item 2bias
  5861. @item 3bias
  5862. Set bias for each plane. This value is added to the result of the multiplication.
  5863. Useful for making the overall image brighter or darker. Default is 0.0.
  5864. @item 0mode
  5865. @item 1mode
  5866. @item 2mode
  5867. @item 3mode
  5868. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5869. Default is @var{square}.
  5870. @end table
  5871. @subsection Examples
  5872. @itemize
  5873. @item
  5874. Apply sharpen:
  5875. @example
  5876. 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"
  5877. @end example
  5878. @item
  5879. Apply blur:
  5880. @example
  5881. 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"
  5882. @end example
  5883. @item
  5884. Apply edge enhance:
  5885. @example
  5886. 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"
  5887. @end example
  5888. @item
  5889. Apply edge detect:
  5890. @example
  5891. 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"
  5892. @end example
  5893. @item
  5894. Apply laplacian edge detector which includes diagonals:
  5895. @example
  5896. 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"
  5897. @end example
  5898. @item
  5899. Apply emboss:
  5900. @example
  5901. 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"
  5902. @end example
  5903. @end itemize
  5904. @section convolve
  5905. Apply 2D convolution of video stream in frequency domain using second stream
  5906. as impulse.
  5907. The filter accepts the following options:
  5908. @table @option
  5909. @item planes
  5910. Set which planes to process.
  5911. @item impulse
  5912. Set which impulse video frames will be processed, can be @var{first}
  5913. or @var{all}. Default is @var{all}.
  5914. @end table
  5915. The @code{convolve} filter also supports the @ref{framesync} options.
  5916. @section copy
  5917. Copy the input video source unchanged to the output. This is mainly useful for
  5918. testing purposes.
  5919. @anchor{coreimage}
  5920. @section coreimage
  5921. Video filtering on GPU using Apple's CoreImage API on OSX.
  5922. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5923. processed by video hardware. However, software-based OpenGL implementations
  5924. exist which means there is no guarantee for hardware processing. It depends on
  5925. the respective OSX.
  5926. There are many filters and image generators provided by Apple that come with a
  5927. large variety of options. The filter has to be referenced by its name along
  5928. with its options.
  5929. The coreimage filter accepts the following options:
  5930. @table @option
  5931. @item list_filters
  5932. List all available filters and generators along with all their respective
  5933. options as well as possible minimum and maximum values along with the default
  5934. values.
  5935. @example
  5936. list_filters=true
  5937. @end example
  5938. @item filter
  5939. Specify all filters by their respective name and options.
  5940. Use @var{list_filters} to determine all valid filter names and options.
  5941. Numerical options are specified by a float value and are automatically clamped
  5942. to their respective value range. Vector and color options have to be specified
  5943. by a list of space separated float values. Character escaping has to be done.
  5944. A special option name @code{default} is available to use default options for a
  5945. filter.
  5946. It is required to specify either @code{default} or at least one of the filter options.
  5947. All omitted options are used with their default values.
  5948. The syntax of the filter string is as follows:
  5949. @example
  5950. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5951. @end example
  5952. @item output_rect
  5953. Specify a rectangle where the output of the filter chain is copied into the
  5954. input image. It is given by a list of space separated float values:
  5955. @example
  5956. output_rect=x\ y\ width\ height
  5957. @end example
  5958. If not given, the output rectangle equals the dimensions of the input image.
  5959. The output rectangle is automatically cropped at the borders of the input
  5960. image. Negative values are valid for each component.
  5961. @example
  5962. output_rect=25\ 25\ 100\ 100
  5963. @end example
  5964. @end table
  5965. Several filters can be chained for successive processing without GPU-HOST
  5966. transfers allowing for fast processing of complex filter chains.
  5967. Currently, only filters with zero (generators) or exactly one (filters) input
  5968. image and one output image are supported. Also, transition filters are not yet
  5969. usable as intended.
  5970. Some filters generate output images with additional padding depending on the
  5971. respective filter kernel. The padding is automatically removed to ensure the
  5972. filter output has the same size as the input image.
  5973. For image generators, the size of the output image is determined by the
  5974. previous output image of the filter chain or the input image of the whole
  5975. filterchain, respectively. The generators do not use the pixel information of
  5976. this image to generate their output. However, the generated output is
  5977. blended onto this image, resulting in partial or complete coverage of the
  5978. output image.
  5979. The @ref{coreimagesrc} video source can be used for generating input images
  5980. which are directly fed into the filter chain. By using it, providing input
  5981. images by another video source or an input video is not required.
  5982. @subsection Examples
  5983. @itemize
  5984. @item
  5985. List all filters available:
  5986. @example
  5987. coreimage=list_filters=true
  5988. @end example
  5989. @item
  5990. Use the CIBoxBlur filter with default options to blur an image:
  5991. @example
  5992. coreimage=filter=CIBoxBlur@@default
  5993. @end example
  5994. @item
  5995. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5996. its center at 100x100 and a radius of 50 pixels:
  5997. @example
  5998. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5999. @end example
  6000. @item
  6001. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6002. given as complete and escaped command-line for Apple's standard bash shell:
  6003. @example
  6004. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6005. @end example
  6006. @end itemize
  6007. @section cover_rect
  6008. Cover a rectangular object
  6009. It accepts the following options:
  6010. @table @option
  6011. @item cover
  6012. Filepath of the optional cover image, needs to be in yuv420.
  6013. @item mode
  6014. Set covering mode.
  6015. It accepts the following values:
  6016. @table @samp
  6017. @item cover
  6018. cover it by the supplied image
  6019. @item blur
  6020. cover it by interpolating the surrounding pixels
  6021. @end table
  6022. Default value is @var{blur}.
  6023. @end table
  6024. @subsection Examples
  6025. @itemize
  6026. @item
  6027. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6028. @example
  6029. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6030. @end example
  6031. @end itemize
  6032. @section crop
  6033. Crop the input video to given dimensions.
  6034. It accepts the following parameters:
  6035. @table @option
  6036. @item w, out_w
  6037. The width of the output video. It defaults to @code{iw}.
  6038. This expression is evaluated only once during the filter
  6039. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6040. @item h, out_h
  6041. The height of the output video. It defaults to @code{ih}.
  6042. This expression is evaluated only once during the filter
  6043. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6044. @item x
  6045. The horizontal position, in the input video, of the left edge of the output
  6046. video. It defaults to @code{(in_w-out_w)/2}.
  6047. This expression is evaluated per-frame.
  6048. @item y
  6049. The vertical position, in the input video, of the top edge of the output video.
  6050. It defaults to @code{(in_h-out_h)/2}.
  6051. This expression is evaluated per-frame.
  6052. @item keep_aspect
  6053. If set to 1 will force the output display aspect ratio
  6054. to be the same of the input, by changing the output sample aspect
  6055. ratio. It defaults to 0.
  6056. @item exact
  6057. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6058. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6059. It defaults to 0.
  6060. @end table
  6061. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6062. expressions containing the following constants:
  6063. @table @option
  6064. @item x
  6065. @item y
  6066. The computed values for @var{x} and @var{y}. They are evaluated for
  6067. each new frame.
  6068. @item in_w
  6069. @item in_h
  6070. The input width and height.
  6071. @item iw
  6072. @item ih
  6073. These are the same as @var{in_w} and @var{in_h}.
  6074. @item out_w
  6075. @item out_h
  6076. The output (cropped) width and height.
  6077. @item ow
  6078. @item oh
  6079. These are the same as @var{out_w} and @var{out_h}.
  6080. @item a
  6081. same as @var{iw} / @var{ih}
  6082. @item sar
  6083. input sample aspect ratio
  6084. @item dar
  6085. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6086. @item hsub
  6087. @item vsub
  6088. horizontal and vertical chroma subsample values. For example for the
  6089. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6090. @item n
  6091. The number of the input frame, starting from 0.
  6092. @item pos
  6093. the position in the file of the input frame, NAN if unknown
  6094. @item t
  6095. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6096. @end table
  6097. The expression for @var{out_w} may depend on the value of @var{out_h},
  6098. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6099. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6100. evaluated after @var{out_w} and @var{out_h}.
  6101. The @var{x} and @var{y} parameters specify the expressions for the
  6102. position of the top-left corner of the output (non-cropped) area. They
  6103. are evaluated for each frame. If the evaluated value is not valid, it
  6104. is approximated to the nearest valid value.
  6105. The expression for @var{x} may depend on @var{y}, and the expression
  6106. for @var{y} may depend on @var{x}.
  6107. @subsection Examples
  6108. @itemize
  6109. @item
  6110. Crop area with size 100x100 at position (12,34).
  6111. @example
  6112. crop=100:100:12:34
  6113. @end example
  6114. Using named options, the example above becomes:
  6115. @example
  6116. crop=w=100:h=100:x=12:y=34
  6117. @end example
  6118. @item
  6119. Crop the central input area with size 100x100:
  6120. @example
  6121. crop=100:100
  6122. @end example
  6123. @item
  6124. Crop the central input area with size 2/3 of the input video:
  6125. @example
  6126. crop=2/3*in_w:2/3*in_h
  6127. @end example
  6128. @item
  6129. Crop the input video central square:
  6130. @example
  6131. crop=out_w=in_h
  6132. crop=in_h
  6133. @end example
  6134. @item
  6135. Delimit the rectangle with the top-left corner placed at position
  6136. 100:100 and the right-bottom corner corresponding to the right-bottom
  6137. corner of the input image.
  6138. @example
  6139. crop=in_w-100:in_h-100:100:100
  6140. @end example
  6141. @item
  6142. Crop 10 pixels from the left and right borders, and 20 pixels from
  6143. the top and bottom borders
  6144. @example
  6145. crop=in_w-2*10:in_h-2*20
  6146. @end example
  6147. @item
  6148. Keep only the bottom right quarter of the input image:
  6149. @example
  6150. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6151. @end example
  6152. @item
  6153. Crop height for getting Greek harmony:
  6154. @example
  6155. crop=in_w:1/PHI*in_w
  6156. @end example
  6157. @item
  6158. Apply trembling effect:
  6159. @example
  6160. 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)
  6161. @end example
  6162. @item
  6163. Apply erratic camera effect depending on timestamp:
  6164. @example
  6165. 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)"
  6166. @end example
  6167. @item
  6168. Set x depending on the value of y:
  6169. @example
  6170. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6171. @end example
  6172. @end itemize
  6173. @subsection Commands
  6174. This filter supports the following commands:
  6175. @table @option
  6176. @item w, out_w
  6177. @item h, out_h
  6178. @item x
  6179. @item y
  6180. Set width/height of the output video and the horizontal/vertical position
  6181. in the input video.
  6182. The command accepts the same syntax of the corresponding option.
  6183. If the specified expression is not valid, it is kept at its current
  6184. value.
  6185. @end table
  6186. @section cropdetect
  6187. Auto-detect the crop size.
  6188. It calculates the necessary cropping parameters and prints the
  6189. recommended parameters via the logging system. The detected dimensions
  6190. correspond to the non-black area of the input video.
  6191. It accepts the following parameters:
  6192. @table @option
  6193. @item limit
  6194. Set higher black value threshold, which can be optionally specified
  6195. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6196. value greater to the set value is considered non-black. It defaults to 24.
  6197. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6198. on the bitdepth of the pixel format.
  6199. @item round
  6200. The value which the width/height should be divisible by. It defaults to
  6201. 16. The offset is automatically adjusted to center the video. Use 2 to
  6202. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6203. encoding to most video codecs.
  6204. @item reset_count, reset
  6205. Set the counter that determines after how many frames cropdetect will
  6206. reset the previously detected largest video area and start over to
  6207. detect the current optimal crop area. Default value is 0.
  6208. This can be useful when channel logos distort the video area. 0
  6209. indicates 'never reset', and returns the largest area encountered during
  6210. playback.
  6211. @end table
  6212. @anchor{cue}
  6213. @section cue
  6214. Delay video filtering until a given wallclock timestamp. The filter first
  6215. passes on @option{preroll} amount of frames, then it buffers at most
  6216. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6217. it forwards the buffered frames and also any subsequent frames coming in its
  6218. input.
  6219. The filter can be used synchronize the output of multiple ffmpeg processes for
  6220. realtime output devices like decklink. By putting the delay in the filtering
  6221. chain and pre-buffering frames the process can pass on data to output almost
  6222. immediately after the target wallclock timestamp is reached.
  6223. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6224. some use cases.
  6225. @table @option
  6226. @item cue
  6227. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6228. @item preroll
  6229. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6230. @item buffer
  6231. The maximum duration of content to buffer before waiting for the cue expressed
  6232. in seconds. Default is 0.
  6233. @end table
  6234. @anchor{curves}
  6235. @section curves
  6236. Apply color adjustments using curves.
  6237. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6238. component (red, green and blue) has its values defined by @var{N} key points
  6239. tied from each other using a smooth curve. The x-axis represents the pixel
  6240. values from the input frame, and the y-axis the new pixel values to be set for
  6241. the output frame.
  6242. By default, a component curve is defined by the two points @var{(0;0)} and
  6243. @var{(1;1)}. This creates a straight line where each original pixel value is
  6244. "adjusted" to its own value, which means no change to the image.
  6245. The filter allows you to redefine these two points and add some more. A new
  6246. curve (using a natural cubic spline interpolation) will be define to pass
  6247. smoothly through all these new coordinates. The new defined points needs to be
  6248. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6249. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6250. the vector spaces, the values will be clipped accordingly.
  6251. The filter accepts the following options:
  6252. @table @option
  6253. @item preset
  6254. Select one of the available color presets. This option can be used in addition
  6255. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6256. options takes priority on the preset values.
  6257. Available presets are:
  6258. @table @samp
  6259. @item none
  6260. @item color_negative
  6261. @item cross_process
  6262. @item darker
  6263. @item increase_contrast
  6264. @item lighter
  6265. @item linear_contrast
  6266. @item medium_contrast
  6267. @item negative
  6268. @item strong_contrast
  6269. @item vintage
  6270. @end table
  6271. Default is @code{none}.
  6272. @item master, m
  6273. Set the master key points. These points will define a second pass mapping. It
  6274. is sometimes called a "luminance" or "value" mapping. It can be used with
  6275. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6276. post-processing LUT.
  6277. @item red, r
  6278. Set the key points for the red component.
  6279. @item green, g
  6280. Set the key points for the green component.
  6281. @item blue, b
  6282. Set the key points for the blue component.
  6283. @item all
  6284. Set the key points for all components (not including master).
  6285. Can be used in addition to the other key points component
  6286. options. In this case, the unset component(s) will fallback on this
  6287. @option{all} setting.
  6288. @item psfile
  6289. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6290. @item plot
  6291. Save Gnuplot script of the curves in specified file.
  6292. @end table
  6293. To avoid some filtergraph syntax conflicts, each key points list need to be
  6294. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6295. @subsection Examples
  6296. @itemize
  6297. @item
  6298. Increase slightly the middle level of blue:
  6299. @example
  6300. curves=blue='0/0 0.5/0.58 1/1'
  6301. @end example
  6302. @item
  6303. Vintage effect:
  6304. @example
  6305. 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'
  6306. @end example
  6307. Here we obtain the following coordinates for each components:
  6308. @table @var
  6309. @item red
  6310. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6311. @item green
  6312. @code{(0;0) (0.50;0.48) (1;1)}
  6313. @item blue
  6314. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6315. @end table
  6316. @item
  6317. The previous example can also be achieved with the associated built-in preset:
  6318. @example
  6319. curves=preset=vintage
  6320. @end example
  6321. @item
  6322. Or simply:
  6323. @example
  6324. curves=vintage
  6325. @end example
  6326. @item
  6327. Use a Photoshop preset and redefine the points of the green component:
  6328. @example
  6329. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6330. @end example
  6331. @item
  6332. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6333. and @command{gnuplot}:
  6334. @example
  6335. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6336. gnuplot -p /tmp/curves.plt
  6337. @end example
  6338. @end itemize
  6339. @section datascope
  6340. Video data analysis filter.
  6341. This filter shows hexadecimal pixel values of part of video.
  6342. The filter accepts the following options:
  6343. @table @option
  6344. @item size, s
  6345. Set output video size.
  6346. @item x
  6347. Set x offset from where to pick pixels.
  6348. @item y
  6349. Set y offset from where to pick pixels.
  6350. @item mode
  6351. Set scope mode, can be one of the following:
  6352. @table @samp
  6353. @item mono
  6354. Draw hexadecimal pixel values with white color on black background.
  6355. @item color
  6356. Draw hexadecimal pixel values with input video pixel color on black
  6357. background.
  6358. @item color2
  6359. Draw hexadecimal pixel values on color background picked from input video,
  6360. the text color is picked in such way so its always visible.
  6361. @end table
  6362. @item axis
  6363. Draw rows and columns numbers on left and top of video.
  6364. @item opacity
  6365. Set background opacity.
  6366. @end table
  6367. @section dctdnoiz
  6368. Denoise frames using 2D DCT (frequency domain filtering).
  6369. This filter is not designed for real time.
  6370. The filter accepts the following options:
  6371. @table @option
  6372. @item sigma, s
  6373. Set the noise sigma constant.
  6374. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6375. coefficient (absolute value) below this threshold with be dropped.
  6376. If you need a more advanced filtering, see @option{expr}.
  6377. Default is @code{0}.
  6378. @item overlap
  6379. Set number overlapping pixels for each block. Since the filter can be slow, you
  6380. may want to reduce this value, at the cost of a less effective filter and the
  6381. risk of various artefacts.
  6382. If the overlapping value doesn't permit processing the whole input width or
  6383. height, a warning will be displayed and according borders won't be denoised.
  6384. Default value is @var{blocksize}-1, which is the best possible setting.
  6385. @item expr, e
  6386. Set the coefficient factor expression.
  6387. For each coefficient of a DCT block, this expression will be evaluated as a
  6388. multiplier value for the coefficient.
  6389. If this is option is set, the @option{sigma} option will be ignored.
  6390. The absolute value of the coefficient can be accessed through the @var{c}
  6391. variable.
  6392. @item n
  6393. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6394. @var{blocksize}, which is the width and height of the processed blocks.
  6395. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6396. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6397. on the speed processing. Also, a larger block size does not necessarily means a
  6398. better de-noising.
  6399. @end table
  6400. @subsection Examples
  6401. Apply a denoise with a @option{sigma} of @code{4.5}:
  6402. @example
  6403. dctdnoiz=4.5
  6404. @end example
  6405. The same operation can be achieved using the expression system:
  6406. @example
  6407. dctdnoiz=e='gte(c, 4.5*3)'
  6408. @end example
  6409. Violent denoise using a block size of @code{16x16}:
  6410. @example
  6411. dctdnoiz=15:n=4
  6412. @end example
  6413. @section deband
  6414. Remove banding artifacts from input video.
  6415. It works by replacing banded pixels with average value of referenced pixels.
  6416. The filter accepts the following options:
  6417. @table @option
  6418. @item 1thr
  6419. @item 2thr
  6420. @item 3thr
  6421. @item 4thr
  6422. Set banding detection threshold for each plane. Default is 0.02.
  6423. Valid range is 0.00003 to 0.5.
  6424. If difference between current pixel and reference pixel is less than threshold,
  6425. it will be considered as banded.
  6426. @item range, r
  6427. Banding detection range in pixels. Default is 16. If positive, random number
  6428. in range 0 to set value will be used. If negative, exact absolute value
  6429. will be used.
  6430. The range defines square of four pixels around current pixel.
  6431. @item direction, d
  6432. Set direction in radians from which four pixel will be compared. If positive,
  6433. random direction from 0 to set direction will be picked. If negative, exact of
  6434. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6435. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6436. column.
  6437. @item blur, b
  6438. If enabled, current pixel is compared with average value of all four
  6439. surrounding pixels. The default is enabled. If disabled current pixel is
  6440. compared with all four surrounding pixels. The pixel is considered banded
  6441. if only all four differences with surrounding pixels are less than threshold.
  6442. @item coupling, c
  6443. If enabled, current pixel is changed if and only if all pixel components are banded,
  6444. e.g. banding detection threshold is triggered for all color components.
  6445. The default is disabled.
  6446. @end table
  6447. @section deblock
  6448. Remove blocking artifacts from input video.
  6449. The filter accepts the following options:
  6450. @table @option
  6451. @item filter
  6452. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6453. This controls what kind of deblocking is applied.
  6454. @item block
  6455. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6456. @item alpha
  6457. @item beta
  6458. @item gamma
  6459. @item delta
  6460. Set blocking detection thresholds. Allowed range is 0 to 1.
  6461. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6462. Using higher threshold gives more deblocking strength.
  6463. Setting @var{alpha} controls threshold detection at exact edge of block.
  6464. Remaining options controls threshold detection near the edge. Each one for
  6465. below/above or left/right. Setting any of those to @var{0} disables
  6466. deblocking.
  6467. @item planes
  6468. Set planes to filter. Default is to filter all available planes.
  6469. @end table
  6470. @subsection Examples
  6471. @itemize
  6472. @item
  6473. Deblock using weak filter and block size of 4 pixels.
  6474. @example
  6475. deblock=filter=weak:block=4
  6476. @end example
  6477. @item
  6478. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6479. deblocking more edges.
  6480. @example
  6481. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6482. @end example
  6483. @item
  6484. Similar as above, but filter only first plane.
  6485. @example
  6486. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6487. @end example
  6488. @item
  6489. Similar as above, but filter only second and third plane.
  6490. @example
  6491. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6492. @end example
  6493. @end itemize
  6494. @anchor{decimate}
  6495. @section decimate
  6496. Drop duplicated frames at regular intervals.
  6497. The filter accepts the following options:
  6498. @table @option
  6499. @item cycle
  6500. Set the number of frames from which one will be dropped. Setting this to
  6501. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6502. Default is @code{5}.
  6503. @item dupthresh
  6504. Set the threshold for duplicate detection. If the difference metric for a frame
  6505. is less than or equal to this value, then it is declared as duplicate. Default
  6506. is @code{1.1}
  6507. @item scthresh
  6508. Set scene change threshold. Default is @code{15}.
  6509. @item blockx
  6510. @item blocky
  6511. Set the size of the x and y-axis blocks used during metric calculations.
  6512. Larger blocks give better noise suppression, but also give worse detection of
  6513. small movements. Must be a power of two. Default is @code{32}.
  6514. @item ppsrc
  6515. Mark main input as a pre-processed input and activate clean source input
  6516. stream. This allows the input to be pre-processed with various filters to help
  6517. the metrics calculation while keeping the frame selection lossless. When set to
  6518. @code{1}, the first stream is for the pre-processed input, and the second
  6519. stream is the clean source from where the kept frames are chosen. Default is
  6520. @code{0}.
  6521. @item chroma
  6522. Set whether or not chroma is considered in the metric calculations. Default is
  6523. @code{1}.
  6524. @end table
  6525. @section deconvolve
  6526. Apply 2D deconvolution of video stream in frequency domain using second stream
  6527. as impulse.
  6528. The filter accepts the following options:
  6529. @table @option
  6530. @item planes
  6531. Set which planes to process.
  6532. @item impulse
  6533. Set which impulse video frames will be processed, can be @var{first}
  6534. or @var{all}. Default is @var{all}.
  6535. @item noise
  6536. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6537. and height are not same and not power of 2 or if stream prior to convolving
  6538. had noise.
  6539. @end table
  6540. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6541. @section dedot
  6542. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6543. It accepts the following options:
  6544. @table @option
  6545. @item m
  6546. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6547. @var{rainbows} for cross-color reduction.
  6548. @item lt
  6549. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6550. @item tl
  6551. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6552. @item tc
  6553. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6554. @item ct
  6555. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6556. @end table
  6557. @section deflate
  6558. Apply deflate effect to the video.
  6559. This filter replaces the pixel by the local(3x3) average by taking into account
  6560. only values lower than the pixel.
  6561. It accepts the following options:
  6562. @table @option
  6563. @item threshold0
  6564. @item threshold1
  6565. @item threshold2
  6566. @item threshold3
  6567. Limit the maximum change for each plane, default is 65535.
  6568. If 0, plane will remain unchanged.
  6569. @end table
  6570. @section deflicker
  6571. Remove temporal frame luminance variations.
  6572. It accepts the following options:
  6573. @table @option
  6574. @item size, s
  6575. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6576. @item mode, m
  6577. Set averaging mode to smooth temporal luminance variations.
  6578. Available values are:
  6579. @table @samp
  6580. @item am
  6581. Arithmetic mean
  6582. @item gm
  6583. Geometric mean
  6584. @item hm
  6585. Harmonic mean
  6586. @item qm
  6587. Quadratic mean
  6588. @item cm
  6589. Cubic mean
  6590. @item pm
  6591. Power mean
  6592. @item median
  6593. Median
  6594. @end table
  6595. @item bypass
  6596. Do not actually modify frame. Useful when one only wants metadata.
  6597. @end table
  6598. @section dejudder
  6599. Remove judder produced by partially interlaced telecined content.
  6600. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6601. source was partially telecined content then the output of @code{pullup,dejudder}
  6602. will have a variable frame rate. May change the recorded frame rate of the
  6603. container. Aside from that change, this filter will not affect constant frame
  6604. rate video.
  6605. The option available in this filter is:
  6606. @table @option
  6607. @item cycle
  6608. Specify the length of the window over which the judder repeats.
  6609. Accepts any integer greater than 1. Useful values are:
  6610. @table @samp
  6611. @item 4
  6612. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6613. @item 5
  6614. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6615. @item 20
  6616. If a mixture of the two.
  6617. @end table
  6618. The default is @samp{4}.
  6619. @end table
  6620. @section delogo
  6621. Suppress a TV station logo by a simple interpolation of the surrounding
  6622. pixels. Just set a rectangle covering the logo and watch it disappear
  6623. (and sometimes something even uglier appear - your mileage may vary).
  6624. It accepts the following parameters:
  6625. @table @option
  6626. @item x
  6627. @item y
  6628. Specify the top left corner coordinates of the logo. They must be
  6629. specified.
  6630. @item w
  6631. @item h
  6632. Specify the width and height of the logo to clear. They must be
  6633. specified.
  6634. @item band, t
  6635. Specify the thickness of the fuzzy edge of the rectangle (added to
  6636. @var{w} and @var{h}). The default value is 1. This option is
  6637. deprecated, setting higher values should no longer be necessary and
  6638. is not recommended.
  6639. @item show
  6640. When set to 1, a green rectangle is drawn on the screen to simplify
  6641. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6642. The default value is 0.
  6643. The rectangle is drawn on the outermost pixels which will be (partly)
  6644. replaced with interpolated values. The values of the next pixels
  6645. immediately outside this rectangle in each direction will be used to
  6646. compute the interpolated pixel values inside the rectangle.
  6647. @end table
  6648. @subsection Examples
  6649. @itemize
  6650. @item
  6651. Set a rectangle covering the area with top left corner coordinates 0,0
  6652. and size 100x77, and a band of size 10:
  6653. @example
  6654. delogo=x=0:y=0:w=100:h=77:band=10
  6655. @end example
  6656. @end itemize
  6657. @section derain
  6658. Remove the rain in the input image/video by applying the derain methods based on
  6659. convolutional neural networks. Supported models:
  6660. @itemize
  6661. @item
  6662. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6663. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6664. @end itemize
  6665. Training as well as model generation scripts are provided in
  6666. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6667. Native model files (.model) can be generated from TensorFlow model
  6668. files (.pb) by using tools/python/convert.py
  6669. The filter accepts the following options:
  6670. @table @option
  6671. @item filter_type
  6672. Specify which filter to use. This option accepts the following values:
  6673. @table @samp
  6674. @item derain
  6675. Derain filter. To conduct derain filter, you need to use a derain model.
  6676. @item dehaze
  6677. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  6678. @end table
  6679. Default value is @samp{derain}.
  6680. @item dnn_backend
  6681. Specify which DNN backend to use for model loading and execution. This option accepts
  6682. the following values:
  6683. @table @samp
  6684. @item native
  6685. Native implementation of DNN loading and execution.
  6686. @item tensorflow
  6687. TensorFlow backend. To enable this backend you
  6688. need to install the TensorFlow for C library (see
  6689. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6690. @code{--enable-libtensorflow}
  6691. @end table
  6692. Default value is @samp{native}.
  6693. @item model
  6694. Set path to model file specifying network architecture and its parameters.
  6695. Note that different backends use different file formats. TensorFlow and native
  6696. backend can load files for only its format.
  6697. @end table
  6698. @section deshake
  6699. Attempt to fix small changes in horizontal and/or vertical shift. This
  6700. filter helps remove camera shake from hand-holding a camera, bumping a
  6701. tripod, moving on a vehicle, etc.
  6702. The filter accepts the following options:
  6703. @table @option
  6704. @item x
  6705. @item y
  6706. @item w
  6707. @item h
  6708. Specify a rectangular area where to limit the search for motion
  6709. vectors.
  6710. If desired the search for motion vectors can be limited to a
  6711. rectangular area of the frame defined by its top left corner, width
  6712. and height. These parameters have the same meaning as the drawbox
  6713. filter which can be used to visualise the position of the bounding
  6714. box.
  6715. This is useful when simultaneous movement of subjects within the frame
  6716. might be confused for camera motion by the motion vector search.
  6717. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6718. then the full frame is used. This allows later options to be set
  6719. without specifying the bounding box for the motion vector search.
  6720. Default - search the whole frame.
  6721. @item rx
  6722. @item ry
  6723. Specify the maximum extent of movement in x and y directions in the
  6724. range 0-64 pixels. Default 16.
  6725. @item edge
  6726. Specify how to generate pixels to fill blanks at the edge of the
  6727. frame. Available values are:
  6728. @table @samp
  6729. @item blank, 0
  6730. Fill zeroes at blank locations
  6731. @item original, 1
  6732. Original image at blank locations
  6733. @item clamp, 2
  6734. Extruded edge value at blank locations
  6735. @item mirror, 3
  6736. Mirrored edge at blank locations
  6737. @end table
  6738. Default value is @samp{mirror}.
  6739. @item blocksize
  6740. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6741. default 8.
  6742. @item contrast
  6743. Specify the contrast threshold for blocks. Only blocks with more than
  6744. the specified contrast (difference between darkest and lightest
  6745. pixels) will be considered. Range 1-255, default 125.
  6746. @item search
  6747. Specify the search strategy. Available values are:
  6748. @table @samp
  6749. @item exhaustive, 0
  6750. Set exhaustive search
  6751. @item less, 1
  6752. Set less exhaustive search.
  6753. @end table
  6754. Default value is @samp{exhaustive}.
  6755. @item filename
  6756. If set then a detailed log of the motion search is written to the
  6757. specified file.
  6758. @end table
  6759. @section despill
  6760. Remove unwanted contamination of foreground colors, caused by reflected color of
  6761. greenscreen or bluescreen.
  6762. This filter accepts the following options:
  6763. @table @option
  6764. @item type
  6765. Set what type of despill to use.
  6766. @item mix
  6767. Set how spillmap will be generated.
  6768. @item expand
  6769. Set how much to get rid of still remaining spill.
  6770. @item red
  6771. Controls amount of red in spill area.
  6772. @item green
  6773. Controls amount of green in spill area.
  6774. Should be -1 for greenscreen.
  6775. @item blue
  6776. Controls amount of blue in spill area.
  6777. Should be -1 for bluescreen.
  6778. @item brightness
  6779. Controls brightness of spill area, preserving colors.
  6780. @item alpha
  6781. Modify alpha from generated spillmap.
  6782. @end table
  6783. @section detelecine
  6784. Apply an exact inverse of the telecine operation. It requires a predefined
  6785. pattern specified using the pattern option which must be the same as that passed
  6786. to the telecine filter.
  6787. This filter accepts the following options:
  6788. @table @option
  6789. @item first_field
  6790. @table @samp
  6791. @item top, t
  6792. top field first
  6793. @item bottom, b
  6794. bottom field first
  6795. The default value is @code{top}.
  6796. @end table
  6797. @item pattern
  6798. A string of numbers representing the pulldown pattern you wish to apply.
  6799. The default value is @code{23}.
  6800. @item start_frame
  6801. A number representing position of the first frame with respect to the telecine
  6802. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6803. @end table
  6804. @section dilation
  6805. Apply dilation effect to the video.
  6806. This filter replaces the pixel by the local(3x3) maximum.
  6807. It accepts the following options:
  6808. @table @option
  6809. @item threshold0
  6810. @item threshold1
  6811. @item threshold2
  6812. @item threshold3
  6813. Limit the maximum change for each plane, default is 65535.
  6814. If 0, plane will remain unchanged.
  6815. @item coordinates
  6816. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6817. pixels are used.
  6818. Flags to local 3x3 coordinates maps like this:
  6819. 1 2 3
  6820. 4 5
  6821. 6 7 8
  6822. @end table
  6823. @section displace
  6824. Displace pixels as indicated by second and third input stream.
  6825. It takes three input streams and outputs one stream, the first input is the
  6826. source, and second and third input are displacement maps.
  6827. The second input specifies how much to displace pixels along the
  6828. x-axis, while the third input specifies how much to displace pixels
  6829. along the y-axis.
  6830. If one of displacement map streams terminates, last frame from that
  6831. displacement map will be used.
  6832. Note that once generated, displacements maps can be reused over and over again.
  6833. A description of the accepted options follows.
  6834. @table @option
  6835. @item edge
  6836. Set displace behavior for pixels that are out of range.
  6837. Available values are:
  6838. @table @samp
  6839. @item blank
  6840. Missing pixels are replaced by black pixels.
  6841. @item smear
  6842. Adjacent pixels will spread out to replace missing pixels.
  6843. @item wrap
  6844. Out of range pixels are wrapped so they point to pixels of other side.
  6845. @item mirror
  6846. Out of range pixels will be replaced with mirrored pixels.
  6847. @end table
  6848. Default is @samp{smear}.
  6849. @end table
  6850. @subsection Examples
  6851. @itemize
  6852. @item
  6853. Add ripple effect to rgb input of video size hd720:
  6854. @example
  6855. 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
  6856. @end example
  6857. @item
  6858. Add wave effect to rgb input of video size hd720:
  6859. @example
  6860. 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
  6861. @end example
  6862. @end itemize
  6863. @section drawbox
  6864. Draw a colored box on the input image.
  6865. It accepts the following parameters:
  6866. @table @option
  6867. @item x
  6868. @item y
  6869. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6870. @item width, w
  6871. @item height, h
  6872. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6873. the input width and height. It defaults to 0.
  6874. @item color, c
  6875. Specify the color of the box to write. For the general syntax of this option,
  6876. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6877. value @code{invert} is used, the box edge color is the same as the
  6878. video with inverted luma.
  6879. @item thickness, t
  6880. The expression which sets the thickness of the box edge.
  6881. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6882. See below for the list of accepted constants.
  6883. @item replace
  6884. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6885. will overwrite the video's color and alpha pixels.
  6886. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6887. @end table
  6888. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6889. following constants:
  6890. @table @option
  6891. @item dar
  6892. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6893. @item hsub
  6894. @item vsub
  6895. horizontal and vertical chroma subsample values. For example for the
  6896. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6897. @item in_h, ih
  6898. @item in_w, iw
  6899. The input width and height.
  6900. @item sar
  6901. The input sample aspect ratio.
  6902. @item x
  6903. @item y
  6904. The x and y offset coordinates where the box is drawn.
  6905. @item w
  6906. @item h
  6907. The width and height of the drawn box.
  6908. @item t
  6909. The thickness of the drawn box.
  6910. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6911. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6912. @end table
  6913. @subsection Examples
  6914. @itemize
  6915. @item
  6916. Draw a black box around the edge of the input image:
  6917. @example
  6918. drawbox
  6919. @end example
  6920. @item
  6921. Draw a box with color red and an opacity of 50%:
  6922. @example
  6923. drawbox=10:20:200:60:red@@0.5
  6924. @end example
  6925. The previous example can be specified as:
  6926. @example
  6927. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6928. @end example
  6929. @item
  6930. Fill the box with pink color:
  6931. @example
  6932. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6933. @end example
  6934. @item
  6935. Draw a 2-pixel red 2.40:1 mask:
  6936. @example
  6937. 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
  6938. @end example
  6939. @end itemize
  6940. @subsection Commands
  6941. This filter supports same commands as options.
  6942. The command accepts the same syntax of the corresponding option.
  6943. If the specified expression is not valid, it is kept at its current
  6944. value.
  6945. @section drawgrid
  6946. Draw a grid on the input image.
  6947. It accepts the following parameters:
  6948. @table @option
  6949. @item x
  6950. @item y
  6951. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6952. @item width, w
  6953. @item height, h
  6954. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6955. input width and height, respectively, minus @code{thickness}, so image gets
  6956. framed. Default to 0.
  6957. @item color, c
  6958. Specify the color of the grid. For the general syntax of this option,
  6959. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6960. value @code{invert} is used, the grid color is the same as the
  6961. video with inverted luma.
  6962. @item thickness, t
  6963. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6964. See below for the list of accepted constants.
  6965. @item replace
  6966. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6967. will overwrite the video's color and alpha pixels.
  6968. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6969. @end table
  6970. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6971. following constants:
  6972. @table @option
  6973. @item dar
  6974. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6975. @item hsub
  6976. @item vsub
  6977. horizontal and vertical chroma subsample values. For example for the
  6978. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6979. @item in_h, ih
  6980. @item in_w, iw
  6981. The input grid cell width and height.
  6982. @item sar
  6983. The input sample aspect ratio.
  6984. @item x
  6985. @item y
  6986. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6987. @item w
  6988. @item h
  6989. The width and height of the drawn cell.
  6990. @item t
  6991. The thickness of the drawn cell.
  6992. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6993. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6994. @end table
  6995. @subsection Examples
  6996. @itemize
  6997. @item
  6998. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6999. @example
  7000. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7001. @end example
  7002. @item
  7003. Draw a white 3x3 grid with an opacity of 50%:
  7004. @example
  7005. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7006. @end example
  7007. @end itemize
  7008. @subsection Commands
  7009. This filter supports same commands as options.
  7010. The command accepts the same syntax of the corresponding option.
  7011. If the specified expression is not valid, it is kept at its current
  7012. value.
  7013. @anchor{drawtext}
  7014. @section drawtext
  7015. Draw a text string or text from a specified file on top of a video, using the
  7016. libfreetype library.
  7017. To enable compilation of this filter, you need to configure FFmpeg with
  7018. @code{--enable-libfreetype}.
  7019. To enable default font fallback and the @var{font} option you need to
  7020. configure FFmpeg with @code{--enable-libfontconfig}.
  7021. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7022. @code{--enable-libfribidi}.
  7023. @subsection Syntax
  7024. It accepts the following parameters:
  7025. @table @option
  7026. @item box
  7027. Used to draw a box around text using the background color.
  7028. The value must be either 1 (enable) or 0 (disable).
  7029. The default value of @var{box} is 0.
  7030. @item boxborderw
  7031. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7032. The default value of @var{boxborderw} is 0.
  7033. @item boxcolor
  7034. The color to be used for drawing box around text. For the syntax of this
  7035. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7036. The default value of @var{boxcolor} is "white".
  7037. @item line_spacing
  7038. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7039. The default value of @var{line_spacing} is 0.
  7040. @item borderw
  7041. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7042. The default value of @var{borderw} is 0.
  7043. @item bordercolor
  7044. Set the color to be used for drawing border around text. For the syntax of this
  7045. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7046. The default value of @var{bordercolor} is "black".
  7047. @item expansion
  7048. Select how the @var{text} is expanded. Can be either @code{none},
  7049. @code{strftime} (deprecated) or
  7050. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7051. below for details.
  7052. @item basetime
  7053. Set a start time for the count. Value is in microseconds. Only applied
  7054. in the deprecated strftime expansion mode. To emulate in normal expansion
  7055. mode use the @code{pts} function, supplying the start time (in seconds)
  7056. as the second argument.
  7057. @item fix_bounds
  7058. If true, check and fix text coords to avoid clipping.
  7059. @item fontcolor
  7060. The color to be used for drawing fonts. For the syntax of this option, check
  7061. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7062. The default value of @var{fontcolor} is "black".
  7063. @item fontcolor_expr
  7064. String which is expanded the same way as @var{text} to obtain dynamic
  7065. @var{fontcolor} value. By default this option has empty value and is not
  7066. processed. When this option is set, it overrides @var{fontcolor} option.
  7067. @item font
  7068. The font family to be used for drawing text. By default Sans.
  7069. @item fontfile
  7070. The font file to be used for drawing text. The path must be included.
  7071. This parameter is mandatory if the fontconfig support is disabled.
  7072. @item alpha
  7073. Draw the text applying alpha blending. The value can
  7074. be a number between 0.0 and 1.0.
  7075. The expression accepts the same variables @var{x, y} as well.
  7076. The default value is 1.
  7077. Please see @var{fontcolor_expr}.
  7078. @item fontsize
  7079. The font size to be used for drawing text.
  7080. The default value of @var{fontsize} is 16.
  7081. @item text_shaping
  7082. If set to 1, attempt to shape the text (for example, reverse the order of
  7083. right-to-left text and join Arabic characters) before drawing it.
  7084. Otherwise, just draw the text exactly as given.
  7085. By default 1 (if supported).
  7086. @item ft_load_flags
  7087. The flags to be used for loading the fonts.
  7088. The flags map the corresponding flags supported by libfreetype, and are
  7089. a combination of the following values:
  7090. @table @var
  7091. @item default
  7092. @item no_scale
  7093. @item no_hinting
  7094. @item render
  7095. @item no_bitmap
  7096. @item vertical_layout
  7097. @item force_autohint
  7098. @item crop_bitmap
  7099. @item pedantic
  7100. @item ignore_global_advance_width
  7101. @item no_recurse
  7102. @item ignore_transform
  7103. @item monochrome
  7104. @item linear_design
  7105. @item no_autohint
  7106. @end table
  7107. Default value is "default".
  7108. For more information consult the documentation for the FT_LOAD_*
  7109. libfreetype flags.
  7110. @item shadowcolor
  7111. The color to be used for drawing a shadow behind the drawn text. For the
  7112. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7113. ffmpeg-utils manual,ffmpeg-utils}.
  7114. The default value of @var{shadowcolor} is "black".
  7115. @item shadowx
  7116. @item shadowy
  7117. The x and y offsets for the text shadow position with respect to the
  7118. position of the text. They can be either positive or negative
  7119. values. The default value for both is "0".
  7120. @item start_number
  7121. The starting frame number for the n/frame_num variable. The default value
  7122. is "0".
  7123. @item tabsize
  7124. The size in number of spaces to use for rendering the tab.
  7125. Default value is 4.
  7126. @item timecode
  7127. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7128. format. It can be used with or without text parameter. @var{timecode_rate}
  7129. option must be specified.
  7130. @item timecode_rate, rate, r
  7131. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7132. integer. Minimum value is "1".
  7133. Drop-frame timecode is supported for frame rates 30 & 60.
  7134. @item tc24hmax
  7135. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7136. Default is 0 (disabled).
  7137. @item text
  7138. The text string to be drawn. The text must be a sequence of UTF-8
  7139. encoded characters.
  7140. This parameter is mandatory if no file is specified with the parameter
  7141. @var{textfile}.
  7142. @item textfile
  7143. A text file containing text to be drawn. The text must be a sequence
  7144. of UTF-8 encoded characters.
  7145. This parameter is mandatory if no text string is specified with the
  7146. parameter @var{text}.
  7147. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7148. @item reload
  7149. If set to 1, the @var{textfile} will be reloaded before each frame.
  7150. Be sure to update it atomically, or it may be read partially, or even fail.
  7151. @item x
  7152. @item y
  7153. The expressions which specify the offsets where text will be drawn
  7154. within the video frame. They are relative to the top/left border of the
  7155. output image.
  7156. The default value of @var{x} and @var{y} is "0".
  7157. See below for the list of accepted constants and functions.
  7158. @end table
  7159. The parameters for @var{x} and @var{y} are expressions containing the
  7160. following constants and functions:
  7161. @table @option
  7162. @item dar
  7163. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7164. @item hsub
  7165. @item vsub
  7166. horizontal and vertical chroma subsample values. For example for the
  7167. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7168. @item line_h, lh
  7169. the height of each text line
  7170. @item main_h, h, H
  7171. the input height
  7172. @item main_w, w, W
  7173. the input width
  7174. @item max_glyph_a, ascent
  7175. the maximum distance from the baseline to the highest/upper grid
  7176. coordinate used to place a glyph outline point, for all the rendered
  7177. glyphs.
  7178. It is a positive value, due to the grid's orientation with the Y axis
  7179. upwards.
  7180. @item max_glyph_d, descent
  7181. the maximum distance from the baseline to the lowest grid coordinate
  7182. used to place a glyph outline point, for all the rendered glyphs.
  7183. This is a negative value, due to the grid's orientation, with the Y axis
  7184. upwards.
  7185. @item max_glyph_h
  7186. maximum glyph height, that is the maximum height for all the glyphs
  7187. contained in the rendered text, it is equivalent to @var{ascent} -
  7188. @var{descent}.
  7189. @item max_glyph_w
  7190. maximum glyph width, that is the maximum width for all the glyphs
  7191. contained in the rendered text
  7192. @item n
  7193. the number of input frame, starting from 0
  7194. @item rand(min, max)
  7195. return a random number included between @var{min} and @var{max}
  7196. @item sar
  7197. The input sample aspect ratio.
  7198. @item t
  7199. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7200. @item text_h, th
  7201. the height of the rendered text
  7202. @item text_w, tw
  7203. the width of the rendered text
  7204. @item x
  7205. @item y
  7206. the x and y offset coordinates where the text is drawn.
  7207. These parameters allow the @var{x} and @var{y} expressions to refer
  7208. to each other, so you can for example specify @code{y=x/dar}.
  7209. @item pict_type
  7210. A one character description of the current frame's picture type.
  7211. @item pkt_pos
  7212. The current packet's position in the input file or stream
  7213. (in bytes, from the start of the input). A value of -1 indicates
  7214. this info is not available.
  7215. @item pkt_duration
  7216. The current packet's duration, in seconds.
  7217. @item pkt_size
  7218. The current packet's size (in bytes).
  7219. @end table
  7220. @anchor{drawtext_expansion}
  7221. @subsection Text expansion
  7222. If @option{expansion} is set to @code{strftime},
  7223. the filter recognizes strftime() sequences in the provided text and
  7224. expands them accordingly. Check the documentation of strftime(). This
  7225. feature is deprecated.
  7226. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7227. If @option{expansion} is set to @code{normal} (which is the default),
  7228. the following expansion mechanism is used.
  7229. The backslash character @samp{\}, followed by any character, always expands to
  7230. the second character.
  7231. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7232. braces is a function name, possibly followed by arguments separated by ':'.
  7233. If the arguments contain special characters or delimiters (':' or '@}'),
  7234. they should be escaped.
  7235. Note that they probably must also be escaped as the value for the
  7236. @option{text} option in the filter argument string and as the filter
  7237. argument in the filtergraph description, and possibly also for the shell,
  7238. that makes up to four levels of escaping; using a text file avoids these
  7239. problems.
  7240. The following functions are available:
  7241. @table @command
  7242. @item expr, e
  7243. The expression evaluation result.
  7244. It must take one argument specifying the expression to be evaluated,
  7245. which accepts the same constants and functions as the @var{x} and
  7246. @var{y} values. Note that not all constants should be used, for
  7247. example the text size is not known when evaluating the expression, so
  7248. the constants @var{text_w} and @var{text_h} will have an undefined
  7249. value.
  7250. @item expr_int_format, eif
  7251. Evaluate the expression's value and output as formatted integer.
  7252. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7253. The second argument specifies the output format. Allowed values are @samp{x},
  7254. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7255. @code{printf} function.
  7256. The third parameter is optional and sets the number of positions taken by the output.
  7257. It can be used to add padding with zeros from the left.
  7258. @item gmtime
  7259. The time at which the filter is running, expressed in UTC.
  7260. It can accept an argument: a strftime() format string.
  7261. @item localtime
  7262. The time at which the filter is running, expressed in the local time zone.
  7263. It can accept an argument: a strftime() format string.
  7264. @item metadata
  7265. Frame metadata. Takes one or two arguments.
  7266. The first argument is mandatory and specifies the metadata key.
  7267. The second argument is optional and specifies a default value, used when the
  7268. metadata key is not found or empty.
  7269. Available metadata can be identified by inspecting entries
  7270. starting with TAG included within each frame section
  7271. printed by running @code{ffprobe -show_frames}.
  7272. String metadata generated in filters leading to
  7273. the drawtext filter are also available.
  7274. @item n, frame_num
  7275. The frame number, starting from 0.
  7276. @item pict_type
  7277. A one character description of the current picture type.
  7278. @item pts
  7279. The timestamp of the current frame.
  7280. It can take up to three arguments.
  7281. The first argument is the format of the timestamp; it defaults to @code{flt}
  7282. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7283. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7284. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7285. @code{localtime} stands for the timestamp of the frame formatted as
  7286. local time zone time.
  7287. The second argument is an offset added to the timestamp.
  7288. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7289. supplied to present the hour part of the formatted timestamp in 24h format
  7290. (00-23).
  7291. If the format is set to @code{localtime} or @code{gmtime},
  7292. a third argument may be supplied: a strftime() format string.
  7293. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7294. @end table
  7295. @subsection Commands
  7296. This filter supports altering parameters via commands:
  7297. @table @option
  7298. @item reinit
  7299. Alter existing filter parameters.
  7300. Syntax for the argument is the same as for filter invocation, e.g.
  7301. @example
  7302. fontsize=56:fontcolor=green:text='Hello World'
  7303. @end example
  7304. Full filter invocation with sendcmd would look like this:
  7305. @example
  7306. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7307. @end example
  7308. @end table
  7309. If the entire argument can't be parsed or applied as valid values then the filter will
  7310. continue with its existing parameters.
  7311. @subsection Examples
  7312. @itemize
  7313. @item
  7314. Draw "Test Text" with font FreeSerif, using the default values for the
  7315. optional parameters.
  7316. @example
  7317. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7318. @end example
  7319. @item
  7320. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7321. and y=50 (counting from the top-left corner of the screen), text is
  7322. yellow with a red box around it. Both the text and the box have an
  7323. opacity of 20%.
  7324. @example
  7325. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7326. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7327. @end example
  7328. Note that the double quotes are not necessary if spaces are not used
  7329. within the parameter list.
  7330. @item
  7331. Show the text at the center of the video frame:
  7332. @example
  7333. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7334. @end example
  7335. @item
  7336. Show the text at a random position, switching to a new position every 30 seconds:
  7337. @example
  7338. 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)"
  7339. @end example
  7340. @item
  7341. Show a text line sliding from right to left in the last row of the video
  7342. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7343. with no newlines.
  7344. @example
  7345. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7346. @end example
  7347. @item
  7348. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7349. @example
  7350. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7351. @end example
  7352. @item
  7353. Draw a single green letter "g", at the center of the input video.
  7354. The glyph baseline is placed at half screen height.
  7355. @example
  7356. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7357. @end example
  7358. @item
  7359. Show text for 1 second every 3 seconds:
  7360. @example
  7361. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7362. @end example
  7363. @item
  7364. Use fontconfig to set the font. Note that the colons need to be escaped.
  7365. @example
  7366. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7367. @end example
  7368. @item
  7369. Print the date of a real-time encoding (see strftime(3)):
  7370. @example
  7371. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7372. @end example
  7373. @item
  7374. Show text fading in and out (appearing/disappearing):
  7375. @example
  7376. #!/bin/sh
  7377. DS=1.0 # display start
  7378. DE=10.0 # display end
  7379. FID=1.5 # fade in duration
  7380. FOD=5 # fade out duration
  7381. 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 @}"
  7382. @end example
  7383. @item
  7384. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7385. and the @option{fontsize} value are included in the @option{y} offset.
  7386. @example
  7387. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7388. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7389. @end example
  7390. @end itemize
  7391. For more information about libfreetype, check:
  7392. @url{http://www.freetype.org/}.
  7393. For more information about fontconfig, check:
  7394. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7395. For more information about libfribidi, check:
  7396. @url{http://fribidi.org/}.
  7397. @section edgedetect
  7398. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7399. The filter accepts the following options:
  7400. @table @option
  7401. @item low
  7402. @item high
  7403. Set low and high threshold values used by the Canny thresholding
  7404. algorithm.
  7405. The high threshold selects the "strong" edge pixels, which are then
  7406. connected through 8-connectivity with the "weak" edge pixels selected
  7407. by the low threshold.
  7408. @var{low} and @var{high} threshold values must be chosen in the range
  7409. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7410. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7411. is @code{50/255}.
  7412. @item mode
  7413. Define the drawing mode.
  7414. @table @samp
  7415. @item wires
  7416. Draw white/gray wires on black background.
  7417. @item colormix
  7418. Mix the colors to create a paint/cartoon effect.
  7419. @item canny
  7420. Apply Canny edge detector on all selected planes.
  7421. @end table
  7422. Default value is @var{wires}.
  7423. @item planes
  7424. Select planes for filtering. By default all available planes are filtered.
  7425. @end table
  7426. @subsection Examples
  7427. @itemize
  7428. @item
  7429. Standard edge detection with custom values for the hysteresis thresholding:
  7430. @example
  7431. edgedetect=low=0.1:high=0.4
  7432. @end example
  7433. @item
  7434. Painting effect without thresholding:
  7435. @example
  7436. edgedetect=mode=colormix:high=0
  7437. @end example
  7438. @end itemize
  7439. @section elbg
  7440. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7441. For each input image, the filter will compute the optimal mapping from
  7442. the input to the output given the codebook length, that is the number
  7443. of distinct output colors.
  7444. This filter accepts the following options.
  7445. @table @option
  7446. @item codebook_length, l
  7447. Set codebook length. The value must be a positive integer, and
  7448. represents the number of distinct output colors. Default value is 256.
  7449. @item nb_steps, n
  7450. Set the maximum number of iterations to apply for computing the optimal
  7451. mapping. The higher the value the better the result and the higher the
  7452. computation time. Default value is 1.
  7453. @item seed, s
  7454. Set a random seed, must be an integer included between 0 and
  7455. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7456. will try to use a good random seed on a best effort basis.
  7457. @item pal8
  7458. Set pal8 output pixel format. This option does not work with codebook
  7459. length greater than 256.
  7460. @end table
  7461. @section entropy
  7462. Measure graylevel entropy in histogram of color channels of video frames.
  7463. It accepts the following parameters:
  7464. @table @option
  7465. @item mode
  7466. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7467. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7468. between neighbour histogram values.
  7469. @end table
  7470. @section eq
  7471. Set brightness, contrast, saturation and approximate gamma adjustment.
  7472. The filter accepts the following options:
  7473. @table @option
  7474. @item contrast
  7475. Set the contrast expression. The value must be a float value in range
  7476. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7477. @item brightness
  7478. Set the brightness expression. The value must be a float value in
  7479. range @code{-1.0} to @code{1.0}. The default value is "0".
  7480. @item saturation
  7481. Set the saturation expression. The value must be a float in
  7482. range @code{0.0} to @code{3.0}. The default value is "1".
  7483. @item gamma
  7484. Set the gamma expression. The value must be a float in range
  7485. @code{0.1} to @code{10.0}. The default value is "1".
  7486. @item gamma_r
  7487. Set the gamma expression for red. The value must be a float in
  7488. range @code{0.1} to @code{10.0}. The default value is "1".
  7489. @item gamma_g
  7490. Set the gamma expression for green. The value must be a float in range
  7491. @code{0.1} to @code{10.0}. The default value is "1".
  7492. @item gamma_b
  7493. Set the gamma expression for blue. The value must be a float in range
  7494. @code{0.1} to @code{10.0}. The default value is "1".
  7495. @item gamma_weight
  7496. Set the gamma weight expression. It can be used to reduce the effect
  7497. of a high gamma value on bright image areas, e.g. keep them from
  7498. getting overamplified and just plain white. The value must be a float
  7499. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7500. gamma correction all the way down while @code{1.0} leaves it at its
  7501. full strength. Default is "1".
  7502. @item eval
  7503. Set when the expressions for brightness, contrast, saturation and
  7504. gamma expressions are evaluated.
  7505. It accepts the following values:
  7506. @table @samp
  7507. @item init
  7508. only evaluate expressions once during the filter initialization or
  7509. when a command is processed
  7510. @item frame
  7511. evaluate expressions for each incoming frame
  7512. @end table
  7513. Default value is @samp{init}.
  7514. @end table
  7515. The expressions accept the following parameters:
  7516. @table @option
  7517. @item n
  7518. frame count of the input frame starting from 0
  7519. @item pos
  7520. byte position of the corresponding packet in the input file, NAN if
  7521. unspecified
  7522. @item r
  7523. frame rate of the input video, NAN if the input frame rate is unknown
  7524. @item t
  7525. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7526. @end table
  7527. @subsection Commands
  7528. The filter supports the following commands:
  7529. @table @option
  7530. @item contrast
  7531. Set the contrast expression.
  7532. @item brightness
  7533. Set the brightness expression.
  7534. @item saturation
  7535. Set the saturation expression.
  7536. @item gamma
  7537. Set the gamma expression.
  7538. @item gamma_r
  7539. Set the gamma_r expression.
  7540. @item gamma_g
  7541. Set gamma_g expression.
  7542. @item gamma_b
  7543. Set gamma_b expression.
  7544. @item gamma_weight
  7545. Set gamma_weight expression.
  7546. The command accepts the same syntax of the corresponding option.
  7547. If the specified expression is not valid, it is kept at its current
  7548. value.
  7549. @end table
  7550. @section erosion
  7551. Apply erosion effect to the video.
  7552. This filter replaces the pixel by the local(3x3) minimum.
  7553. It accepts the following options:
  7554. @table @option
  7555. @item threshold0
  7556. @item threshold1
  7557. @item threshold2
  7558. @item threshold3
  7559. Limit the maximum change for each plane, default is 65535.
  7560. If 0, plane will remain unchanged.
  7561. @item coordinates
  7562. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7563. pixels are used.
  7564. Flags to local 3x3 coordinates maps like this:
  7565. 1 2 3
  7566. 4 5
  7567. 6 7 8
  7568. @end table
  7569. @section extractplanes
  7570. Extract color channel components from input video stream into
  7571. separate grayscale video streams.
  7572. The filter accepts the following option:
  7573. @table @option
  7574. @item planes
  7575. Set plane(s) to extract.
  7576. Available values for planes are:
  7577. @table @samp
  7578. @item y
  7579. @item u
  7580. @item v
  7581. @item a
  7582. @item r
  7583. @item g
  7584. @item b
  7585. @end table
  7586. Choosing planes not available in the input will result in an error.
  7587. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7588. with @code{y}, @code{u}, @code{v} planes at same time.
  7589. @end table
  7590. @subsection Examples
  7591. @itemize
  7592. @item
  7593. Extract luma, u and v color channel component from input video frame
  7594. into 3 grayscale outputs:
  7595. @example
  7596. 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
  7597. @end example
  7598. @end itemize
  7599. @section fade
  7600. Apply a fade-in/out effect to the input video.
  7601. It accepts the following parameters:
  7602. @table @option
  7603. @item type, t
  7604. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7605. effect.
  7606. Default is @code{in}.
  7607. @item start_frame, s
  7608. Specify the number of the frame to start applying the fade
  7609. effect at. Default is 0.
  7610. @item nb_frames, n
  7611. The number of frames that the fade effect lasts. At the end of the
  7612. fade-in effect, the output video will have the same intensity as the input video.
  7613. At the end of the fade-out transition, the output video will be filled with the
  7614. selected @option{color}.
  7615. Default is 25.
  7616. @item alpha
  7617. If set to 1, fade only alpha channel, if one exists on the input.
  7618. Default value is 0.
  7619. @item start_time, st
  7620. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7621. effect. If both start_frame and start_time are specified, the fade will start at
  7622. whichever comes last. Default is 0.
  7623. @item duration, d
  7624. The number of seconds for which the fade effect has to last. At the end of the
  7625. fade-in effect the output video will have the same intensity as the input video,
  7626. at the end of the fade-out transition the output video will be filled with the
  7627. selected @option{color}.
  7628. If both duration and nb_frames are specified, duration is used. Default is 0
  7629. (nb_frames is used by default).
  7630. @item color, c
  7631. Specify the color of the fade. Default is "black".
  7632. @end table
  7633. @subsection Examples
  7634. @itemize
  7635. @item
  7636. Fade in the first 30 frames of video:
  7637. @example
  7638. fade=in:0:30
  7639. @end example
  7640. The command above is equivalent to:
  7641. @example
  7642. fade=t=in:s=0:n=30
  7643. @end example
  7644. @item
  7645. Fade out the last 45 frames of a 200-frame video:
  7646. @example
  7647. fade=out:155:45
  7648. fade=type=out:start_frame=155:nb_frames=45
  7649. @end example
  7650. @item
  7651. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7652. @example
  7653. fade=in:0:25, fade=out:975:25
  7654. @end example
  7655. @item
  7656. Make the first 5 frames yellow, then fade in from frame 5-24:
  7657. @example
  7658. fade=in:5:20:color=yellow
  7659. @end example
  7660. @item
  7661. Fade in alpha over first 25 frames of video:
  7662. @example
  7663. fade=in:0:25:alpha=1
  7664. @end example
  7665. @item
  7666. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7667. @example
  7668. fade=t=in:st=5.5:d=0.5
  7669. @end example
  7670. @end itemize
  7671. @section fftdnoiz
  7672. Denoise frames using 3D FFT (frequency domain filtering).
  7673. The filter accepts the following options:
  7674. @table @option
  7675. @item sigma
  7676. Set the noise sigma constant. This sets denoising strength.
  7677. Default value is 1. Allowed range is from 0 to 30.
  7678. Using very high sigma with low overlap may give blocking artifacts.
  7679. @item amount
  7680. Set amount of denoising. By default all detected noise is reduced.
  7681. Default value is 1. Allowed range is from 0 to 1.
  7682. @item block
  7683. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7684. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7685. block size in pixels is 2^4 which is 16.
  7686. @item overlap
  7687. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7688. @item prev
  7689. Set number of previous frames to use for denoising. By default is set to 0.
  7690. @item next
  7691. Set number of next frames to to use for denoising. By default is set to 0.
  7692. @item planes
  7693. Set planes which will be filtered, by default are all available filtered
  7694. except alpha.
  7695. @end table
  7696. @section fftfilt
  7697. Apply arbitrary expressions to samples in frequency domain
  7698. @table @option
  7699. @item dc_Y
  7700. Adjust the dc value (gain) of the luma plane of the image. The filter
  7701. accepts an integer value in range @code{0} to @code{1000}. The default
  7702. value is set to @code{0}.
  7703. @item dc_U
  7704. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7705. filter accepts an integer value in range @code{0} to @code{1000}. The
  7706. default value is set to @code{0}.
  7707. @item dc_V
  7708. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7709. filter accepts an integer value in range @code{0} to @code{1000}. The
  7710. default value is set to @code{0}.
  7711. @item weight_Y
  7712. Set the frequency domain weight expression for the luma plane.
  7713. @item weight_U
  7714. Set the frequency domain weight expression for the 1st chroma plane.
  7715. @item weight_V
  7716. Set the frequency domain weight expression for the 2nd chroma plane.
  7717. @item eval
  7718. Set when the expressions are evaluated.
  7719. It accepts the following values:
  7720. @table @samp
  7721. @item init
  7722. Only evaluate expressions once during the filter initialization.
  7723. @item frame
  7724. Evaluate expressions for each incoming frame.
  7725. @end table
  7726. Default value is @samp{init}.
  7727. The filter accepts the following variables:
  7728. @item X
  7729. @item Y
  7730. The coordinates of the current sample.
  7731. @item W
  7732. @item H
  7733. The width and height of the image.
  7734. @item N
  7735. The number of input frame, starting from 0.
  7736. @end table
  7737. @subsection Examples
  7738. @itemize
  7739. @item
  7740. High-pass:
  7741. @example
  7742. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7743. @end example
  7744. @item
  7745. Low-pass:
  7746. @example
  7747. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7748. @end example
  7749. @item
  7750. Sharpen:
  7751. @example
  7752. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7753. @end example
  7754. @item
  7755. Blur:
  7756. @example
  7757. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7758. @end example
  7759. @end itemize
  7760. @section field
  7761. Extract a single field from an interlaced image using stride
  7762. arithmetic to avoid wasting CPU time. The output frames are marked as
  7763. non-interlaced.
  7764. The filter accepts the following options:
  7765. @table @option
  7766. @item type
  7767. Specify whether to extract the top (if the value is @code{0} or
  7768. @code{top}) or the bottom field (if the value is @code{1} or
  7769. @code{bottom}).
  7770. @end table
  7771. @section fieldhint
  7772. Create new frames by copying the top and bottom fields from surrounding frames
  7773. supplied as numbers by the hint file.
  7774. @table @option
  7775. @item hint
  7776. Set file containing hints: absolute/relative frame numbers.
  7777. There must be one line for each frame in a clip. Each line must contain two
  7778. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7779. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7780. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7781. for @code{relative} mode. First number tells from which frame to pick up top
  7782. field and second number tells from which frame to pick up bottom field.
  7783. If optionally followed by @code{+} output frame will be marked as interlaced,
  7784. else if followed by @code{-} output frame will be marked as progressive, else
  7785. it will be marked same as input frame.
  7786. If optionally followed by @code{t} output frame will use only top field, or in
  7787. case of @code{b} it will use only bottom field.
  7788. If line starts with @code{#} or @code{;} that line is skipped.
  7789. @item mode
  7790. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7791. @end table
  7792. Example of first several lines of @code{hint} file for @code{relative} mode:
  7793. @example
  7794. 0,0 - # first frame
  7795. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7796. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7797. 1,0 -
  7798. 0,0 -
  7799. 0,0 -
  7800. 1,0 -
  7801. 1,0 -
  7802. 1,0 -
  7803. 0,0 -
  7804. 0,0 -
  7805. 1,0 -
  7806. 1,0 -
  7807. 1,0 -
  7808. 0,0 -
  7809. @end example
  7810. @section fieldmatch
  7811. Field matching filter for inverse telecine. It is meant to reconstruct the
  7812. progressive frames from a telecined stream. The filter does not drop duplicated
  7813. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7814. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7815. The separation of the field matching and the decimation is notably motivated by
  7816. the possibility of inserting a de-interlacing filter fallback between the two.
  7817. If the source has mixed telecined and real interlaced content,
  7818. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7819. But these remaining combed frames will be marked as interlaced, and thus can be
  7820. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7821. In addition to the various configuration options, @code{fieldmatch} can take an
  7822. optional second stream, activated through the @option{ppsrc} option. If
  7823. enabled, the frames reconstruction will be based on the fields and frames from
  7824. this second stream. This allows the first input to be pre-processed in order to
  7825. help the various algorithms of the filter, while keeping the output lossless
  7826. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7827. or brightness/contrast adjustments can help.
  7828. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7829. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7830. which @code{fieldmatch} is based on. While the semantic and usage are very
  7831. close, some behaviour and options names can differ.
  7832. The @ref{decimate} filter currently only works for constant frame rate input.
  7833. If your input has mixed telecined (30fps) and progressive content with a lower
  7834. framerate like 24fps use the following filterchain to produce the necessary cfr
  7835. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7836. The filter accepts the following options:
  7837. @table @option
  7838. @item order
  7839. Specify the assumed field order of the input stream. Available values are:
  7840. @table @samp
  7841. @item auto
  7842. Auto detect parity (use FFmpeg's internal parity value).
  7843. @item bff
  7844. Assume bottom field first.
  7845. @item tff
  7846. Assume top field first.
  7847. @end table
  7848. Note that it is sometimes recommended not to trust the parity announced by the
  7849. stream.
  7850. Default value is @var{auto}.
  7851. @item mode
  7852. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7853. sense that it won't risk creating jerkiness due to duplicate frames when
  7854. possible, but if there are bad edits or blended fields it will end up
  7855. outputting combed frames when a good match might actually exist. On the other
  7856. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7857. but will almost always find a good frame if there is one. The other values are
  7858. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7859. jerkiness and creating duplicate frames versus finding good matches in sections
  7860. with bad edits, orphaned fields, blended fields, etc.
  7861. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7862. Available values are:
  7863. @table @samp
  7864. @item pc
  7865. 2-way matching (p/c)
  7866. @item pc_n
  7867. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7868. @item pc_u
  7869. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7870. @item pc_n_ub
  7871. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7872. still combed (p/c + n + u/b)
  7873. @item pcn
  7874. 3-way matching (p/c/n)
  7875. @item pcn_ub
  7876. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7877. detected as combed (p/c/n + u/b)
  7878. @end table
  7879. The parenthesis at the end indicate the matches that would be used for that
  7880. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7881. @var{top}).
  7882. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7883. the slowest.
  7884. Default value is @var{pc_n}.
  7885. @item ppsrc
  7886. Mark the main input stream as a pre-processed input, and enable the secondary
  7887. input stream as the clean source to pick the fields from. See the filter
  7888. introduction for more details. It is similar to the @option{clip2} feature from
  7889. VFM/TFM.
  7890. Default value is @code{0} (disabled).
  7891. @item field
  7892. Set the field to match from. It is recommended to set this to the same value as
  7893. @option{order} unless you experience matching failures with that setting. In
  7894. certain circumstances changing the field that is used to match from can have a
  7895. large impact on matching performance. Available values are:
  7896. @table @samp
  7897. @item auto
  7898. Automatic (same value as @option{order}).
  7899. @item bottom
  7900. Match from the bottom field.
  7901. @item top
  7902. Match from the top field.
  7903. @end table
  7904. Default value is @var{auto}.
  7905. @item mchroma
  7906. Set whether or not chroma is included during the match comparisons. In most
  7907. cases it is recommended to leave this enabled. You should set this to @code{0}
  7908. only if your clip has bad chroma problems such as heavy rainbowing or other
  7909. artifacts. Setting this to @code{0} could also be used to speed things up at
  7910. the cost of some accuracy.
  7911. Default value is @code{1}.
  7912. @item y0
  7913. @item y1
  7914. These define an exclusion band which excludes the lines between @option{y0} and
  7915. @option{y1} from being included in the field matching decision. An exclusion
  7916. band can be used to ignore subtitles, a logo, or other things that may
  7917. interfere with the matching. @option{y0} sets the starting scan line and
  7918. @option{y1} sets the ending line; all lines in between @option{y0} and
  7919. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7920. @option{y0} and @option{y1} to the same value will disable the feature.
  7921. @option{y0} and @option{y1} defaults to @code{0}.
  7922. @item scthresh
  7923. Set the scene change detection threshold as a percentage of maximum change on
  7924. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7925. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7926. @option{scthresh} is @code{[0.0, 100.0]}.
  7927. Default value is @code{12.0}.
  7928. @item combmatch
  7929. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7930. account the combed scores of matches when deciding what match to use as the
  7931. final match. Available values are:
  7932. @table @samp
  7933. @item none
  7934. No final matching based on combed scores.
  7935. @item sc
  7936. Combed scores are only used when a scene change is detected.
  7937. @item full
  7938. Use combed scores all the time.
  7939. @end table
  7940. Default is @var{sc}.
  7941. @item combdbg
  7942. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7943. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7944. Available values are:
  7945. @table @samp
  7946. @item none
  7947. No forced calculation.
  7948. @item pcn
  7949. Force p/c/n calculations.
  7950. @item pcnub
  7951. Force p/c/n/u/b calculations.
  7952. @end table
  7953. Default value is @var{none}.
  7954. @item cthresh
  7955. This is the area combing threshold used for combed frame detection. This
  7956. essentially controls how "strong" or "visible" combing must be to be detected.
  7957. Larger values mean combing must be more visible and smaller values mean combing
  7958. can be less visible or strong and still be detected. Valid settings are from
  7959. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7960. be detected as combed). This is basically a pixel difference value. A good
  7961. range is @code{[8, 12]}.
  7962. Default value is @code{9}.
  7963. @item chroma
  7964. Sets whether or not chroma is considered in the combed frame decision. Only
  7965. disable this if your source has chroma problems (rainbowing, etc.) that are
  7966. causing problems for the combed frame detection with chroma enabled. Actually,
  7967. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7968. where there is chroma only combing in the source.
  7969. Default value is @code{0}.
  7970. @item blockx
  7971. @item blocky
  7972. Respectively set the x-axis and y-axis size of the window used during combed
  7973. frame detection. This has to do with the size of the area in which
  7974. @option{combpel} pixels are required to be detected as combed for a frame to be
  7975. declared combed. See the @option{combpel} parameter description for more info.
  7976. Possible values are any number that is a power of 2 starting at 4 and going up
  7977. to 512.
  7978. Default value is @code{16}.
  7979. @item combpel
  7980. The number of combed pixels inside any of the @option{blocky} by
  7981. @option{blockx} size blocks on the frame for the frame to be detected as
  7982. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7983. setting controls "how much" combing there must be in any localized area (a
  7984. window defined by the @option{blockx} and @option{blocky} settings) on the
  7985. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7986. which point no frames will ever be detected as combed). This setting is known
  7987. as @option{MI} in TFM/VFM vocabulary.
  7988. Default value is @code{80}.
  7989. @end table
  7990. @anchor{p/c/n/u/b meaning}
  7991. @subsection p/c/n/u/b meaning
  7992. @subsubsection p/c/n
  7993. We assume the following telecined stream:
  7994. @example
  7995. Top fields: 1 2 2 3 4
  7996. Bottom fields: 1 2 3 4 4
  7997. @end example
  7998. The numbers correspond to the progressive frame the fields relate to. Here, the
  7999. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8000. When @code{fieldmatch} is configured to run a matching from bottom
  8001. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8002. @example
  8003. Input stream:
  8004. T 1 2 2 3 4
  8005. B 1 2 3 4 4 <-- matching reference
  8006. Matches: c c n n c
  8007. Output stream:
  8008. T 1 2 3 4 4
  8009. B 1 2 3 4 4
  8010. @end example
  8011. As a result of the field matching, we can see that some frames get duplicated.
  8012. To perform a complete inverse telecine, you need to rely on a decimation filter
  8013. after this operation. See for instance the @ref{decimate} filter.
  8014. The same operation now matching from top fields (@option{field}=@var{top})
  8015. looks like this:
  8016. @example
  8017. Input stream:
  8018. T 1 2 2 3 4 <-- matching reference
  8019. B 1 2 3 4 4
  8020. Matches: c c p p c
  8021. Output stream:
  8022. T 1 2 2 3 4
  8023. B 1 2 2 3 4
  8024. @end example
  8025. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8026. basically, they refer to the frame and field of the opposite parity:
  8027. @itemize
  8028. @item @var{p} matches the field of the opposite parity in the previous frame
  8029. @item @var{c} matches the field of the opposite parity in the current frame
  8030. @item @var{n} matches the field of the opposite parity in the next frame
  8031. @end itemize
  8032. @subsubsection u/b
  8033. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8034. from the opposite parity flag. In the following examples, we assume that we are
  8035. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8036. 'x' is placed above and below each matched fields.
  8037. With bottom matching (@option{field}=@var{bottom}):
  8038. @example
  8039. Match: c p n b u
  8040. x x x x x
  8041. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8042. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8043. x x x x x
  8044. Output frames:
  8045. 2 1 2 2 2
  8046. 2 2 2 1 3
  8047. @end example
  8048. With top matching (@option{field}=@var{top}):
  8049. @example
  8050. Match: c p n b u
  8051. x x x x x
  8052. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8053. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8054. x x x x x
  8055. Output frames:
  8056. 2 2 2 1 2
  8057. 2 1 3 2 2
  8058. @end example
  8059. @subsection Examples
  8060. Simple IVTC of a top field first telecined stream:
  8061. @example
  8062. fieldmatch=order=tff:combmatch=none, decimate
  8063. @end example
  8064. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8065. @example
  8066. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8067. @end example
  8068. @section fieldorder
  8069. Transform the field order of the input video.
  8070. It accepts the following parameters:
  8071. @table @option
  8072. @item order
  8073. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8074. for bottom field first.
  8075. @end table
  8076. The default value is @samp{tff}.
  8077. The transformation is done by shifting the picture content up or down
  8078. by one line, and filling the remaining line with appropriate picture content.
  8079. This method is consistent with most broadcast field order converters.
  8080. If the input video is not flagged as being interlaced, or it is already
  8081. flagged as being of the required output field order, then this filter does
  8082. not alter the incoming video.
  8083. It is very useful when converting to or from PAL DV material,
  8084. which is bottom field first.
  8085. For example:
  8086. @example
  8087. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8088. @end example
  8089. @section fifo, afifo
  8090. Buffer input images and send them when they are requested.
  8091. It is mainly useful when auto-inserted by the libavfilter
  8092. framework.
  8093. It does not take parameters.
  8094. @section fillborders
  8095. Fill borders of the input video, without changing video stream dimensions.
  8096. Sometimes video can have garbage at the four edges and you may not want to
  8097. crop video input to keep size multiple of some number.
  8098. This filter accepts the following options:
  8099. @table @option
  8100. @item left
  8101. Number of pixels to fill from left border.
  8102. @item right
  8103. Number of pixels to fill from right border.
  8104. @item top
  8105. Number of pixels to fill from top border.
  8106. @item bottom
  8107. Number of pixels to fill from bottom border.
  8108. @item mode
  8109. Set fill mode.
  8110. It accepts the following values:
  8111. @table @samp
  8112. @item smear
  8113. fill pixels using outermost pixels
  8114. @item mirror
  8115. fill pixels using mirroring
  8116. @item fixed
  8117. fill pixels with constant value
  8118. @end table
  8119. Default is @var{smear}.
  8120. @item color
  8121. Set color for pixels in fixed mode. Default is @var{black}.
  8122. @end table
  8123. @section find_rect
  8124. Find a rectangular object
  8125. It accepts the following options:
  8126. @table @option
  8127. @item object
  8128. Filepath of the object image, needs to be in gray8.
  8129. @item threshold
  8130. Detection threshold, default is 0.5.
  8131. @item mipmaps
  8132. Number of mipmaps, default is 3.
  8133. @item xmin, ymin, xmax, ymax
  8134. Specifies the rectangle in which to search.
  8135. @end table
  8136. @subsection Examples
  8137. @itemize
  8138. @item
  8139. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8140. @example
  8141. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8142. @end example
  8143. @end itemize
  8144. @section floodfill
  8145. Flood area with values of same pixel components with another values.
  8146. It accepts the following options:
  8147. @table @option
  8148. @item x
  8149. Set pixel x coordinate.
  8150. @item y
  8151. Set pixel y coordinate.
  8152. @item s0
  8153. Set source #0 component value.
  8154. @item s1
  8155. Set source #1 component value.
  8156. @item s2
  8157. Set source #2 component value.
  8158. @item s3
  8159. Set source #3 component value.
  8160. @item d0
  8161. Set destination #0 component value.
  8162. @item d1
  8163. Set destination #1 component value.
  8164. @item d2
  8165. Set destination #2 component value.
  8166. @item d3
  8167. Set destination #3 component value.
  8168. @end table
  8169. @anchor{format}
  8170. @section format
  8171. Convert the input video to one of the specified pixel formats.
  8172. Libavfilter will try to pick one that is suitable as input to
  8173. the next filter.
  8174. It accepts the following parameters:
  8175. @table @option
  8176. @item pix_fmts
  8177. A '|'-separated list of pixel format names, such as
  8178. "pix_fmts=yuv420p|monow|rgb24".
  8179. @end table
  8180. @subsection Examples
  8181. @itemize
  8182. @item
  8183. Convert the input video to the @var{yuv420p} format
  8184. @example
  8185. format=pix_fmts=yuv420p
  8186. @end example
  8187. Convert the input video to any of the formats in the list
  8188. @example
  8189. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8190. @end example
  8191. @end itemize
  8192. @anchor{fps}
  8193. @section fps
  8194. Convert the video to specified constant frame rate by duplicating or dropping
  8195. frames as necessary.
  8196. It accepts the following parameters:
  8197. @table @option
  8198. @item fps
  8199. The desired output frame rate. The default is @code{25}.
  8200. @item start_time
  8201. Assume the first PTS should be the given value, in seconds. This allows for
  8202. padding/trimming at the start of stream. By default, no assumption is made
  8203. about the first frame's expected PTS, so no padding or trimming is done.
  8204. For example, this could be set to 0 to pad the beginning with duplicates of
  8205. the first frame if a video stream starts after the audio stream or to trim any
  8206. frames with a negative PTS.
  8207. @item round
  8208. Timestamp (PTS) rounding method.
  8209. Possible values are:
  8210. @table @option
  8211. @item zero
  8212. round towards 0
  8213. @item inf
  8214. round away from 0
  8215. @item down
  8216. round towards -infinity
  8217. @item up
  8218. round towards +infinity
  8219. @item near
  8220. round to nearest
  8221. @end table
  8222. The default is @code{near}.
  8223. @item eof_action
  8224. Action performed when reading the last frame.
  8225. Possible values are:
  8226. @table @option
  8227. @item round
  8228. Use same timestamp rounding method as used for other frames.
  8229. @item pass
  8230. Pass through last frame if input duration has not been reached yet.
  8231. @end table
  8232. The default is @code{round}.
  8233. @end table
  8234. Alternatively, the options can be specified as a flat string:
  8235. @var{fps}[:@var{start_time}[:@var{round}]].
  8236. See also the @ref{setpts} filter.
  8237. @subsection Examples
  8238. @itemize
  8239. @item
  8240. A typical usage in order to set the fps to 25:
  8241. @example
  8242. fps=fps=25
  8243. @end example
  8244. @item
  8245. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8246. @example
  8247. fps=fps=film:round=near
  8248. @end example
  8249. @end itemize
  8250. @section framepack
  8251. Pack two different video streams into a stereoscopic video, setting proper
  8252. metadata on supported codecs. The two views should have the same size and
  8253. framerate and processing will stop when the shorter video ends. Please note
  8254. that you may conveniently adjust view properties with the @ref{scale} and
  8255. @ref{fps} filters.
  8256. It accepts the following parameters:
  8257. @table @option
  8258. @item format
  8259. The desired packing format. Supported values are:
  8260. @table @option
  8261. @item sbs
  8262. The views are next to each other (default).
  8263. @item tab
  8264. The views are on top of each other.
  8265. @item lines
  8266. The views are packed by line.
  8267. @item columns
  8268. The views are packed by column.
  8269. @item frameseq
  8270. The views are temporally interleaved.
  8271. @end table
  8272. @end table
  8273. Some examples:
  8274. @example
  8275. # Convert left and right views into a frame-sequential video
  8276. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8277. # Convert views into a side-by-side video with the same output resolution as the input
  8278. 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
  8279. @end example
  8280. @section framerate
  8281. Change the frame rate by interpolating new video output frames from the source
  8282. frames.
  8283. This filter is not designed to function correctly with interlaced media. If
  8284. you wish to change the frame rate of interlaced media then you are required
  8285. to deinterlace before this filter and re-interlace after this filter.
  8286. A description of the accepted options follows.
  8287. @table @option
  8288. @item fps
  8289. Specify the output frames per second. This option can also be specified
  8290. as a value alone. The default is @code{50}.
  8291. @item interp_start
  8292. Specify the start of a range where the output frame will be created as a
  8293. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8294. the default is @code{15}.
  8295. @item interp_end
  8296. Specify the end of a range where the output frame will be created as a
  8297. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8298. the default is @code{240}.
  8299. @item scene
  8300. Specify the level at which a scene change is detected as a value between
  8301. 0 and 100 to indicate a new scene; a low value reflects a low
  8302. probability for the current frame to introduce a new scene, while a higher
  8303. value means the current frame is more likely to be one.
  8304. The default is @code{8.2}.
  8305. @item flags
  8306. Specify flags influencing the filter process.
  8307. Available value for @var{flags} is:
  8308. @table @option
  8309. @item scene_change_detect, scd
  8310. Enable scene change detection using the value of the option @var{scene}.
  8311. This flag is enabled by default.
  8312. @end table
  8313. @end table
  8314. @section framestep
  8315. Select one frame every N-th frame.
  8316. This filter accepts the following option:
  8317. @table @option
  8318. @item step
  8319. Select frame after every @code{step} frames.
  8320. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8321. @end table
  8322. @section freezedetect
  8323. Detect frozen video.
  8324. This filter logs a message and sets frame metadata when it detects that the
  8325. input video has no significant change in content during a specified duration.
  8326. Video freeze detection calculates the mean average absolute difference of all
  8327. the components of video frames and compares it to a noise floor.
  8328. The printed times and duration are expressed in seconds. The
  8329. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8330. whose timestamp equals or exceeds the detection duration and it contains the
  8331. timestamp of the first frame of the freeze. The
  8332. @code{lavfi.freezedetect.freeze_duration} and
  8333. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8334. after the freeze.
  8335. The filter accepts the following options:
  8336. @table @option
  8337. @item noise, n
  8338. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8339. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8340. 0.001.
  8341. @item duration, d
  8342. Set freeze duration until notification (default is 2 seconds).
  8343. @end table
  8344. @anchor{frei0r}
  8345. @section frei0r
  8346. Apply a frei0r effect to the input video.
  8347. To enable the compilation of this filter, you need to install the frei0r
  8348. header and configure FFmpeg with @code{--enable-frei0r}.
  8349. It accepts the following parameters:
  8350. @table @option
  8351. @item filter_name
  8352. The name of the frei0r effect to load. If the environment variable
  8353. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8354. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8355. Otherwise, the standard frei0r paths are searched, in this order:
  8356. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8357. @file{/usr/lib/frei0r-1/}.
  8358. @item filter_params
  8359. A '|'-separated list of parameters to pass to the frei0r effect.
  8360. @end table
  8361. A frei0r effect parameter can be a boolean (its value is either
  8362. "y" or "n"), a double, a color (specified as
  8363. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8364. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8365. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8366. a position (specified as @var{X}/@var{Y}, where
  8367. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8368. The number and types of parameters depend on the loaded effect. If an
  8369. effect parameter is not specified, the default value is set.
  8370. @subsection Examples
  8371. @itemize
  8372. @item
  8373. Apply the distort0r effect, setting the first two double parameters:
  8374. @example
  8375. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8376. @end example
  8377. @item
  8378. Apply the colordistance effect, taking a color as the first parameter:
  8379. @example
  8380. frei0r=colordistance:0.2/0.3/0.4
  8381. frei0r=colordistance:violet
  8382. frei0r=colordistance:0x112233
  8383. @end example
  8384. @item
  8385. Apply the perspective effect, specifying the top left and top right image
  8386. positions:
  8387. @example
  8388. frei0r=perspective:0.2/0.2|0.8/0.2
  8389. @end example
  8390. @end itemize
  8391. For more information, see
  8392. @url{http://frei0r.dyne.org}
  8393. @section fspp
  8394. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8395. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8396. processing filter, one of them is performed once per block, not per pixel.
  8397. This allows for much higher speed.
  8398. The filter accepts the following options:
  8399. @table @option
  8400. @item quality
  8401. Set quality. This option defines the number of levels for averaging. It accepts
  8402. an integer in the range 4-5. Default value is @code{4}.
  8403. @item qp
  8404. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8405. If not set, the filter will use the QP from the video stream (if available).
  8406. @item strength
  8407. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8408. more details but also more artifacts, while higher values make the image smoother
  8409. but also blurrier. Default value is @code{0} − PSNR optimal.
  8410. @item use_bframe_qp
  8411. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8412. option may cause flicker since the B-Frames have often larger QP. Default is
  8413. @code{0} (not enabled).
  8414. @end table
  8415. @section gblur
  8416. Apply Gaussian blur filter.
  8417. The filter accepts the following options:
  8418. @table @option
  8419. @item sigma
  8420. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8421. @item steps
  8422. Set number of steps for Gaussian approximation. Default is @code{1}.
  8423. @item planes
  8424. Set which planes to filter. By default all planes are filtered.
  8425. @item sigmaV
  8426. Set vertical sigma, if negative it will be same as @code{sigma}.
  8427. Default is @code{-1}.
  8428. @end table
  8429. @subsection Commands
  8430. This filter supports same commands as options.
  8431. The command accepts the same syntax of the corresponding option.
  8432. If the specified expression is not valid, it is kept at its current
  8433. value.
  8434. @section geq
  8435. Apply generic equation to each pixel.
  8436. The filter accepts the following options:
  8437. @table @option
  8438. @item lum_expr, lum
  8439. Set the luminance expression.
  8440. @item cb_expr, cb
  8441. Set the chrominance blue expression.
  8442. @item cr_expr, cr
  8443. Set the chrominance red expression.
  8444. @item alpha_expr, a
  8445. Set the alpha expression.
  8446. @item red_expr, r
  8447. Set the red expression.
  8448. @item green_expr, g
  8449. Set the green expression.
  8450. @item blue_expr, b
  8451. Set the blue expression.
  8452. @end table
  8453. The colorspace is selected according to the specified options. If one
  8454. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8455. options is specified, the filter will automatically select a YCbCr
  8456. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8457. @option{blue_expr} options is specified, it will select an RGB
  8458. colorspace.
  8459. If one of the chrominance expression is not defined, it falls back on the other
  8460. one. If no alpha expression is specified it will evaluate to opaque value.
  8461. If none of chrominance expressions are specified, they will evaluate
  8462. to the luminance expression.
  8463. The expressions can use the following variables and functions:
  8464. @table @option
  8465. @item N
  8466. The sequential number of the filtered frame, starting from @code{0}.
  8467. @item X
  8468. @item Y
  8469. The coordinates of the current sample.
  8470. @item W
  8471. @item H
  8472. The width and height of the image.
  8473. @item SW
  8474. @item SH
  8475. Width and height scale depending on the currently filtered plane. It is the
  8476. ratio between the corresponding luma plane number of pixels and the current
  8477. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8478. @code{0.5,0.5} for chroma planes.
  8479. @item T
  8480. Time of the current frame, expressed in seconds.
  8481. @item p(x, y)
  8482. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8483. plane.
  8484. @item lum(x, y)
  8485. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8486. plane.
  8487. @item cb(x, y)
  8488. Return the value of the pixel at location (@var{x},@var{y}) of the
  8489. blue-difference chroma plane. Return 0 if there is no such plane.
  8490. @item cr(x, y)
  8491. Return the value of the pixel at location (@var{x},@var{y}) of the
  8492. red-difference chroma plane. Return 0 if there is no such plane.
  8493. @item r(x, y)
  8494. @item g(x, y)
  8495. @item b(x, y)
  8496. Return the value of the pixel at location (@var{x},@var{y}) of the
  8497. red/green/blue component. Return 0 if there is no such component.
  8498. @item alpha(x, y)
  8499. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8500. plane. Return 0 if there is no such plane.
  8501. @item interpolation
  8502. Set one of interpolation methods:
  8503. @table @option
  8504. @item nearest, n
  8505. @item bilinear, b
  8506. @end table
  8507. Default is bilinear.
  8508. @end table
  8509. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8510. automatically clipped to the closer edge.
  8511. @subsection Examples
  8512. @itemize
  8513. @item
  8514. Flip the image horizontally:
  8515. @example
  8516. geq=p(W-X\,Y)
  8517. @end example
  8518. @item
  8519. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8520. wavelength of 100 pixels:
  8521. @example
  8522. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8523. @end example
  8524. @item
  8525. Generate a fancy enigmatic moving light:
  8526. @example
  8527. 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
  8528. @end example
  8529. @item
  8530. Generate a quick emboss effect:
  8531. @example
  8532. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8533. @end example
  8534. @item
  8535. Modify RGB components depending on pixel position:
  8536. @example
  8537. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8538. @end example
  8539. @item
  8540. Create a radial gradient that is the same size as the input (also see
  8541. the @ref{vignette} filter):
  8542. @example
  8543. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8544. @end example
  8545. @end itemize
  8546. @section gradfun
  8547. Fix the banding artifacts that are sometimes introduced into nearly flat
  8548. regions by truncation to 8-bit color depth.
  8549. Interpolate the gradients that should go where the bands are, and
  8550. dither them.
  8551. It is designed for playback only. Do not use it prior to
  8552. lossy compression, because compression tends to lose the dither and
  8553. bring back the bands.
  8554. It accepts the following parameters:
  8555. @table @option
  8556. @item strength
  8557. The maximum amount by which the filter will change any one pixel. This is also
  8558. the threshold for detecting nearly flat regions. Acceptable values range from
  8559. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8560. valid range.
  8561. @item radius
  8562. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8563. gradients, but also prevents the filter from modifying the pixels near detailed
  8564. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8565. values will be clipped to the valid range.
  8566. @end table
  8567. Alternatively, the options can be specified as a flat string:
  8568. @var{strength}[:@var{radius}]
  8569. @subsection Examples
  8570. @itemize
  8571. @item
  8572. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8573. @example
  8574. gradfun=3.5:8
  8575. @end example
  8576. @item
  8577. Specify radius, omitting the strength (which will fall-back to the default
  8578. value):
  8579. @example
  8580. gradfun=radius=8
  8581. @end example
  8582. @end itemize
  8583. @section graphmonitor, agraphmonitor
  8584. Show various filtergraph stats.
  8585. With this filter one can debug complete filtergraph.
  8586. Especially issues with links filling with queued frames.
  8587. The filter accepts the following options:
  8588. @table @option
  8589. @item size, s
  8590. Set video output size. Default is @var{hd720}.
  8591. @item opacity, o
  8592. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8593. @item mode, m
  8594. Set output mode, can be @var{fulll} or @var{compact}.
  8595. In @var{compact} mode only filters with some queued frames have displayed stats.
  8596. @item flags, f
  8597. Set flags which enable which stats are shown in video.
  8598. Available values for flags are:
  8599. @table @samp
  8600. @item queue
  8601. Display number of queued frames in each link.
  8602. @item frame_count_in
  8603. Display number of frames taken from filter.
  8604. @item frame_count_out
  8605. Display number of frames given out from filter.
  8606. @item pts
  8607. Display current filtered frame pts.
  8608. @item time
  8609. Display current filtered frame time.
  8610. @item timebase
  8611. Display time base for filter link.
  8612. @item format
  8613. Display used format for filter link.
  8614. @item size
  8615. Display video size or number of audio channels in case of audio used by filter link.
  8616. @item rate
  8617. Display video frame rate or sample rate in case of audio used by filter link.
  8618. @end table
  8619. @item rate, r
  8620. Set upper limit for video rate of output stream, Default value is @var{25}.
  8621. This guarantee that output video frame rate will not be higher than this value.
  8622. @end table
  8623. @section greyedge
  8624. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8625. and corrects the scene colors accordingly.
  8626. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8627. The filter accepts the following options:
  8628. @table @option
  8629. @item difford
  8630. The order of differentiation to be applied on the scene. Must be chosen in the range
  8631. [0,2] and default value is 1.
  8632. @item minknorm
  8633. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8634. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8635. max value instead of calculating Minkowski distance.
  8636. @item sigma
  8637. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8638. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8639. can't be equal to 0 if @var{difford} is greater than 0.
  8640. @end table
  8641. @subsection Examples
  8642. @itemize
  8643. @item
  8644. Grey Edge:
  8645. @example
  8646. greyedge=difford=1:minknorm=5:sigma=2
  8647. @end example
  8648. @item
  8649. Max Edge:
  8650. @example
  8651. greyedge=difford=1:minknorm=0:sigma=2
  8652. @end example
  8653. @end itemize
  8654. @anchor{haldclut}
  8655. @section haldclut
  8656. Apply a Hald CLUT to a video stream.
  8657. First input is the video stream to process, and second one is the Hald CLUT.
  8658. The Hald CLUT input can be a simple picture or a complete video stream.
  8659. The filter accepts the following options:
  8660. @table @option
  8661. @item shortest
  8662. Force termination when the shortest input terminates. Default is @code{0}.
  8663. @item repeatlast
  8664. Continue applying the last CLUT after the end of the stream. A value of
  8665. @code{0} disable the filter after the last frame of the CLUT is reached.
  8666. Default is @code{1}.
  8667. @end table
  8668. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8669. filters share the same internals).
  8670. This filter also supports the @ref{framesync} options.
  8671. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8672. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8673. @subsection Workflow examples
  8674. @subsubsection Hald CLUT video stream
  8675. Generate an identity Hald CLUT stream altered with various effects:
  8676. @example
  8677. 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
  8678. @end example
  8679. Note: make sure you use a lossless codec.
  8680. Then use it with @code{haldclut} to apply it on some random stream:
  8681. @example
  8682. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8683. @end example
  8684. The Hald CLUT will be applied to the 10 first seconds (duration of
  8685. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8686. to the remaining frames of the @code{mandelbrot} stream.
  8687. @subsubsection Hald CLUT with preview
  8688. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8689. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8690. biggest possible square starting at the top left of the picture. The remaining
  8691. padding pixels (bottom or right) will be ignored. This area can be used to add
  8692. a preview of the Hald CLUT.
  8693. Typically, the following generated Hald CLUT will be supported by the
  8694. @code{haldclut} filter:
  8695. @example
  8696. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8697. pad=iw+320 [padded_clut];
  8698. smptebars=s=320x256, split [a][b];
  8699. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8700. [main][b] overlay=W-320" -frames:v 1 clut.png
  8701. @end example
  8702. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8703. bars are displayed on the right-top, and below the same color bars processed by
  8704. the color changes.
  8705. Then, the effect of this Hald CLUT can be visualized with:
  8706. @example
  8707. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8708. @end example
  8709. @section hflip
  8710. Flip the input video horizontally.
  8711. For example, to horizontally flip the input video with @command{ffmpeg}:
  8712. @example
  8713. ffmpeg -i in.avi -vf "hflip" out.avi
  8714. @end example
  8715. @section histeq
  8716. This filter applies a global color histogram equalization on a
  8717. per-frame basis.
  8718. It can be used to correct video that has a compressed range of pixel
  8719. intensities. The filter redistributes the pixel intensities to
  8720. equalize their distribution across the intensity range. It may be
  8721. viewed as an "automatically adjusting contrast filter". This filter is
  8722. useful only for correcting degraded or poorly captured source
  8723. video.
  8724. The filter accepts the following options:
  8725. @table @option
  8726. @item strength
  8727. Determine the amount of equalization to be applied. As the strength
  8728. is reduced, the distribution of pixel intensities more-and-more
  8729. approaches that of the input frame. The value must be a float number
  8730. in the range [0,1] and defaults to 0.200.
  8731. @item intensity
  8732. Set the maximum intensity that can generated and scale the output
  8733. values appropriately. The strength should be set as desired and then
  8734. the intensity can be limited if needed to avoid washing-out. The value
  8735. must be a float number in the range [0,1] and defaults to 0.210.
  8736. @item antibanding
  8737. Set the antibanding level. If enabled the filter will randomly vary
  8738. the luminance of output pixels by a small amount to avoid banding of
  8739. the histogram. Possible values are @code{none}, @code{weak} or
  8740. @code{strong}. It defaults to @code{none}.
  8741. @end table
  8742. @section histogram
  8743. Compute and draw a color distribution histogram for the input video.
  8744. The computed histogram is a representation of the color component
  8745. distribution in an image.
  8746. Standard histogram displays the color components distribution in an image.
  8747. Displays color graph for each color component. Shows distribution of
  8748. the Y, U, V, A or R, G, B components, depending on input format, in the
  8749. current frame. Below each graph a color component scale meter is shown.
  8750. The filter accepts the following options:
  8751. @table @option
  8752. @item level_height
  8753. Set height of level. Default value is @code{200}.
  8754. Allowed range is [50, 2048].
  8755. @item scale_height
  8756. Set height of color scale. Default value is @code{12}.
  8757. Allowed range is [0, 40].
  8758. @item display_mode
  8759. Set display mode.
  8760. It accepts the following values:
  8761. @table @samp
  8762. @item stack
  8763. Per color component graphs are placed below each other.
  8764. @item parade
  8765. Per color component graphs are placed side by side.
  8766. @item overlay
  8767. Presents information identical to that in the @code{parade}, except
  8768. that the graphs representing color components are superimposed directly
  8769. over one another.
  8770. @end table
  8771. Default is @code{stack}.
  8772. @item levels_mode
  8773. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8774. Default is @code{linear}.
  8775. @item components
  8776. Set what color components to display.
  8777. Default is @code{7}.
  8778. @item fgopacity
  8779. Set foreground opacity. Default is @code{0.7}.
  8780. @item bgopacity
  8781. Set background opacity. Default is @code{0.5}.
  8782. @end table
  8783. @subsection Examples
  8784. @itemize
  8785. @item
  8786. Calculate and draw histogram:
  8787. @example
  8788. ffplay -i input -vf histogram
  8789. @end example
  8790. @end itemize
  8791. @anchor{hqdn3d}
  8792. @section hqdn3d
  8793. This is a high precision/quality 3d denoise filter. It aims to reduce
  8794. image noise, producing smooth images and making still images really
  8795. still. It should enhance compressibility.
  8796. It accepts the following optional parameters:
  8797. @table @option
  8798. @item luma_spatial
  8799. A non-negative floating point number which specifies spatial luma strength.
  8800. It defaults to 4.0.
  8801. @item chroma_spatial
  8802. A non-negative floating point number which specifies spatial chroma strength.
  8803. It defaults to 3.0*@var{luma_spatial}/4.0.
  8804. @item luma_tmp
  8805. A floating point number which specifies luma temporal strength. It defaults to
  8806. 6.0*@var{luma_spatial}/4.0.
  8807. @item chroma_tmp
  8808. A floating point number which specifies chroma temporal strength. It defaults to
  8809. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8810. @end table
  8811. @anchor{hwdownload}
  8812. @section hwdownload
  8813. Download hardware frames to system memory.
  8814. The input must be in hardware frames, and the output a non-hardware format.
  8815. Not all formats will be supported on the output - it may be necessary to insert
  8816. an additional @option{format} filter immediately following in the graph to get
  8817. the output in a supported format.
  8818. @section hwmap
  8819. Map hardware frames to system memory or to another device.
  8820. This filter has several different modes of operation; which one is used depends
  8821. on the input and output formats:
  8822. @itemize
  8823. @item
  8824. Hardware frame input, normal frame output
  8825. Map the input frames to system memory and pass them to the output. If the
  8826. original hardware frame is later required (for example, after overlaying
  8827. something else on part of it), the @option{hwmap} filter can be used again
  8828. in the next mode to retrieve it.
  8829. @item
  8830. Normal frame input, hardware frame output
  8831. If the input is actually a software-mapped hardware frame, then unmap it -
  8832. that is, return the original hardware frame.
  8833. Otherwise, a device must be provided. Create new hardware surfaces on that
  8834. device for the output, then map them back to the software format at the input
  8835. and give those frames to the preceding filter. This will then act like the
  8836. @option{hwupload} filter, but may be able to avoid an additional copy when
  8837. the input is already in a compatible format.
  8838. @item
  8839. Hardware frame input and output
  8840. A device must be supplied for the output, either directly or with the
  8841. @option{derive_device} option. The input and output devices must be of
  8842. different types and compatible - the exact meaning of this is
  8843. system-dependent, but typically it means that they must refer to the same
  8844. underlying hardware context (for example, refer to the same graphics card).
  8845. If the input frames were originally created on the output device, then unmap
  8846. to retrieve the original frames.
  8847. Otherwise, map the frames to the output device - create new hardware frames
  8848. on the output corresponding to the frames on the input.
  8849. @end itemize
  8850. The following additional parameters are accepted:
  8851. @table @option
  8852. @item mode
  8853. Set the frame mapping mode. Some combination of:
  8854. @table @var
  8855. @item read
  8856. The mapped frame should be readable.
  8857. @item write
  8858. The mapped frame should be writeable.
  8859. @item overwrite
  8860. The mapping will always overwrite the entire frame.
  8861. This may improve performance in some cases, as the original contents of the
  8862. frame need not be loaded.
  8863. @item direct
  8864. The mapping must not involve any copying.
  8865. Indirect mappings to copies of frames are created in some cases where either
  8866. direct mapping is not possible or it would have unexpected properties.
  8867. Setting this flag ensures that the mapping is direct and will fail if that is
  8868. not possible.
  8869. @end table
  8870. Defaults to @var{read+write} if not specified.
  8871. @item derive_device @var{type}
  8872. Rather than using the device supplied at initialisation, instead derive a new
  8873. device of type @var{type} from the device the input frames exist on.
  8874. @item reverse
  8875. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8876. and map them back to the source. This may be necessary in some cases where
  8877. a mapping in one direction is required but only the opposite direction is
  8878. supported by the devices being used.
  8879. This option is dangerous - it may break the preceding filter in undefined
  8880. ways if there are any additional constraints on that filter's output.
  8881. Do not use it without fully understanding the implications of its use.
  8882. @end table
  8883. @anchor{hwupload}
  8884. @section hwupload
  8885. Upload system memory frames to hardware surfaces.
  8886. The device to upload to must be supplied when the filter is initialised. If
  8887. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8888. option.
  8889. @anchor{hwupload_cuda}
  8890. @section hwupload_cuda
  8891. Upload system memory frames to a CUDA device.
  8892. It accepts the following optional parameters:
  8893. @table @option
  8894. @item device
  8895. The number of the CUDA device to use
  8896. @end table
  8897. @section hqx
  8898. Apply a high-quality magnification filter designed for pixel art. This filter
  8899. was originally created by Maxim Stepin.
  8900. It accepts the following option:
  8901. @table @option
  8902. @item n
  8903. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8904. @code{hq3x} and @code{4} for @code{hq4x}.
  8905. Default is @code{3}.
  8906. @end table
  8907. @section hstack
  8908. Stack input videos horizontally.
  8909. All streams must be of same pixel format and of same height.
  8910. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8911. to create same output.
  8912. The filter accepts the following option:
  8913. @table @option
  8914. @item inputs
  8915. Set number of input streams. Default is 2.
  8916. @item shortest
  8917. If set to 1, force the output to terminate when the shortest input
  8918. terminates. Default value is 0.
  8919. @end table
  8920. @section hue
  8921. Modify the hue and/or the saturation of the input.
  8922. It accepts the following parameters:
  8923. @table @option
  8924. @item h
  8925. Specify the hue angle as a number of degrees. It accepts an expression,
  8926. and defaults to "0".
  8927. @item s
  8928. Specify the saturation in the [-10,10] range. It accepts an expression and
  8929. defaults to "1".
  8930. @item H
  8931. Specify the hue angle as a number of radians. It accepts an
  8932. expression, and defaults to "0".
  8933. @item b
  8934. Specify the brightness in the [-10,10] range. It accepts an expression and
  8935. defaults to "0".
  8936. @end table
  8937. @option{h} and @option{H} are mutually exclusive, and can't be
  8938. specified at the same time.
  8939. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8940. expressions containing the following constants:
  8941. @table @option
  8942. @item n
  8943. frame count of the input frame starting from 0
  8944. @item pts
  8945. presentation timestamp of the input frame expressed in time base units
  8946. @item r
  8947. frame rate of the input video, NAN if the input frame rate is unknown
  8948. @item t
  8949. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8950. @item tb
  8951. time base of the input video
  8952. @end table
  8953. @subsection Examples
  8954. @itemize
  8955. @item
  8956. Set the hue to 90 degrees and the saturation to 1.0:
  8957. @example
  8958. hue=h=90:s=1
  8959. @end example
  8960. @item
  8961. Same command but expressing the hue in radians:
  8962. @example
  8963. hue=H=PI/2:s=1
  8964. @end example
  8965. @item
  8966. Rotate hue and make the saturation swing between 0
  8967. and 2 over a period of 1 second:
  8968. @example
  8969. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8970. @end example
  8971. @item
  8972. Apply a 3 seconds saturation fade-in effect starting at 0:
  8973. @example
  8974. hue="s=min(t/3\,1)"
  8975. @end example
  8976. The general fade-in expression can be written as:
  8977. @example
  8978. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8979. @end example
  8980. @item
  8981. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8982. @example
  8983. hue="s=max(0\, min(1\, (8-t)/3))"
  8984. @end example
  8985. The general fade-out expression can be written as:
  8986. @example
  8987. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8988. @end example
  8989. @end itemize
  8990. @subsection Commands
  8991. This filter supports the following commands:
  8992. @table @option
  8993. @item b
  8994. @item s
  8995. @item h
  8996. @item H
  8997. Modify the hue and/or the saturation and/or brightness of the input video.
  8998. The command accepts the same syntax of the corresponding option.
  8999. If the specified expression is not valid, it is kept at its current
  9000. value.
  9001. @end table
  9002. @section hysteresis
  9003. Grow first stream into second stream by connecting components.
  9004. This makes it possible to build more robust edge masks.
  9005. This filter accepts the following options:
  9006. @table @option
  9007. @item planes
  9008. Set which planes will be processed as bitmap, unprocessed planes will be
  9009. copied from first stream.
  9010. By default value 0xf, all planes will be processed.
  9011. @item threshold
  9012. Set threshold which is used in filtering. If pixel component value is higher than
  9013. this value filter algorithm for connecting components is activated.
  9014. By default value is 0.
  9015. @end table
  9016. @section idet
  9017. Detect video interlacing type.
  9018. This filter tries to detect if the input frames are interlaced, progressive,
  9019. top or bottom field first. It will also try to detect fields that are
  9020. repeated between adjacent frames (a sign of telecine).
  9021. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9022. Multiple frame detection incorporates the classification history of previous frames.
  9023. The filter will log these metadata values:
  9024. @table @option
  9025. @item single.current_frame
  9026. Detected type of current frame using single-frame detection. One of:
  9027. ``tff'' (top field first), ``bff'' (bottom field first),
  9028. ``progressive'', or ``undetermined''
  9029. @item single.tff
  9030. Cumulative number of frames detected as top field first using single-frame detection.
  9031. @item multiple.tff
  9032. Cumulative number of frames detected as top field first using multiple-frame detection.
  9033. @item single.bff
  9034. Cumulative number of frames detected as bottom field first using single-frame detection.
  9035. @item multiple.current_frame
  9036. Detected type of current frame using multiple-frame detection. One of:
  9037. ``tff'' (top field first), ``bff'' (bottom field first),
  9038. ``progressive'', or ``undetermined''
  9039. @item multiple.bff
  9040. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9041. @item single.progressive
  9042. Cumulative number of frames detected as progressive using single-frame detection.
  9043. @item multiple.progressive
  9044. Cumulative number of frames detected as progressive using multiple-frame detection.
  9045. @item single.undetermined
  9046. Cumulative number of frames that could not be classified using single-frame detection.
  9047. @item multiple.undetermined
  9048. Cumulative number of frames that could not be classified using multiple-frame detection.
  9049. @item repeated.current_frame
  9050. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9051. @item repeated.neither
  9052. Cumulative number of frames with no repeated field.
  9053. @item repeated.top
  9054. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9055. @item repeated.bottom
  9056. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9057. @end table
  9058. The filter accepts the following options:
  9059. @table @option
  9060. @item intl_thres
  9061. Set interlacing threshold.
  9062. @item prog_thres
  9063. Set progressive threshold.
  9064. @item rep_thres
  9065. Threshold for repeated field detection.
  9066. @item half_life
  9067. Number of frames after which a given frame's contribution to the
  9068. statistics is halved (i.e., it contributes only 0.5 to its
  9069. classification). The default of 0 means that all frames seen are given
  9070. full weight of 1.0 forever.
  9071. @item analyze_interlaced_flag
  9072. When this is not 0 then idet will use the specified number of frames to determine
  9073. if the interlaced flag is accurate, it will not count undetermined frames.
  9074. If the flag is found to be accurate it will be used without any further
  9075. computations, if it is found to be inaccurate it will be cleared without any
  9076. further computations. This allows inserting the idet filter as a low computational
  9077. method to clean up the interlaced flag
  9078. @end table
  9079. @section il
  9080. Deinterleave or interleave fields.
  9081. This filter allows one to process interlaced images fields without
  9082. deinterlacing them. Deinterleaving splits the input frame into 2
  9083. fields (so called half pictures). Odd lines are moved to the top
  9084. half of the output image, even lines to the bottom half.
  9085. You can process (filter) them independently and then re-interleave them.
  9086. The filter accepts the following options:
  9087. @table @option
  9088. @item luma_mode, l
  9089. @item chroma_mode, c
  9090. @item alpha_mode, a
  9091. Available values for @var{luma_mode}, @var{chroma_mode} and
  9092. @var{alpha_mode} are:
  9093. @table @samp
  9094. @item none
  9095. Do nothing.
  9096. @item deinterleave, d
  9097. Deinterleave fields, placing one above the other.
  9098. @item interleave, i
  9099. Interleave fields. Reverse the effect of deinterleaving.
  9100. @end table
  9101. Default value is @code{none}.
  9102. @item luma_swap, ls
  9103. @item chroma_swap, cs
  9104. @item alpha_swap, as
  9105. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9106. @end table
  9107. @section inflate
  9108. Apply inflate effect to the video.
  9109. This filter replaces the pixel by the local(3x3) average by taking into account
  9110. only values higher than the pixel.
  9111. It accepts the following options:
  9112. @table @option
  9113. @item threshold0
  9114. @item threshold1
  9115. @item threshold2
  9116. @item threshold3
  9117. Limit the maximum change for each plane, default is 65535.
  9118. If 0, plane will remain unchanged.
  9119. @end table
  9120. @section interlace
  9121. Simple interlacing filter from progressive contents. This interleaves upper (or
  9122. lower) lines from odd frames with lower (or upper) lines from even frames,
  9123. halving the frame rate and preserving image height.
  9124. @example
  9125. Original Original New Frame
  9126. Frame 'j' Frame 'j+1' (tff)
  9127. ========== =========== ==================
  9128. Line 0 --------------------> Frame 'j' Line 0
  9129. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9130. Line 2 ---------------------> Frame 'j' Line 2
  9131. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9132. ... ... ...
  9133. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9134. @end example
  9135. It accepts the following optional parameters:
  9136. @table @option
  9137. @item scan
  9138. This determines whether the interlaced frame is taken from the even
  9139. (tff - default) or odd (bff) lines of the progressive frame.
  9140. @item lowpass
  9141. Vertical lowpass filter to avoid twitter interlacing and
  9142. reduce moire patterns.
  9143. @table @samp
  9144. @item 0, off
  9145. Disable vertical lowpass filter
  9146. @item 1, linear
  9147. Enable linear filter (default)
  9148. @item 2, complex
  9149. Enable complex filter. This will slightly less reduce twitter and moire
  9150. but better retain detail and subjective sharpness impression.
  9151. @end table
  9152. @end table
  9153. @section kerndeint
  9154. Deinterlace input video by applying Donald Graft's adaptive kernel
  9155. deinterling. Work on interlaced parts of a video to produce
  9156. progressive frames.
  9157. The description of the accepted parameters follows.
  9158. @table @option
  9159. @item thresh
  9160. Set the threshold which affects the filter's tolerance when
  9161. determining if a pixel line must be processed. It must be an integer
  9162. in the range [0,255] and defaults to 10. A value of 0 will result in
  9163. applying the process on every pixels.
  9164. @item map
  9165. Paint pixels exceeding the threshold value to white if set to 1.
  9166. Default is 0.
  9167. @item order
  9168. Set the fields order. Swap fields if set to 1, leave fields alone if
  9169. 0. Default is 0.
  9170. @item sharp
  9171. Enable additional sharpening if set to 1. Default is 0.
  9172. @item twoway
  9173. Enable twoway sharpening if set to 1. Default is 0.
  9174. @end table
  9175. @subsection Examples
  9176. @itemize
  9177. @item
  9178. Apply default values:
  9179. @example
  9180. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9181. @end example
  9182. @item
  9183. Enable additional sharpening:
  9184. @example
  9185. kerndeint=sharp=1
  9186. @end example
  9187. @item
  9188. Paint processed pixels in white:
  9189. @example
  9190. kerndeint=map=1
  9191. @end example
  9192. @end itemize
  9193. @section lagfun
  9194. Slowly update darker pixels.
  9195. This filter makes short flashes of light appear longer.
  9196. This filter accepts the following options:
  9197. @table @option
  9198. @item decay
  9199. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9200. @item planes
  9201. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9202. @end table
  9203. @section lenscorrection
  9204. Correct radial lens distortion
  9205. This filter can be used to correct for radial distortion as can result from the use
  9206. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9207. one can use tools available for example as part of opencv or simply trial-and-error.
  9208. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9209. and extract the k1 and k2 coefficients from the resulting matrix.
  9210. Note that effectively the same filter is available in the open-source tools Krita and
  9211. Digikam from the KDE project.
  9212. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9213. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9214. brightness distribution, so you may want to use both filters together in certain
  9215. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9216. be applied before or after lens correction.
  9217. @subsection Options
  9218. The filter accepts the following options:
  9219. @table @option
  9220. @item cx
  9221. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9222. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9223. width. Default is 0.5.
  9224. @item cy
  9225. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9226. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9227. height. Default is 0.5.
  9228. @item k1
  9229. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9230. no correction. Default is 0.
  9231. @item k2
  9232. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9233. 0 means no correction. Default is 0.
  9234. @end table
  9235. The formula that generates the correction is:
  9236. @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)
  9237. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9238. distances from the focal point in the source and target images, respectively.
  9239. @section lensfun
  9240. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9241. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9242. to apply the lens correction. The filter will load the lensfun database and
  9243. query it to find the corresponding camera and lens entries in the database. As
  9244. long as these entries can be found with the given options, the filter can
  9245. perform corrections on frames. Note that incomplete strings will result in the
  9246. filter choosing the best match with the given options, and the filter will
  9247. output the chosen camera and lens models (logged with level "info"). You must
  9248. provide the make, camera model, and lens model as they are required.
  9249. The filter accepts the following options:
  9250. @table @option
  9251. @item make
  9252. The make of the camera (for example, "Canon"). This option is required.
  9253. @item model
  9254. The model of the camera (for example, "Canon EOS 100D"). This option is
  9255. required.
  9256. @item lens_model
  9257. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9258. option is required.
  9259. @item mode
  9260. The type of correction to apply. The following values are valid options:
  9261. @table @samp
  9262. @item vignetting
  9263. Enables fixing lens vignetting.
  9264. @item geometry
  9265. Enables fixing lens geometry. This is the default.
  9266. @item subpixel
  9267. Enables fixing chromatic aberrations.
  9268. @item vig_geo
  9269. Enables fixing lens vignetting and lens geometry.
  9270. @item vig_subpixel
  9271. Enables fixing lens vignetting and chromatic aberrations.
  9272. @item distortion
  9273. Enables fixing both lens geometry and chromatic aberrations.
  9274. @item all
  9275. Enables all possible corrections.
  9276. @end table
  9277. @item focal_length
  9278. The focal length of the image/video (zoom; expected constant for video). For
  9279. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9280. range should be chosen when using that lens. Default 18.
  9281. @item aperture
  9282. The aperture of the image/video (expected constant for video). Note that
  9283. aperture is only used for vignetting correction. Default 3.5.
  9284. @item focus_distance
  9285. The focus distance of the image/video (expected constant for video). Note that
  9286. focus distance is only used for vignetting and only slightly affects the
  9287. vignetting correction process. If unknown, leave it at the default value (which
  9288. is 1000).
  9289. @item scale
  9290. The scale factor which is applied after transformation. After correction the
  9291. video is no longer necessarily rectangular. This parameter controls how much of
  9292. the resulting image is visible. The value 0 means that a value will be chosen
  9293. automatically such that there is little or no unmapped area in the output
  9294. image. 1.0 means that no additional scaling is done. Lower values may result
  9295. in more of the corrected image being visible, while higher values may avoid
  9296. unmapped areas in the output.
  9297. @item target_geometry
  9298. The target geometry of the output image/video. The following values are valid
  9299. options:
  9300. @table @samp
  9301. @item rectilinear (default)
  9302. @item fisheye
  9303. @item panoramic
  9304. @item equirectangular
  9305. @item fisheye_orthographic
  9306. @item fisheye_stereographic
  9307. @item fisheye_equisolid
  9308. @item fisheye_thoby
  9309. @end table
  9310. @item reverse
  9311. Apply the reverse of image correction (instead of correcting distortion, apply
  9312. it).
  9313. @item interpolation
  9314. The type of interpolation used when correcting distortion. The following values
  9315. are valid options:
  9316. @table @samp
  9317. @item nearest
  9318. @item linear (default)
  9319. @item lanczos
  9320. @end table
  9321. @end table
  9322. @subsection Examples
  9323. @itemize
  9324. @item
  9325. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9326. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9327. aperture of "8.0".
  9328. @example
  9329. 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
  9330. @end example
  9331. @item
  9332. Apply the same as before, but only for the first 5 seconds of video.
  9333. @example
  9334. 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
  9335. @end example
  9336. @end itemize
  9337. @section libvmaf
  9338. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9339. score between two input videos.
  9340. The obtained VMAF score is printed through the logging system.
  9341. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9342. After installing the library it can be enabled using:
  9343. @code{./configure --enable-libvmaf --enable-version3}.
  9344. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9345. The filter has following options:
  9346. @table @option
  9347. @item model_path
  9348. Set the model path which is to be used for SVM.
  9349. Default value: @code{"vmaf_v0.6.1.pkl"}
  9350. @item log_path
  9351. Set the file path to be used to store logs.
  9352. @item log_fmt
  9353. Set the format of the log file (xml or json).
  9354. @item enable_transform
  9355. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9356. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9357. Default value: @code{false}
  9358. @item phone_model
  9359. Invokes the phone model which will generate VMAF scores higher than in the
  9360. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9361. @item psnr
  9362. Enables computing psnr along with vmaf.
  9363. @item ssim
  9364. Enables computing ssim along with vmaf.
  9365. @item ms_ssim
  9366. Enables computing ms_ssim along with vmaf.
  9367. @item pool
  9368. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  9369. @item n_threads
  9370. Set number of threads to be used when computing vmaf.
  9371. @item n_subsample
  9372. Set interval for frame subsampling used when computing vmaf.
  9373. @item enable_conf_interval
  9374. Enables confidence interval.
  9375. @end table
  9376. This filter also supports the @ref{framesync} options.
  9377. @subsection Examples
  9378. @itemize
  9379. @item
  9380. On the below examples the input file @file{main.mpg} being processed is
  9381. compared with the reference file @file{ref.mpg}.
  9382. @example
  9383. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9384. @end example
  9385. @item
  9386. Example with options:
  9387. @example
  9388. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9389. @end example
  9390. @item
  9391. Example with options and different containers:
  9392. @example
  9393. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=1/AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=1/AVTB,setpts=PTS-STARTPTS[ref];[main][ref]libvmaf=psnr=1:log_fmt=json" -f null -
  9394. @end example
  9395. @end itemize
  9396. @section limiter
  9397. Limits the pixel components values to the specified range [min, max].
  9398. The filter accepts the following options:
  9399. @table @option
  9400. @item min
  9401. Lower bound. Defaults to the lowest allowed value for the input.
  9402. @item max
  9403. Upper bound. Defaults to the highest allowed value for the input.
  9404. @item planes
  9405. Specify which planes will be processed. Defaults to all available.
  9406. @end table
  9407. @section loop
  9408. Loop video frames.
  9409. The filter accepts the following options:
  9410. @table @option
  9411. @item loop
  9412. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9413. Default is 0.
  9414. @item size
  9415. Set maximal size in number of frames. Default is 0.
  9416. @item start
  9417. Set first frame of loop. Default is 0.
  9418. @end table
  9419. @subsection Examples
  9420. @itemize
  9421. @item
  9422. Loop single first frame infinitely:
  9423. @example
  9424. loop=loop=-1:size=1:start=0
  9425. @end example
  9426. @item
  9427. Loop single first frame 10 times:
  9428. @example
  9429. loop=loop=10:size=1:start=0
  9430. @end example
  9431. @item
  9432. Loop 10 first frames 5 times:
  9433. @example
  9434. loop=loop=5:size=10:start=0
  9435. @end example
  9436. @end itemize
  9437. @section lut1d
  9438. Apply a 1D LUT to an input video.
  9439. The filter accepts the following options:
  9440. @table @option
  9441. @item file
  9442. Set the 1D LUT file name.
  9443. Currently supported formats:
  9444. @table @samp
  9445. @item cube
  9446. Iridas
  9447. @item csp
  9448. cineSpace
  9449. @end table
  9450. @item interp
  9451. Select interpolation mode.
  9452. Available values are:
  9453. @table @samp
  9454. @item nearest
  9455. Use values from the nearest defined point.
  9456. @item linear
  9457. Interpolate values using the linear interpolation.
  9458. @item cosine
  9459. Interpolate values using the cosine interpolation.
  9460. @item cubic
  9461. Interpolate values using the cubic interpolation.
  9462. @item spline
  9463. Interpolate values using the spline interpolation.
  9464. @end table
  9465. @end table
  9466. @anchor{lut3d}
  9467. @section lut3d
  9468. Apply a 3D LUT to an input video.
  9469. The filter accepts the following options:
  9470. @table @option
  9471. @item file
  9472. Set the 3D LUT file name.
  9473. Currently supported formats:
  9474. @table @samp
  9475. @item 3dl
  9476. AfterEffects
  9477. @item cube
  9478. Iridas
  9479. @item dat
  9480. DaVinci
  9481. @item m3d
  9482. Pandora
  9483. @item csp
  9484. cineSpace
  9485. @end table
  9486. @item interp
  9487. Select interpolation mode.
  9488. Available values are:
  9489. @table @samp
  9490. @item nearest
  9491. Use values from the nearest defined point.
  9492. @item trilinear
  9493. Interpolate values using the 8 points defining a cube.
  9494. @item tetrahedral
  9495. Interpolate values using a tetrahedron.
  9496. @end table
  9497. @end table
  9498. @section lumakey
  9499. Turn certain luma values into transparency.
  9500. The filter accepts the following options:
  9501. @table @option
  9502. @item threshold
  9503. Set the luma which will be used as base for transparency.
  9504. Default value is @code{0}.
  9505. @item tolerance
  9506. Set the range of luma values to be keyed out.
  9507. Default value is @code{0}.
  9508. @item softness
  9509. Set the range of softness. Default value is @code{0}.
  9510. Use this to control gradual transition from zero to full transparency.
  9511. @end table
  9512. @section lut, lutrgb, lutyuv
  9513. Compute a look-up table for binding each pixel component input value
  9514. to an output value, and apply it to the input video.
  9515. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9516. to an RGB input video.
  9517. These filters accept the following parameters:
  9518. @table @option
  9519. @item c0
  9520. set first pixel component expression
  9521. @item c1
  9522. set second pixel component expression
  9523. @item c2
  9524. set third pixel component expression
  9525. @item c3
  9526. set fourth pixel component expression, corresponds to the alpha component
  9527. @item r
  9528. set red component expression
  9529. @item g
  9530. set green component expression
  9531. @item b
  9532. set blue component expression
  9533. @item a
  9534. alpha component expression
  9535. @item y
  9536. set Y/luminance component expression
  9537. @item u
  9538. set U/Cb component expression
  9539. @item v
  9540. set V/Cr component expression
  9541. @end table
  9542. Each of them specifies the expression to use for computing the lookup table for
  9543. the corresponding pixel component values.
  9544. The exact component associated to each of the @var{c*} options depends on the
  9545. format in input.
  9546. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9547. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9548. The expressions can contain the following constants and functions:
  9549. @table @option
  9550. @item w
  9551. @item h
  9552. The input width and height.
  9553. @item val
  9554. The input value for the pixel component.
  9555. @item clipval
  9556. The input value, clipped to the @var{minval}-@var{maxval} range.
  9557. @item maxval
  9558. The maximum value for the pixel component.
  9559. @item minval
  9560. The minimum value for the pixel component.
  9561. @item negval
  9562. The negated value for the pixel component value, clipped to the
  9563. @var{minval}-@var{maxval} range; it corresponds to the expression
  9564. "maxval-clipval+minval".
  9565. @item clip(val)
  9566. The computed value in @var{val}, clipped to the
  9567. @var{minval}-@var{maxval} range.
  9568. @item gammaval(gamma)
  9569. The computed gamma correction value of the pixel component value,
  9570. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9571. expression
  9572. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9573. @end table
  9574. All expressions default to "val".
  9575. @subsection Examples
  9576. @itemize
  9577. @item
  9578. Negate input video:
  9579. @example
  9580. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9581. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9582. @end example
  9583. The above is the same as:
  9584. @example
  9585. lutrgb="r=negval:g=negval:b=negval"
  9586. lutyuv="y=negval:u=negval:v=negval"
  9587. @end example
  9588. @item
  9589. Negate luminance:
  9590. @example
  9591. lutyuv=y=negval
  9592. @end example
  9593. @item
  9594. Remove chroma components, turning the video into a graytone image:
  9595. @example
  9596. lutyuv="u=128:v=128"
  9597. @end example
  9598. @item
  9599. Apply a luma burning effect:
  9600. @example
  9601. lutyuv="y=2*val"
  9602. @end example
  9603. @item
  9604. Remove green and blue components:
  9605. @example
  9606. lutrgb="g=0:b=0"
  9607. @end example
  9608. @item
  9609. Set a constant alpha channel value on input:
  9610. @example
  9611. format=rgba,lutrgb=a="maxval-minval/2"
  9612. @end example
  9613. @item
  9614. Correct luminance gamma by a factor of 0.5:
  9615. @example
  9616. lutyuv=y=gammaval(0.5)
  9617. @end example
  9618. @item
  9619. Discard least significant bits of luma:
  9620. @example
  9621. lutyuv=y='bitand(val, 128+64+32)'
  9622. @end example
  9623. @item
  9624. Technicolor like effect:
  9625. @example
  9626. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9627. @end example
  9628. @end itemize
  9629. @section lut2, tlut2
  9630. The @code{lut2} filter takes two input streams and outputs one
  9631. stream.
  9632. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9633. from one single stream.
  9634. This filter accepts the following parameters:
  9635. @table @option
  9636. @item c0
  9637. set first pixel component expression
  9638. @item c1
  9639. set second pixel component expression
  9640. @item c2
  9641. set third pixel component expression
  9642. @item c3
  9643. set fourth pixel component expression, corresponds to the alpha component
  9644. @item d
  9645. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9646. which means bit depth is automatically picked from first input format.
  9647. @end table
  9648. Each of them specifies the expression to use for computing the lookup table for
  9649. the corresponding pixel component values.
  9650. The exact component associated to each of the @var{c*} options depends on the
  9651. format in inputs.
  9652. The expressions can contain the following constants:
  9653. @table @option
  9654. @item w
  9655. @item h
  9656. The input width and height.
  9657. @item x
  9658. The first input value for the pixel component.
  9659. @item y
  9660. The second input value for the pixel component.
  9661. @item bdx
  9662. The first input video bit depth.
  9663. @item bdy
  9664. The second input video bit depth.
  9665. @end table
  9666. All expressions default to "x".
  9667. @subsection Examples
  9668. @itemize
  9669. @item
  9670. Highlight differences between two RGB video streams:
  9671. @example
  9672. 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)'
  9673. @end example
  9674. @item
  9675. Highlight differences between two YUV video streams:
  9676. @example
  9677. 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)'
  9678. @end example
  9679. @item
  9680. Show max difference between two video streams:
  9681. @example
  9682. 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)))'
  9683. @end example
  9684. @end itemize
  9685. @section maskedclamp
  9686. Clamp the first input stream with the second input and third input stream.
  9687. Returns the value of first stream to be between second input
  9688. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9689. This filter accepts the following options:
  9690. @table @option
  9691. @item undershoot
  9692. Default value is @code{0}.
  9693. @item overshoot
  9694. Default value is @code{0}.
  9695. @item planes
  9696. Set which planes will be processed as bitmap, unprocessed planes will be
  9697. copied from first stream.
  9698. By default value 0xf, all planes will be processed.
  9699. @end table
  9700. @section maskedmax
  9701. Merge the second and third input stream into output stream using absolute differences
  9702. between second input stream and first input stream and absolute difference between
  9703. third input stream and first input stream. The picked value will be from second input
  9704. stream if second absolute difference is greater than first one or from third input stream
  9705. otherwise.
  9706. This filter accepts the following options:
  9707. @table @option
  9708. @item planes
  9709. Set which planes will be processed as bitmap, unprocessed planes will be
  9710. copied from first stream.
  9711. By default value 0xf, all planes will be processed.
  9712. @end table
  9713. @section maskedmerge
  9714. Merge the first input stream with the second input stream using per pixel
  9715. weights in the third input stream.
  9716. A value of 0 in the third stream pixel component means that pixel component
  9717. from first stream is returned unchanged, while maximum value (eg. 255 for
  9718. 8-bit videos) means that pixel component from second stream is returned
  9719. unchanged. Intermediate values define the amount of merging between both
  9720. input stream's pixel components.
  9721. This filter accepts the following options:
  9722. @table @option
  9723. @item planes
  9724. Set which planes will be processed as bitmap, unprocessed planes will be
  9725. copied from first stream.
  9726. By default value 0xf, all planes will be processed.
  9727. @end table
  9728. @section maskedmin
  9729. Merge the second and third input stream into output stream using absolute differences
  9730. between second input stream and first input stream and absolute difference between
  9731. third input stream and first input stream. The picked value will be from second input
  9732. stream if second absolute difference is less than first one or from third input stream
  9733. otherwise.
  9734. This filter accepts the following options:
  9735. @table @option
  9736. @item planes
  9737. Set which planes will be processed as bitmap, unprocessed planes will be
  9738. copied from first stream.
  9739. By default value 0xf, all planes will be processed.
  9740. @end table
  9741. @section maskfun
  9742. Create mask from input video.
  9743. For example it is useful to create motion masks after @code{tblend} filter.
  9744. This filter accepts the following options:
  9745. @table @option
  9746. @item low
  9747. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9748. @item high
  9749. Set high threshold. Any pixel component higher than this value will be set to max value
  9750. allowed for current pixel format.
  9751. @item planes
  9752. Set planes to filter, by default all available planes are filtered.
  9753. @item fill
  9754. Fill all frame pixels with this value.
  9755. @item sum
  9756. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9757. average, output frame will be completely filled with value set by @var{fill} option.
  9758. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9759. @end table
  9760. @section mcdeint
  9761. Apply motion-compensation deinterlacing.
  9762. It needs one field per frame as input and must thus be used together
  9763. with yadif=1/3 or equivalent.
  9764. This filter accepts the following options:
  9765. @table @option
  9766. @item mode
  9767. Set the deinterlacing mode.
  9768. It accepts one of the following values:
  9769. @table @samp
  9770. @item fast
  9771. @item medium
  9772. @item slow
  9773. use iterative motion estimation
  9774. @item extra_slow
  9775. like @samp{slow}, but use multiple reference frames.
  9776. @end table
  9777. Default value is @samp{fast}.
  9778. @item parity
  9779. Set the picture field parity assumed for the input video. It must be
  9780. one of the following values:
  9781. @table @samp
  9782. @item 0, tff
  9783. assume top field first
  9784. @item 1, bff
  9785. assume bottom field first
  9786. @end table
  9787. Default value is @samp{bff}.
  9788. @item qp
  9789. Set per-block quantization parameter (QP) used by the internal
  9790. encoder.
  9791. Higher values should result in a smoother motion vector field but less
  9792. optimal individual vectors. Default value is 1.
  9793. @end table
  9794. @section mergeplanes
  9795. Merge color channel components from several video streams.
  9796. The filter accepts up to 4 input streams, and merge selected input
  9797. planes to the output video.
  9798. This filter accepts the following options:
  9799. @table @option
  9800. @item mapping
  9801. Set input to output plane mapping. Default is @code{0}.
  9802. The mappings is specified as a bitmap. It should be specified as a
  9803. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9804. mapping for the first plane of the output stream. 'A' sets the number of
  9805. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9806. corresponding input to use (from 0 to 3). The rest of the mappings is
  9807. similar, 'Bb' describes the mapping for the output stream second
  9808. plane, 'Cc' describes the mapping for the output stream third plane and
  9809. 'Dd' describes the mapping for the output stream fourth plane.
  9810. @item format
  9811. Set output pixel format. Default is @code{yuva444p}.
  9812. @end table
  9813. @subsection Examples
  9814. @itemize
  9815. @item
  9816. Merge three gray video streams of same width and height into single video stream:
  9817. @example
  9818. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9819. @end example
  9820. @item
  9821. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9822. @example
  9823. [a0][a1]mergeplanes=0x00010210:yuva444p
  9824. @end example
  9825. @item
  9826. Swap Y and A plane in yuva444p stream:
  9827. @example
  9828. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9829. @end example
  9830. @item
  9831. Swap U and V plane in yuv420p stream:
  9832. @example
  9833. format=yuv420p,mergeplanes=0x000201:yuv420p
  9834. @end example
  9835. @item
  9836. Cast a rgb24 clip to yuv444p:
  9837. @example
  9838. format=rgb24,mergeplanes=0x000102:yuv444p
  9839. @end example
  9840. @end itemize
  9841. @section mestimate
  9842. Estimate and export motion vectors using block matching algorithms.
  9843. Motion vectors are stored in frame side data to be used by other filters.
  9844. This filter accepts the following options:
  9845. @table @option
  9846. @item method
  9847. Specify the motion estimation method. Accepts one of the following values:
  9848. @table @samp
  9849. @item esa
  9850. Exhaustive search algorithm.
  9851. @item tss
  9852. Three step search algorithm.
  9853. @item tdls
  9854. Two dimensional logarithmic search algorithm.
  9855. @item ntss
  9856. New three step search algorithm.
  9857. @item fss
  9858. Four step search algorithm.
  9859. @item ds
  9860. Diamond search algorithm.
  9861. @item hexbs
  9862. Hexagon-based search algorithm.
  9863. @item epzs
  9864. Enhanced predictive zonal search algorithm.
  9865. @item umh
  9866. Uneven multi-hexagon search algorithm.
  9867. @end table
  9868. Default value is @samp{esa}.
  9869. @item mb_size
  9870. Macroblock size. Default @code{16}.
  9871. @item search_param
  9872. Search parameter. Default @code{7}.
  9873. @end table
  9874. @section midequalizer
  9875. Apply Midway Image Equalization effect using two video streams.
  9876. Midway Image Equalization adjusts a pair of images to have the same
  9877. histogram, while maintaining their dynamics as much as possible. It's
  9878. useful for e.g. matching exposures from a pair of stereo cameras.
  9879. This filter has two inputs and one output, which must be of same pixel format, but
  9880. may be of different sizes. The output of filter is first input adjusted with
  9881. midway histogram of both inputs.
  9882. This filter accepts the following option:
  9883. @table @option
  9884. @item planes
  9885. Set which planes to process. Default is @code{15}, which is all available planes.
  9886. @end table
  9887. @section minterpolate
  9888. Convert the video to specified frame rate using motion interpolation.
  9889. This filter accepts the following options:
  9890. @table @option
  9891. @item fps
  9892. 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}.
  9893. @item mi_mode
  9894. Motion interpolation mode. Following values are accepted:
  9895. @table @samp
  9896. @item dup
  9897. Duplicate previous or next frame for interpolating new ones.
  9898. @item blend
  9899. Blend source frames. Interpolated frame is mean of previous and next frames.
  9900. @item mci
  9901. Motion compensated interpolation. Following options are effective when this mode is selected:
  9902. @table @samp
  9903. @item mc_mode
  9904. Motion compensation mode. Following values are accepted:
  9905. @table @samp
  9906. @item obmc
  9907. Overlapped block motion compensation.
  9908. @item aobmc
  9909. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9910. @end table
  9911. Default mode is @samp{obmc}.
  9912. @item me_mode
  9913. Motion estimation mode. Following values are accepted:
  9914. @table @samp
  9915. @item bidir
  9916. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9917. @item bilat
  9918. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9919. @end table
  9920. Default mode is @samp{bilat}.
  9921. @item me
  9922. The algorithm to be used for motion estimation. Following values are accepted:
  9923. @table @samp
  9924. @item esa
  9925. Exhaustive search algorithm.
  9926. @item tss
  9927. Three step search algorithm.
  9928. @item tdls
  9929. Two dimensional logarithmic search algorithm.
  9930. @item ntss
  9931. New three step search algorithm.
  9932. @item fss
  9933. Four step search algorithm.
  9934. @item ds
  9935. Diamond search algorithm.
  9936. @item hexbs
  9937. Hexagon-based search algorithm.
  9938. @item epzs
  9939. Enhanced predictive zonal search algorithm.
  9940. @item umh
  9941. Uneven multi-hexagon search algorithm.
  9942. @end table
  9943. Default algorithm is @samp{epzs}.
  9944. @item mb_size
  9945. Macroblock size. Default @code{16}.
  9946. @item search_param
  9947. Motion estimation search parameter. Default @code{32}.
  9948. @item vsbmc
  9949. 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).
  9950. @end table
  9951. @end table
  9952. @item scd
  9953. 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:
  9954. @table @samp
  9955. @item none
  9956. Disable scene change detection.
  9957. @item fdiff
  9958. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9959. @end table
  9960. Default method is @samp{fdiff}.
  9961. @item scd_threshold
  9962. Scene change detection threshold. Default is @code{5.0}.
  9963. @end table
  9964. @section mix
  9965. Mix several video input streams into one video stream.
  9966. A description of the accepted options follows.
  9967. @table @option
  9968. @item nb_inputs
  9969. The number of inputs. If unspecified, it defaults to 2.
  9970. @item weights
  9971. Specify weight of each input video stream as sequence.
  9972. Each weight is separated by space. If number of weights
  9973. is smaller than number of @var{frames} last specified
  9974. weight will be used for all remaining unset weights.
  9975. @item scale
  9976. Specify scale, if it is set it will be multiplied with sum
  9977. of each weight multiplied with pixel values to give final destination
  9978. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9979. @item duration
  9980. Specify how end of stream is determined.
  9981. @table @samp
  9982. @item longest
  9983. The duration of the longest input. (default)
  9984. @item shortest
  9985. The duration of the shortest input.
  9986. @item first
  9987. The duration of the first input.
  9988. @end table
  9989. @end table
  9990. @section mpdecimate
  9991. Drop frames that do not differ greatly from the previous frame in
  9992. order to reduce frame rate.
  9993. The main use of this filter is for very-low-bitrate encoding
  9994. (e.g. streaming over dialup modem), but it could in theory be used for
  9995. fixing movies that were inverse-telecined incorrectly.
  9996. A description of the accepted options follows.
  9997. @table @option
  9998. @item max
  9999. Set the maximum number of consecutive frames which can be dropped (if
  10000. positive), or the minimum interval between dropped frames (if
  10001. negative). If the value is 0, the frame is dropped disregarding the
  10002. number of previous sequentially dropped frames.
  10003. Default value is 0.
  10004. @item hi
  10005. @item lo
  10006. @item frac
  10007. Set the dropping threshold values.
  10008. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10009. represent actual pixel value differences, so a threshold of 64
  10010. corresponds to 1 unit of difference for each pixel, or the same spread
  10011. out differently over the block.
  10012. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10013. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10014. meaning the whole image) differ by more than a threshold of @option{lo}.
  10015. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10016. 64*5, and default value for @option{frac} is 0.33.
  10017. @end table
  10018. @section negate
  10019. Negate (invert) the input video.
  10020. It accepts the following option:
  10021. @table @option
  10022. @item negate_alpha
  10023. With value 1, it negates the alpha component, if present. Default value is 0.
  10024. @end table
  10025. @anchor{nlmeans}
  10026. @section nlmeans
  10027. Denoise frames using Non-Local Means algorithm.
  10028. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10029. context similarity is defined by comparing their surrounding patches of size
  10030. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10031. around the pixel.
  10032. Note that the research area defines centers for patches, which means some
  10033. patches will be made of pixels outside that research area.
  10034. The filter accepts the following options.
  10035. @table @option
  10036. @item s
  10037. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10038. @item p
  10039. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10040. @item pc
  10041. Same as @option{p} but for chroma planes.
  10042. The default value is @var{0} and means automatic.
  10043. @item r
  10044. Set research size. Default is 15. Must be odd number in range [0, 99].
  10045. @item rc
  10046. Same as @option{r} but for chroma planes.
  10047. The default value is @var{0} and means automatic.
  10048. @end table
  10049. @section nnedi
  10050. Deinterlace video using neural network edge directed interpolation.
  10051. This filter accepts the following options:
  10052. @table @option
  10053. @item weights
  10054. Mandatory option, without binary file filter can not work.
  10055. Currently file can be found here:
  10056. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10057. @item deint
  10058. Set which frames to deinterlace, by default it is @code{all}.
  10059. Can be @code{all} or @code{interlaced}.
  10060. @item field
  10061. Set mode of operation.
  10062. Can be one of the following:
  10063. @table @samp
  10064. @item af
  10065. Use frame flags, both fields.
  10066. @item a
  10067. Use frame flags, single field.
  10068. @item t
  10069. Use top field only.
  10070. @item b
  10071. Use bottom field only.
  10072. @item tf
  10073. Use both fields, top first.
  10074. @item bf
  10075. Use both fields, bottom first.
  10076. @end table
  10077. @item planes
  10078. Set which planes to process, by default filter process all frames.
  10079. @item nsize
  10080. Set size of local neighborhood around each pixel, used by the predictor neural
  10081. network.
  10082. Can be one of the following:
  10083. @table @samp
  10084. @item s8x6
  10085. @item s16x6
  10086. @item s32x6
  10087. @item s48x6
  10088. @item s8x4
  10089. @item s16x4
  10090. @item s32x4
  10091. @end table
  10092. @item nns
  10093. Set the number of neurons in predictor neural network.
  10094. Can be one of the following:
  10095. @table @samp
  10096. @item n16
  10097. @item n32
  10098. @item n64
  10099. @item n128
  10100. @item n256
  10101. @end table
  10102. @item qual
  10103. Controls the number of different neural network predictions that are blended
  10104. together to compute the final output value. Can be @code{fast}, default or
  10105. @code{slow}.
  10106. @item etype
  10107. Set which set of weights to use in the predictor.
  10108. Can be one of the following:
  10109. @table @samp
  10110. @item a
  10111. weights trained to minimize absolute error
  10112. @item s
  10113. weights trained to minimize squared error
  10114. @end table
  10115. @item pscrn
  10116. Controls whether or not the prescreener neural network is used to decide
  10117. which pixels should be processed by the predictor neural network and which
  10118. can be handled by simple cubic interpolation.
  10119. The prescreener is trained to know whether cubic interpolation will be
  10120. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10121. The computational complexity of the prescreener nn is much less than that of
  10122. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10123. using the prescreener generally results in much faster processing.
  10124. The prescreener is pretty accurate, so the difference between using it and not
  10125. using it is almost always unnoticeable.
  10126. Can be one of the following:
  10127. @table @samp
  10128. @item none
  10129. @item original
  10130. @item new
  10131. @end table
  10132. Default is @code{new}.
  10133. @item fapprox
  10134. Set various debugging flags.
  10135. @end table
  10136. @section noformat
  10137. Force libavfilter not to use any of the specified pixel formats for the
  10138. input to the next filter.
  10139. It accepts the following parameters:
  10140. @table @option
  10141. @item pix_fmts
  10142. A '|'-separated list of pixel format names, such as
  10143. pix_fmts=yuv420p|monow|rgb24".
  10144. @end table
  10145. @subsection Examples
  10146. @itemize
  10147. @item
  10148. Force libavfilter to use a format different from @var{yuv420p} for the
  10149. input to the vflip filter:
  10150. @example
  10151. noformat=pix_fmts=yuv420p,vflip
  10152. @end example
  10153. @item
  10154. Convert the input video to any of the formats not contained in the list:
  10155. @example
  10156. noformat=yuv420p|yuv444p|yuv410p
  10157. @end example
  10158. @end itemize
  10159. @section noise
  10160. Add noise on video input frame.
  10161. The filter accepts the following options:
  10162. @table @option
  10163. @item all_seed
  10164. @item c0_seed
  10165. @item c1_seed
  10166. @item c2_seed
  10167. @item c3_seed
  10168. Set noise seed for specific pixel component or all pixel components in case
  10169. of @var{all_seed}. Default value is @code{123457}.
  10170. @item all_strength, alls
  10171. @item c0_strength, c0s
  10172. @item c1_strength, c1s
  10173. @item c2_strength, c2s
  10174. @item c3_strength, c3s
  10175. Set noise strength for specific pixel component or all pixel components in case
  10176. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10177. @item all_flags, allf
  10178. @item c0_flags, c0f
  10179. @item c1_flags, c1f
  10180. @item c2_flags, c2f
  10181. @item c3_flags, c3f
  10182. Set pixel component flags or set flags for all components if @var{all_flags}.
  10183. Available values for component flags are:
  10184. @table @samp
  10185. @item a
  10186. averaged temporal noise (smoother)
  10187. @item p
  10188. mix random noise with a (semi)regular pattern
  10189. @item t
  10190. temporal noise (noise pattern changes between frames)
  10191. @item u
  10192. uniform noise (gaussian otherwise)
  10193. @end table
  10194. @end table
  10195. @subsection Examples
  10196. Add temporal and uniform noise to input video:
  10197. @example
  10198. noise=alls=20:allf=t+u
  10199. @end example
  10200. @section normalize
  10201. Normalize RGB video (aka histogram stretching, contrast stretching).
  10202. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10203. For each channel of each frame, the filter computes the input range and maps
  10204. it linearly to the user-specified output range. The output range defaults
  10205. to the full dynamic range from pure black to pure white.
  10206. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10207. changes in brightness) caused when small dark or bright objects enter or leave
  10208. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10209. video camera, and, like a video camera, it may cause a period of over- or
  10210. under-exposure of the video.
  10211. The R,G,B channels can be normalized independently, which may cause some
  10212. color shifting, or linked together as a single channel, which prevents
  10213. color shifting. Linked normalization preserves hue. Independent normalization
  10214. does not, so it can be used to remove some color casts. Independent and linked
  10215. normalization can be combined in any ratio.
  10216. The normalize filter accepts the following options:
  10217. @table @option
  10218. @item blackpt
  10219. @item whitept
  10220. Colors which define the output range. The minimum input value is mapped to
  10221. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10222. The defaults are black and white respectively. Specifying white for
  10223. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10224. normalized video. Shades of grey can be used to reduce the dynamic range
  10225. (contrast). Specifying saturated colors here can create some interesting
  10226. effects.
  10227. @item smoothing
  10228. The number of previous frames to use for temporal smoothing. The input range
  10229. of each channel is smoothed using a rolling average over the current frame
  10230. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10231. smoothing).
  10232. @item independence
  10233. Controls the ratio of independent (color shifting) channel normalization to
  10234. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10235. independent. Defaults to 1.0 (fully independent).
  10236. @item strength
  10237. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10238. expensive no-op. Defaults to 1.0 (full strength).
  10239. @end table
  10240. @subsection Examples
  10241. Stretch video contrast to use the full dynamic range, with no temporal
  10242. smoothing; may flicker depending on the source content:
  10243. @example
  10244. normalize=blackpt=black:whitept=white:smoothing=0
  10245. @end example
  10246. As above, but with 50 frames of temporal smoothing; flicker should be
  10247. reduced, depending on the source content:
  10248. @example
  10249. normalize=blackpt=black:whitept=white:smoothing=50
  10250. @end example
  10251. As above, but with hue-preserving linked channel normalization:
  10252. @example
  10253. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10254. @end example
  10255. As above, but with half strength:
  10256. @example
  10257. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10258. @end example
  10259. Map the darkest input color to red, the brightest input color to cyan:
  10260. @example
  10261. normalize=blackpt=red:whitept=cyan
  10262. @end example
  10263. @section null
  10264. Pass the video source unchanged to the output.
  10265. @section ocr
  10266. Optical Character Recognition
  10267. This filter uses Tesseract for optical character recognition. To enable
  10268. compilation of this filter, you need to configure FFmpeg with
  10269. @code{--enable-libtesseract}.
  10270. It accepts the following options:
  10271. @table @option
  10272. @item datapath
  10273. Set datapath to tesseract data. Default is to use whatever was
  10274. set at installation.
  10275. @item language
  10276. Set language, default is "eng".
  10277. @item whitelist
  10278. Set character whitelist.
  10279. @item blacklist
  10280. Set character blacklist.
  10281. @end table
  10282. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10283. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10284. @section ocv
  10285. Apply a video transform using libopencv.
  10286. To enable this filter, install the libopencv library and headers and
  10287. configure FFmpeg with @code{--enable-libopencv}.
  10288. It accepts the following parameters:
  10289. @table @option
  10290. @item filter_name
  10291. The name of the libopencv filter to apply.
  10292. @item filter_params
  10293. The parameters to pass to the libopencv filter. If not specified, the default
  10294. values are assumed.
  10295. @end table
  10296. Refer to the official libopencv documentation for more precise
  10297. information:
  10298. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10299. Several libopencv filters are supported; see the following subsections.
  10300. @anchor{dilate}
  10301. @subsection dilate
  10302. Dilate an image by using a specific structuring element.
  10303. It corresponds to the libopencv function @code{cvDilate}.
  10304. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10305. @var{struct_el} represents a structuring element, and has the syntax:
  10306. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10307. @var{cols} and @var{rows} represent the number of columns and rows of
  10308. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10309. point, and @var{shape} the shape for the structuring element. @var{shape}
  10310. must be "rect", "cross", "ellipse", or "custom".
  10311. If the value for @var{shape} is "custom", it must be followed by a
  10312. string of the form "=@var{filename}". The file with name
  10313. @var{filename} is assumed to represent a binary image, with each
  10314. printable character corresponding to a bright pixel. When a custom
  10315. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10316. or columns and rows of the read file are assumed instead.
  10317. The default value for @var{struct_el} is "3x3+0x0/rect".
  10318. @var{nb_iterations} specifies the number of times the transform is
  10319. applied to the image, and defaults to 1.
  10320. Some examples:
  10321. @example
  10322. # Use the default values
  10323. ocv=dilate
  10324. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10325. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10326. # Read the shape from the file diamond.shape, iterating two times.
  10327. # The file diamond.shape may contain a pattern of characters like this
  10328. # *
  10329. # ***
  10330. # *****
  10331. # ***
  10332. # *
  10333. # The specified columns and rows are ignored
  10334. # but the anchor point coordinates are not
  10335. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10336. @end example
  10337. @subsection erode
  10338. Erode an image by using a specific structuring element.
  10339. It corresponds to the libopencv function @code{cvErode}.
  10340. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10341. with the same syntax and semantics as the @ref{dilate} filter.
  10342. @subsection smooth
  10343. Smooth the input video.
  10344. The filter takes the following parameters:
  10345. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10346. @var{type} is the type of smooth filter to apply, and must be one of
  10347. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10348. or "bilateral". The default value is "gaussian".
  10349. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10350. depends on the smooth type. @var{param1} and
  10351. @var{param2} accept integer positive values or 0. @var{param3} and
  10352. @var{param4} accept floating point values.
  10353. The default value for @var{param1} is 3. The default value for the
  10354. other parameters is 0.
  10355. These parameters correspond to the parameters assigned to the
  10356. libopencv function @code{cvSmooth}.
  10357. @section oscilloscope
  10358. 2D Video Oscilloscope.
  10359. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10360. It accepts the following parameters:
  10361. @table @option
  10362. @item x
  10363. Set scope center x position.
  10364. @item y
  10365. Set scope center y position.
  10366. @item s
  10367. Set scope size, relative to frame diagonal.
  10368. @item t
  10369. Set scope tilt/rotation.
  10370. @item o
  10371. Set trace opacity.
  10372. @item tx
  10373. Set trace center x position.
  10374. @item ty
  10375. Set trace center y position.
  10376. @item tw
  10377. Set trace width, relative to width of frame.
  10378. @item th
  10379. Set trace height, relative to height of frame.
  10380. @item c
  10381. Set which components to trace. By default it traces first three components.
  10382. @item g
  10383. Draw trace grid. By default is enabled.
  10384. @item st
  10385. Draw some statistics. By default is enabled.
  10386. @item sc
  10387. Draw scope. By default is enabled.
  10388. @end table
  10389. @subsection Examples
  10390. @itemize
  10391. @item
  10392. Inspect full first row of video frame.
  10393. @example
  10394. oscilloscope=x=0.5:y=0:s=1
  10395. @end example
  10396. @item
  10397. Inspect full last row of video frame.
  10398. @example
  10399. oscilloscope=x=0.5:y=1:s=1
  10400. @end example
  10401. @item
  10402. Inspect full 5th line of video frame of height 1080.
  10403. @example
  10404. oscilloscope=x=0.5:y=5/1080:s=1
  10405. @end example
  10406. @item
  10407. Inspect full last column of video frame.
  10408. @example
  10409. oscilloscope=x=1:y=0.5:s=1:t=1
  10410. @end example
  10411. @end itemize
  10412. @anchor{overlay}
  10413. @section overlay
  10414. Overlay one video on top of another.
  10415. It takes two inputs and has one output. The first input is the "main"
  10416. video on which the second input is overlaid.
  10417. It accepts the following parameters:
  10418. A description of the accepted options follows.
  10419. @table @option
  10420. @item x
  10421. @item y
  10422. Set the expression for the x and y coordinates of the overlaid video
  10423. on the main video. Default value is "0" for both expressions. In case
  10424. the expression is invalid, it is set to a huge value (meaning that the
  10425. overlay will not be displayed within the output visible area).
  10426. @item eof_action
  10427. See @ref{framesync}.
  10428. @item eval
  10429. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10430. It accepts the following values:
  10431. @table @samp
  10432. @item init
  10433. only evaluate expressions once during the filter initialization or
  10434. when a command is processed
  10435. @item frame
  10436. evaluate expressions for each incoming frame
  10437. @end table
  10438. Default value is @samp{frame}.
  10439. @item shortest
  10440. See @ref{framesync}.
  10441. @item format
  10442. Set the format for the output video.
  10443. It accepts the following values:
  10444. @table @samp
  10445. @item yuv420
  10446. force YUV420 output
  10447. @item yuv422
  10448. force YUV422 output
  10449. @item yuv444
  10450. force YUV444 output
  10451. @item rgb
  10452. force packed RGB output
  10453. @item gbrp
  10454. force planar RGB output
  10455. @item auto
  10456. automatically pick format
  10457. @end table
  10458. Default value is @samp{yuv420}.
  10459. @item repeatlast
  10460. See @ref{framesync}.
  10461. @item alpha
  10462. Set format of alpha of the overlaid video, it can be @var{straight} or
  10463. @var{premultiplied}. Default is @var{straight}.
  10464. @end table
  10465. The @option{x}, and @option{y} expressions can contain the following
  10466. parameters.
  10467. @table @option
  10468. @item main_w, W
  10469. @item main_h, H
  10470. The main input width and height.
  10471. @item overlay_w, w
  10472. @item overlay_h, h
  10473. The overlay input width and height.
  10474. @item x
  10475. @item y
  10476. The computed values for @var{x} and @var{y}. They are evaluated for
  10477. each new frame.
  10478. @item hsub
  10479. @item vsub
  10480. horizontal and vertical chroma subsample values of the output
  10481. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10482. @var{vsub} is 1.
  10483. @item n
  10484. the number of input frame, starting from 0
  10485. @item pos
  10486. the position in the file of the input frame, NAN if unknown
  10487. @item t
  10488. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10489. @end table
  10490. This filter also supports the @ref{framesync} options.
  10491. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10492. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10493. when @option{eval} is set to @samp{init}.
  10494. Be aware that frames are taken from each input video in timestamp
  10495. order, hence, if their initial timestamps differ, it is a good idea
  10496. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10497. have them begin in the same zero timestamp, as the example for
  10498. the @var{movie} filter does.
  10499. You can chain together more overlays but you should test the
  10500. efficiency of such approach.
  10501. @subsection Commands
  10502. This filter supports the following commands:
  10503. @table @option
  10504. @item x
  10505. @item y
  10506. Modify the x and y of the overlay input.
  10507. The command accepts the same syntax of the corresponding option.
  10508. If the specified expression is not valid, it is kept at its current
  10509. value.
  10510. @end table
  10511. @subsection Examples
  10512. @itemize
  10513. @item
  10514. Draw the overlay at 10 pixels from the bottom right corner of the main
  10515. video:
  10516. @example
  10517. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10518. @end example
  10519. Using named options the example above becomes:
  10520. @example
  10521. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10522. @end example
  10523. @item
  10524. Insert a transparent PNG logo in the bottom left corner of the input,
  10525. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10526. @example
  10527. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10528. @end example
  10529. @item
  10530. Insert 2 different transparent PNG logos (second logo on bottom
  10531. right corner) using the @command{ffmpeg} tool:
  10532. @example
  10533. 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
  10534. @end example
  10535. @item
  10536. Add a transparent color layer on top of the main video; @code{WxH}
  10537. must specify the size of the main input to the overlay filter:
  10538. @example
  10539. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10540. @end example
  10541. @item
  10542. Play an original video and a filtered version (here with the deshake
  10543. filter) side by side using the @command{ffplay} tool:
  10544. @example
  10545. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10546. @end example
  10547. The above command is the same as:
  10548. @example
  10549. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10550. @end example
  10551. @item
  10552. Make a sliding overlay appearing from the left to the right top part of the
  10553. screen starting since time 2:
  10554. @example
  10555. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10556. @end example
  10557. @item
  10558. Compose output by putting two input videos side to side:
  10559. @example
  10560. ffmpeg -i left.avi -i right.avi -filter_complex "
  10561. nullsrc=size=200x100 [background];
  10562. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10563. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10564. [background][left] overlay=shortest=1 [background+left];
  10565. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10566. "
  10567. @end example
  10568. @item
  10569. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10570. @example
  10571. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10572. -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]'
  10573. masked.avi
  10574. @end example
  10575. @item
  10576. Chain several overlays in cascade:
  10577. @example
  10578. nullsrc=s=200x200 [bg];
  10579. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10580. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10581. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10582. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10583. [in3] null, [mid2] overlay=100:100 [out0]
  10584. @end example
  10585. @end itemize
  10586. @section owdenoise
  10587. Apply Overcomplete Wavelet denoiser.
  10588. The filter accepts the following options:
  10589. @table @option
  10590. @item depth
  10591. Set depth.
  10592. Larger depth values will denoise lower frequency components more, but
  10593. slow down filtering.
  10594. Must be an int in the range 8-16, default is @code{8}.
  10595. @item luma_strength, ls
  10596. Set luma strength.
  10597. Must be a double value in the range 0-1000, default is @code{1.0}.
  10598. @item chroma_strength, cs
  10599. Set chroma strength.
  10600. Must be a double value in the range 0-1000, default is @code{1.0}.
  10601. @end table
  10602. @anchor{pad}
  10603. @section pad
  10604. Add paddings to the input image, and place the original input at the
  10605. provided @var{x}, @var{y} coordinates.
  10606. It accepts the following parameters:
  10607. @table @option
  10608. @item width, w
  10609. @item height, h
  10610. Specify an expression for the size of the output image with the
  10611. paddings added. If the value for @var{width} or @var{height} is 0, the
  10612. corresponding input size is used for the output.
  10613. The @var{width} expression can reference the value set by the
  10614. @var{height} expression, and vice versa.
  10615. The default value of @var{width} and @var{height} is 0.
  10616. @item x
  10617. @item y
  10618. Specify the offsets to place the input image at within the padded area,
  10619. with respect to the top/left border of the output image.
  10620. The @var{x} expression can reference the value set by the @var{y}
  10621. expression, and vice versa.
  10622. The default value of @var{x} and @var{y} is 0.
  10623. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10624. so the input image is centered on the padded area.
  10625. @item color
  10626. Specify the color of the padded area. For the syntax of this option,
  10627. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10628. manual,ffmpeg-utils}.
  10629. The default value of @var{color} is "black".
  10630. @item eval
  10631. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10632. It accepts the following values:
  10633. @table @samp
  10634. @item init
  10635. Only evaluate expressions once during the filter initialization or when
  10636. a command is processed.
  10637. @item frame
  10638. Evaluate expressions for each incoming frame.
  10639. @end table
  10640. Default value is @samp{init}.
  10641. @item aspect
  10642. Pad to aspect instead to a resolution.
  10643. @end table
  10644. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10645. options are expressions containing the following constants:
  10646. @table @option
  10647. @item in_w
  10648. @item in_h
  10649. The input video width and height.
  10650. @item iw
  10651. @item ih
  10652. These are the same as @var{in_w} and @var{in_h}.
  10653. @item out_w
  10654. @item out_h
  10655. The output width and height (the size of the padded area), as
  10656. specified by the @var{width} and @var{height} expressions.
  10657. @item ow
  10658. @item oh
  10659. These are the same as @var{out_w} and @var{out_h}.
  10660. @item x
  10661. @item y
  10662. The x and y offsets as specified by the @var{x} and @var{y}
  10663. expressions, or NAN if not yet specified.
  10664. @item a
  10665. same as @var{iw} / @var{ih}
  10666. @item sar
  10667. input sample aspect ratio
  10668. @item dar
  10669. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10670. @item hsub
  10671. @item vsub
  10672. The horizontal and vertical chroma subsample values. For example for the
  10673. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10674. @end table
  10675. @subsection Examples
  10676. @itemize
  10677. @item
  10678. Add paddings with the color "violet" to the input video. The output video
  10679. size is 640x480, and the top-left corner of the input video is placed at
  10680. column 0, row 40
  10681. @example
  10682. pad=640:480:0:40:violet
  10683. @end example
  10684. The example above is equivalent to the following command:
  10685. @example
  10686. pad=width=640:height=480:x=0:y=40:color=violet
  10687. @end example
  10688. @item
  10689. Pad the input to get an output with dimensions increased by 3/2,
  10690. and put the input video at the center of the padded area:
  10691. @example
  10692. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10693. @end example
  10694. @item
  10695. Pad the input to get a squared output with size equal to the maximum
  10696. value between the input width and height, and put the input video at
  10697. the center of the padded area:
  10698. @example
  10699. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10700. @end example
  10701. @item
  10702. Pad the input to get a final w/h ratio of 16:9:
  10703. @example
  10704. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10705. @end example
  10706. @item
  10707. In case of anamorphic video, in order to set the output display aspect
  10708. correctly, it is necessary to use @var{sar} in the expression,
  10709. according to the relation:
  10710. @example
  10711. (ih * X / ih) * sar = output_dar
  10712. X = output_dar / sar
  10713. @end example
  10714. Thus the previous example needs to be modified to:
  10715. @example
  10716. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10717. @end example
  10718. @item
  10719. Double the output size and put the input video in the bottom-right
  10720. corner of the output padded area:
  10721. @example
  10722. pad="2*iw:2*ih:ow-iw:oh-ih"
  10723. @end example
  10724. @end itemize
  10725. @anchor{palettegen}
  10726. @section palettegen
  10727. Generate one palette for a whole video stream.
  10728. It accepts the following options:
  10729. @table @option
  10730. @item max_colors
  10731. Set the maximum number of colors to quantize in the palette.
  10732. Note: the palette will still contain 256 colors; the unused palette entries
  10733. will be black.
  10734. @item reserve_transparent
  10735. Create a palette of 255 colors maximum and reserve the last one for
  10736. transparency. Reserving the transparency color is useful for GIF optimization.
  10737. If not set, the maximum of colors in the palette will be 256. You probably want
  10738. to disable this option for a standalone image.
  10739. Set by default.
  10740. @item transparency_color
  10741. Set the color that will be used as background for transparency.
  10742. @item stats_mode
  10743. Set statistics mode.
  10744. It accepts the following values:
  10745. @table @samp
  10746. @item full
  10747. Compute full frame histograms.
  10748. @item diff
  10749. Compute histograms only for the part that differs from previous frame. This
  10750. might be relevant to give more importance to the moving part of your input if
  10751. the background is static.
  10752. @item single
  10753. Compute new histogram for each frame.
  10754. @end table
  10755. Default value is @var{full}.
  10756. @end table
  10757. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10758. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10759. color quantization of the palette. This information is also visible at
  10760. @var{info} logging level.
  10761. @subsection Examples
  10762. @itemize
  10763. @item
  10764. Generate a representative palette of a given video using @command{ffmpeg}:
  10765. @example
  10766. ffmpeg -i input.mkv -vf palettegen palette.png
  10767. @end example
  10768. @end itemize
  10769. @section paletteuse
  10770. Use a palette to downsample an input video stream.
  10771. The filter takes two inputs: one video stream and a palette. The palette must
  10772. be a 256 pixels image.
  10773. It accepts the following options:
  10774. @table @option
  10775. @item dither
  10776. Select dithering mode. Available algorithms are:
  10777. @table @samp
  10778. @item bayer
  10779. Ordered 8x8 bayer dithering (deterministic)
  10780. @item heckbert
  10781. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10782. Note: this dithering is sometimes considered "wrong" and is included as a
  10783. reference.
  10784. @item floyd_steinberg
  10785. Floyd and Steingberg dithering (error diffusion)
  10786. @item sierra2
  10787. Frankie Sierra dithering v2 (error diffusion)
  10788. @item sierra2_4a
  10789. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10790. @end table
  10791. Default is @var{sierra2_4a}.
  10792. @item bayer_scale
  10793. When @var{bayer} dithering is selected, this option defines the scale of the
  10794. pattern (how much the crosshatch pattern is visible). A low value means more
  10795. visible pattern for less banding, and higher value means less visible pattern
  10796. at the cost of more banding.
  10797. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10798. @item diff_mode
  10799. If set, define the zone to process
  10800. @table @samp
  10801. @item rectangle
  10802. Only the changing rectangle will be reprocessed. This is similar to GIF
  10803. cropping/offsetting compression mechanism. This option can be useful for speed
  10804. if only a part of the image is changing, and has use cases such as limiting the
  10805. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10806. moving scene (it leads to more deterministic output if the scene doesn't change
  10807. much, and as a result less moving noise and better GIF compression).
  10808. @end table
  10809. Default is @var{none}.
  10810. @item new
  10811. Take new palette for each output frame.
  10812. @item alpha_threshold
  10813. Sets the alpha threshold for transparency. Alpha values above this threshold
  10814. will be treated as completely opaque, and values below this threshold will be
  10815. treated as completely transparent.
  10816. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10817. @end table
  10818. @subsection Examples
  10819. @itemize
  10820. @item
  10821. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10822. using @command{ffmpeg}:
  10823. @example
  10824. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10825. @end example
  10826. @end itemize
  10827. @section perspective
  10828. Correct perspective of video not recorded perpendicular to the screen.
  10829. A description of the accepted parameters follows.
  10830. @table @option
  10831. @item x0
  10832. @item y0
  10833. @item x1
  10834. @item y1
  10835. @item x2
  10836. @item y2
  10837. @item x3
  10838. @item y3
  10839. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10840. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10841. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10842. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10843. then the corners of the source will be sent to the specified coordinates.
  10844. The expressions can use the following variables:
  10845. @table @option
  10846. @item W
  10847. @item H
  10848. the width and height of video frame.
  10849. @item in
  10850. Input frame count.
  10851. @item on
  10852. Output frame count.
  10853. @end table
  10854. @item interpolation
  10855. Set interpolation for perspective correction.
  10856. It accepts the following values:
  10857. @table @samp
  10858. @item linear
  10859. @item cubic
  10860. @end table
  10861. Default value is @samp{linear}.
  10862. @item sense
  10863. Set interpretation of coordinate options.
  10864. It accepts the following values:
  10865. @table @samp
  10866. @item 0, source
  10867. Send point in the source specified by the given coordinates to
  10868. the corners of the destination.
  10869. @item 1, destination
  10870. Send the corners of the source to the point in the destination specified
  10871. by the given coordinates.
  10872. Default value is @samp{source}.
  10873. @end table
  10874. @item eval
  10875. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10876. It accepts the following values:
  10877. @table @samp
  10878. @item init
  10879. only evaluate expressions once during the filter initialization or
  10880. when a command is processed
  10881. @item frame
  10882. evaluate expressions for each incoming frame
  10883. @end table
  10884. Default value is @samp{init}.
  10885. @end table
  10886. @section phase
  10887. Delay interlaced video by one field time so that the field order changes.
  10888. The intended use is to fix PAL movies that have been captured with the
  10889. opposite field order to the film-to-video transfer.
  10890. A description of the accepted parameters follows.
  10891. @table @option
  10892. @item mode
  10893. Set phase mode.
  10894. It accepts the following values:
  10895. @table @samp
  10896. @item t
  10897. Capture field order top-first, transfer bottom-first.
  10898. Filter will delay the bottom field.
  10899. @item b
  10900. Capture field order bottom-first, transfer top-first.
  10901. Filter will delay the top field.
  10902. @item p
  10903. Capture and transfer with the same field order. This mode only exists
  10904. for the documentation of the other options to refer to, but if you
  10905. actually select it, the filter will faithfully do nothing.
  10906. @item a
  10907. Capture field order determined automatically by field flags, transfer
  10908. opposite.
  10909. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10910. basis using field flags. If no field information is available,
  10911. then this works just like @samp{u}.
  10912. @item u
  10913. Capture unknown or varying, transfer opposite.
  10914. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10915. analyzing the images and selecting the alternative that produces best
  10916. match between the fields.
  10917. @item T
  10918. Capture top-first, transfer unknown or varying.
  10919. Filter selects among @samp{t} and @samp{p} using image analysis.
  10920. @item B
  10921. Capture bottom-first, transfer unknown or varying.
  10922. Filter selects among @samp{b} and @samp{p} using image analysis.
  10923. @item A
  10924. Capture determined by field flags, transfer unknown or varying.
  10925. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10926. image analysis. If no field information is available, then this works just
  10927. like @samp{U}. This is the default mode.
  10928. @item U
  10929. Both capture and transfer unknown or varying.
  10930. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10931. @end table
  10932. @end table
  10933. @section photosensitivity
  10934. Reduce various flashes in video, so to help users with epilepsy.
  10935. It accepts the following options:
  10936. @table @option
  10937. @item frames, f
  10938. Set how many frames to use when filtering. Default is 30.
  10939. @item threshold, t
  10940. Set detection threshold factor. Default is 1.
  10941. Lower is stricter.
  10942. @item skip
  10943. Set how many pixels to skip when sampling frames. Default is 1.
  10944. Allowed range is from 1 to 1024.
  10945. @item bypass
  10946. Leave frames unchanged. Default is disabled.
  10947. @end table
  10948. @section pixdesctest
  10949. Pixel format descriptor test filter, mainly useful for internal
  10950. testing. The output video should be equal to the input video.
  10951. For example:
  10952. @example
  10953. format=monow, pixdesctest
  10954. @end example
  10955. can be used to test the monowhite pixel format descriptor definition.
  10956. @section pixscope
  10957. Display sample values of color channels. Mainly useful for checking color
  10958. and levels. Minimum supported resolution is 640x480.
  10959. The filters accept the following options:
  10960. @table @option
  10961. @item x
  10962. Set scope X position, relative offset on X axis.
  10963. @item y
  10964. Set scope Y position, relative offset on Y axis.
  10965. @item w
  10966. Set scope width.
  10967. @item h
  10968. Set scope height.
  10969. @item o
  10970. Set window opacity. This window also holds statistics about pixel area.
  10971. @item wx
  10972. Set window X position, relative offset on X axis.
  10973. @item wy
  10974. Set window Y position, relative offset on Y axis.
  10975. @end table
  10976. @section pp
  10977. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10978. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10979. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10980. Each subfilter and some options have a short and a long name that can be used
  10981. interchangeably, i.e. dr/dering are the same.
  10982. The filters accept the following options:
  10983. @table @option
  10984. @item subfilters
  10985. Set postprocessing subfilters string.
  10986. @end table
  10987. All subfilters share common options to determine their scope:
  10988. @table @option
  10989. @item a/autoq
  10990. Honor the quality commands for this subfilter.
  10991. @item c/chrom
  10992. Do chrominance filtering, too (default).
  10993. @item y/nochrom
  10994. Do luminance filtering only (no chrominance).
  10995. @item n/noluma
  10996. Do chrominance filtering only (no luminance).
  10997. @end table
  10998. These options can be appended after the subfilter name, separated by a '|'.
  10999. Available subfilters are:
  11000. @table @option
  11001. @item hb/hdeblock[|difference[|flatness]]
  11002. Horizontal deblocking filter
  11003. @table @option
  11004. @item difference
  11005. Difference factor where higher values mean more deblocking (default: @code{32}).
  11006. @item flatness
  11007. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11008. @end table
  11009. @item vb/vdeblock[|difference[|flatness]]
  11010. Vertical deblocking filter
  11011. @table @option
  11012. @item difference
  11013. Difference factor where higher values mean more deblocking (default: @code{32}).
  11014. @item flatness
  11015. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11016. @end table
  11017. @item ha/hadeblock[|difference[|flatness]]
  11018. Accurate horizontal deblocking filter
  11019. @table @option
  11020. @item difference
  11021. Difference factor where higher values mean more deblocking (default: @code{32}).
  11022. @item flatness
  11023. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11024. @end table
  11025. @item va/vadeblock[|difference[|flatness]]
  11026. Accurate vertical deblocking filter
  11027. @table @option
  11028. @item difference
  11029. Difference factor where higher values mean more deblocking (default: @code{32}).
  11030. @item flatness
  11031. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11032. @end table
  11033. @end table
  11034. The horizontal and vertical deblocking filters share the difference and
  11035. flatness values so you cannot set different horizontal and vertical
  11036. thresholds.
  11037. @table @option
  11038. @item h1/x1hdeblock
  11039. Experimental horizontal deblocking filter
  11040. @item v1/x1vdeblock
  11041. Experimental vertical deblocking filter
  11042. @item dr/dering
  11043. Deringing filter
  11044. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  11045. @table @option
  11046. @item threshold1
  11047. larger -> stronger filtering
  11048. @item threshold2
  11049. larger -> stronger filtering
  11050. @item threshold3
  11051. larger -> stronger filtering
  11052. @end table
  11053. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  11054. @table @option
  11055. @item f/fullyrange
  11056. Stretch luminance to @code{0-255}.
  11057. @end table
  11058. @item lb/linblenddeint
  11059. Linear blend deinterlacing filter that deinterlaces the given block by
  11060. filtering all lines with a @code{(1 2 1)} filter.
  11061. @item li/linipoldeint
  11062. Linear interpolating deinterlacing filter that deinterlaces the given block by
  11063. linearly interpolating every second line.
  11064. @item ci/cubicipoldeint
  11065. Cubic interpolating deinterlacing filter deinterlaces the given block by
  11066. cubically interpolating every second line.
  11067. @item md/mediandeint
  11068. Median deinterlacing filter that deinterlaces the given block by applying a
  11069. median filter to every second line.
  11070. @item fd/ffmpegdeint
  11071. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  11072. second line with a @code{(-1 4 2 4 -1)} filter.
  11073. @item l5/lowpass5
  11074. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  11075. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  11076. @item fq/forceQuant[|quantizer]
  11077. Overrides the quantizer table from the input with the constant quantizer you
  11078. specify.
  11079. @table @option
  11080. @item quantizer
  11081. Quantizer to use
  11082. @end table
  11083. @item de/default
  11084. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  11085. @item fa/fast
  11086. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  11087. @item ac
  11088. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11089. @end table
  11090. @subsection Examples
  11091. @itemize
  11092. @item
  11093. Apply horizontal and vertical deblocking, deringing and automatic
  11094. brightness/contrast:
  11095. @example
  11096. pp=hb/vb/dr/al
  11097. @end example
  11098. @item
  11099. Apply default filters without brightness/contrast correction:
  11100. @example
  11101. pp=de/-al
  11102. @end example
  11103. @item
  11104. Apply default filters and temporal denoiser:
  11105. @example
  11106. pp=default/tmpnoise|1|2|3
  11107. @end example
  11108. @item
  11109. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11110. automatically depending on available CPU time:
  11111. @example
  11112. pp=hb|y/vb|a
  11113. @end example
  11114. @end itemize
  11115. @section pp7
  11116. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11117. similar to spp = 6 with 7 point DCT, where only the center sample is
  11118. used after IDCT.
  11119. The filter accepts the following options:
  11120. @table @option
  11121. @item qp
  11122. Force a constant quantization parameter. It accepts an integer in range
  11123. 0 to 63. If not set, the filter will use the QP from the video stream
  11124. (if available).
  11125. @item mode
  11126. Set thresholding mode. Available modes are:
  11127. @table @samp
  11128. @item hard
  11129. Set hard thresholding.
  11130. @item soft
  11131. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11132. @item medium
  11133. Set medium thresholding (good results, default).
  11134. @end table
  11135. @end table
  11136. @section premultiply
  11137. Apply alpha premultiply effect to input video stream using first plane
  11138. of second stream as alpha.
  11139. Both streams must have same dimensions and same pixel format.
  11140. The filter accepts the following option:
  11141. @table @option
  11142. @item planes
  11143. Set which planes will be processed, unprocessed planes will be copied.
  11144. By default value 0xf, all planes will be processed.
  11145. @item inplace
  11146. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11147. @end table
  11148. @section prewitt
  11149. Apply prewitt operator to input video stream.
  11150. The filter accepts the following option:
  11151. @table @option
  11152. @item planes
  11153. Set which planes will be processed, unprocessed planes will be copied.
  11154. By default value 0xf, all planes will be processed.
  11155. @item scale
  11156. Set value which will be multiplied with filtered result.
  11157. @item delta
  11158. Set value which will be added to filtered result.
  11159. @end table
  11160. @anchor{program_opencl}
  11161. @section program_opencl
  11162. Filter video using an OpenCL program.
  11163. @table @option
  11164. @item source
  11165. OpenCL program source file.
  11166. @item kernel
  11167. Kernel name in program.
  11168. @item inputs
  11169. Number of inputs to the filter. Defaults to 1.
  11170. @item size, s
  11171. Size of output frames. Defaults to the same as the first input.
  11172. @end table
  11173. The program source file must contain a kernel function with the given name,
  11174. which will be run once for each plane of the output. Each run on a plane
  11175. gets enqueued as a separate 2D global NDRange with one work-item for each
  11176. pixel to be generated. The global ID offset for each work-item is therefore
  11177. the coordinates of a pixel in the destination image.
  11178. The kernel function needs to take the following arguments:
  11179. @itemize
  11180. @item
  11181. Destination image, @var{__write_only image2d_t}.
  11182. This image will become the output; the kernel should write all of it.
  11183. @item
  11184. Frame index, @var{unsigned int}.
  11185. This is a counter starting from zero and increasing by one for each frame.
  11186. @item
  11187. Source images, @var{__read_only image2d_t}.
  11188. These are the most recent images on each input. The kernel may read from
  11189. them to generate the output, but they can't be written to.
  11190. @end itemize
  11191. Example programs:
  11192. @itemize
  11193. @item
  11194. Copy the input to the output (output must be the same size as the input).
  11195. @verbatim
  11196. __kernel void copy(__write_only image2d_t destination,
  11197. unsigned int index,
  11198. __read_only image2d_t source)
  11199. {
  11200. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  11201. int2 location = (int2)(get_global_id(0), get_global_id(1));
  11202. float4 value = read_imagef(source, sampler, location);
  11203. write_imagef(destination, location, value);
  11204. }
  11205. @end verbatim
  11206. @item
  11207. Apply a simple transformation, rotating the input by an amount increasing
  11208. with the index counter. Pixel values are linearly interpolated by the
  11209. sampler, and the output need not have the same dimensions as the input.
  11210. @verbatim
  11211. __kernel void rotate_image(__write_only image2d_t dst,
  11212. unsigned int index,
  11213. __read_only image2d_t src)
  11214. {
  11215. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11216. CLK_FILTER_LINEAR);
  11217. float angle = (float)index / 100.0f;
  11218. float2 dst_dim = convert_float2(get_image_dim(dst));
  11219. float2 src_dim = convert_float2(get_image_dim(src));
  11220. float2 dst_cen = dst_dim / 2.0f;
  11221. float2 src_cen = src_dim / 2.0f;
  11222. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11223. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  11224. float2 src_pos = {
  11225. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  11226. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  11227. };
  11228. src_pos = src_pos * src_dim / dst_dim;
  11229. float2 src_loc = src_pos + src_cen;
  11230. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  11231. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  11232. write_imagef(dst, dst_loc, 0.5f);
  11233. else
  11234. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  11235. }
  11236. @end verbatim
  11237. @item
  11238. Blend two inputs together, with the amount of each input used varying
  11239. with the index counter.
  11240. @verbatim
  11241. __kernel void blend_images(__write_only image2d_t dst,
  11242. unsigned int index,
  11243. __read_only image2d_t src1,
  11244. __read_only image2d_t src2)
  11245. {
  11246. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11247. CLK_FILTER_LINEAR);
  11248. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  11249. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11250. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  11251. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  11252. float4 val1 = read_imagef(src1, sampler, src1_loc);
  11253. float4 val2 = read_imagef(src2, sampler, src2_loc);
  11254. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  11255. }
  11256. @end verbatim
  11257. @end itemize
  11258. @section pseudocolor
  11259. Alter frame colors in video with pseudocolors.
  11260. This filter accepts the following options:
  11261. @table @option
  11262. @item c0
  11263. set pixel first component expression
  11264. @item c1
  11265. set pixel second component expression
  11266. @item c2
  11267. set pixel third component expression
  11268. @item c3
  11269. set pixel fourth component expression, corresponds to the alpha component
  11270. @item i
  11271. set component to use as base for altering colors
  11272. @end table
  11273. Each of them specifies the expression to use for computing the lookup table for
  11274. the corresponding pixel component values.
  11275. The expressions can contain the following constants and functions:
  11276. @table @option
  11277. @item w
  11278. @item h
  11279. The input width and height.
  11280. @item val
  11281. The input value for the pixel component.
  11282. @item ymin, umin, vmin, amin
  11283. The minimum allowed component value.
  11284. @item ymax, umax, vmax, amax
  11285. The maximum allowed component value.
  11286. @end table
  11287. All expressions default to "val".
  11288. @subsection Examples
  11289. @itemize
  11290. @item
  11291. Change too high luma values to gradient:
  11292. @example
  11293. 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'"
  11294. @end example
  11295. @end itemize
  11296. @section psnr
  11297. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11298. Ratio) between two input videos.
  11299. This filter takes in input two input videos, the first input is
  11300. considered the "main" source and is passed unchanged to the
  11301. output. The second input is used as a "reference" video for computing
  11302. the PSNR.
  11303. Both video inputs must have the same resolution and pixel format for
  11304. this filter to work correctly. Also it assumes that both inputs
  11305. have the same number of frames, which are compared one by one.
  11306. The obtained average PSNR is printed through the logging system.
  11307. The filter stores the accumulated MSE (mean squared error) of each
  11308. frame, and at the end of the processing it is averaged across all frames
  11309. equally, and the following formula is applied to obtain the PSNR:
  11310. @example
  11311. PSNR = 10*log10(MAX^2/MSE)
  11312. @end example
  11313. Where MAX is the average of the maximum values of each component of the
  11314. image.
  11315. The description of the accepted parameters follows.
  11316. @table @option
  11317. @item stats_file, f
  11318. If specified the filter will use the named file to save the PSNR of
  11319. each individual frame. When filename equals "-" the data is sent to
  11320. standard output.
  11321. @item stats_version
  11322. Specifies which version of the stats file format to use. Details of
  11323. each format are written below.
  11324. Default value is 1.
  11325. @item stats_add_max
  11326. Determines whether the max value is output to the stats log.
  11327. Default value is 0.
  11328. Requires stats_version >= 2. If this is set and stats_version < 2,
  11329. the filter will return an error.
  11330. @end table
  11331. This filter also supports the @ref{framesync} options.
  11332. The file printed if @var{stats_file} is selected, contains a sequence of
  11333. key/value pairs of the form @var{key}:@var{value} for each compared
  11334. couple of frames.
  11335. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11336. the list of per-frame-pair stats, with key value pairs following the frame
  11337. format with the following parameters:
  11338. @table @option
  11339. @item psnr_log_version
  11340. The version of the log file format. Will match @var{stats_version}.
  11341. @item fields
  11342. A comma separated list of the per-frame-pair parameters included in
  11343. the log.
  11344. @end table
  11345. A description of each shown per-frame-pair parameter follows:
  11346. @table @option
  11347. @item n
  11348. sequential number of the input frame, starting from 1
  11349. @item mse_avg
  11350. Mean Square Error pixel-by-pixel average difference of the compared
  11351. frames, averaged over all the image components.
  11352. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11353. Mean Square Error pixel-by-pixel average difference of the compared
  11354. frames for the component specified by the suffix.
  11355. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11356. Peak Signal to Noise ratio of the compared frames for the component
  11357. specified by the suffix.
  11358. @item max_avg, max_y, max_u, max_v
  11359. Maximum allowed value for each channel, and average over all
  11360. channels.
  11361. @end table
  11362. @subsection Examples
  11363. @itemize
  11364. @item
  11365. For example:
  11366. @example
  11367. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11368. [main][ref] psnr="stats_file=stats.log" [out]
  11369. @end example
  11370. On this example the input file being processed is compared with the
  11371. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11372. is stored in @file{stats.log}.
  11373. @item
  11374. Another example with different containers:
  11375. @example
  11376. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=1/AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=1/AVTB,setpts=PTS-STARTPTS[ref];[main][ref]psnr" -f null -
  11377. @end example
  11378. @end itemize
  11379. @anchor{pullup}
  11380. @section pullup
  11381. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11382. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11383. content.
  11384. The pullup filter is designed to take advantage of future context in making
  11385. its decisions. This filter is stateless in the sense that it does not lock
  11386. onto a pattern to follow, but it instead looks forward to the following
  11387. fields in order to identify matches and rebuild progressive frames.
  11388. To produce content with an even framerate, insert the fps filter after
  11389. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11390. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11391. The filter accepts the following options:
  11392. @table @option
  11393. @item jl
  11394. @item jr
  11395. @item jt
  11396. @item jb
  11397. These options set the amount of "junk" to ignore at the left, right, top, and
  11398. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11399. while top and bottom are in units of 2 lines.
  11400. The default is 8 pixels on each side.
  11401. @item sb
  11402. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11403. filter generating an occasional mismatched frame, but it may also cause an
  11404. excessive number of frames to be dropped during high motion sequences.
  11405. Conversely, setting it to -1 will make filter match fields more easily.
  11406. This may help processing of video where there is slight blurring between
  11407. the fields, but may also cause there to be interlaced frames in the output.
  11408. Default value is @code{0}.
  11409. @item mp
  11410. Set the metric plane to use. It accepts the following values:
  11411. @table @samp
  11412. @item l
  11413. Use luma plane.
  11414. @item u
  11415. Use chroma blue plane.
  11416. @item v
  11417. Use chroma red plane.
  11418. @end table
  11419. This option may be set to use chroma plane instead of the default luma plane
  11420. for doing filter's computations. This may improve accuracy on very clean
  11421. source material, but more likely will decrease accuracy, especially if there
  11422. is chroma noise (rainbow effect) or any grayscale video.
  11423. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11424. load and make pullup usable in realtime on slow machines.
  11425. @end table
  11426. For best results (without duplicated frames in the output file) it is
  11427. necessary to change the output frame rate. For example, to inverse
  11428. telecine NTSC input:
  11429. @example
  11430. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11431. @end example
  11432. @section qp
  11433. Change video quantization parameters (QP).
  11434. The filter accepts the following option:
  11435. @table @option
  11436. @item qp
  11437. Set expression for quantization parameter.
  11438. @end table
  11439. The expression is evaluated through the eval API and can contain, among others,
  11440. the following constants:
  11441. @table @var
  11442. @item known
  11443. 1 if index is not 129, 0 otherwise.
  11444. @item qp
  11445. Sequential index starting from -129 to 128.
  11446. @end table
  11447. @subsection Examples
  11448. @itemize
  11449. @item
  11450. Some equation like:
  11451. @example
  11452. qp=2+2*sin(PI*qp)
  11453. @end example
  11454. @end itemize
  11455. @section random
  11456. Flush video frames from internal cache of frames into a random order.
  11457. No frame is discarded.
  11458. Inspired by @ref{frei0r} nervous filter.
  11459. @table @option
  11460. @item frames
  11461. Set size in number of frames of internal cache, in range from @code{2} to
  11462. @code{512}. Default is @code{30}.
  11463. @item seed
  11464. Set seed for random number generator, must be an integer included between
  11465. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11466. less than @code{0}, the filter will try to use a good random seed on a
  11467. best effort basis.
  11468. @end table
  11469. @section readeia608
  11470. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11471. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11472. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11473. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11474. @table @option
  11475. @item lavfi.readeia608.X.cc
  11476. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11477. @item lavfi.readeia608.X.line
  11478. The number of the line on which the EIA-608 data was identified and read.
  11479. @end table
  11480. This filter accepts the following options:
  11481. @table @option
  11482. @item scan_min
  11483. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11484. @item scan_max
  11485. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11486. @item mac
  11487. Set minimal acceptable amplitude change for sync codes detection.
  11488. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  11489. @item spw
  11490. Set the ratio of width reserved for sync code detection.
  11491. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  11492. @item mhd
  11493. Set the max peaks height difference for sync code detection.
  11494. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11495. @item mpd
  11496. Set max peaks period difference for sync code detection.
  11497. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11498. @item msd
  11499. Set the first two max start code bits differences.
  11500. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  11501. @item bhd
  11502. Set the minimum ratio of bits height compared to 3rd start code bit.
  11503. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  11504. @item th_w
  11505. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  11506. @item th_b
  11507. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  11508. @item chp
  11509. Enable checking the parity bit. In the event of a parity error, the filter will output
  11510. @code{0x00} for that character. Default is false.
  11511. @item lp
  11512. Lowpass lines prior to further processing. Default is disabled.
  11513. @end table
  11514. @subsection Examples
  11515. @itemize
  11516. @item
  11517. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11518. @example
  11519. 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
  11520. @end example
  11521. @end itemize
  11522. @section readvitc
  11523. Read vertical interval timecode (VITC) information from the top lines of a
  11524. video frame.
  11525. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11526. timecode value, if a valid timecode has been detected. Further metadata key
  11527. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11528. timecode data has been found or not.
  11529. This filter accepts the following options:
  11530. @table @option
  11531. @item scan_max
  11532. Set the maximum number of lines to scan for VITC data. If the value is set to
  11533. @code{-1} the full video frame is scanned. Default is @code{45}.
  11534. @item thr_b
  11535. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11536. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11537. @item thr_w
  11538. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11539. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11540. @end table
  11541. @subsection Examples
  11542. @itemize
  11543. @item
  11544. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11545. draw @code{--:--:--:--} as a placeholder:
  11546. @example
  11547. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11548. @end example
  11549. @end itemize
  11550. @section remap
  11551. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11552. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11553. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11554. value for pixel will be used for destination pixel.
  11555. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11556. will have Xmap/Ymap video stream dimensions.
  11557. Xmap and Ymap input video streams are 16bit depth, single channel.
  11558. @table @option
  11559. @item format
  11560. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11561. Default is @code{color}.
  11562. @end table
  11563. @section removegrain
  11564. The removegrain filter is a spatial denoiser for progressive video.
  11565. @table @option
  11566. @item m0
  11567. Set mode for the first plane.
  11568. @item m1
  11569. Set mode for the second plane.
  11570. @item m2
  11571. Set mode for the third plane.
  11572. @item m3
  11573. Set mode for the fourth plane.
  11574. @end table
  11575. Range of mode is from 0 to 24. Description of each mode follows:
  11576. @table @var
  11577. @item 0
  11578. Leave input plane unchanged. Default.
  11579. @item 1
  11580. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11581. @item 2
  11582. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11583. @item 3
  11584. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11585. @item 4
  11586. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11587. This is equivalent to a median filter.
  11588. @item 5
  11589. Line-sensitive clipping giving the minimal change.
  11590. @item 6
  11591. Line-sensitive clipping, intermediate.
  11592. @item 7
  11593. Line-sensitive clipping, intermediate.
  11594. @item 8
  11595. Line-sensitive clipping, intermediate.
  11596. @item 9
  11597. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11598. @item 10
  11599. Replaces the target pixel with the closest neighbour.
  11600. @item 11
  11601. [1 2 1] horizontal and vertical kernel blur.
  11602. @item 12
  11603. Same as mode 11.
  11604. @item 13
  11605. Bob mode, interpolates top field from the line where the neighbours
  11606. pixels are the closest.
  11607. @item 14
  11608. Bob mode, interpolates bottom field from the line where the neighbours
  11609. pixels are the closest.
  11610. @item 15
  11611. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11612. interpolation formula.
  11613. @item 16
  11614. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11615. interpolation formula.
  11616. @item 17
  11617. Clips the pixel with the minimum and maximum of respectively the maximum and
  11618. minimum of each pair of opposite neighbour pixels.
  11619. @item 18
  11620. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11621. the current pixel is minimal.
  11622. @item 19
  11623. Replaces the pixel with the average of its 8 neighbours.
  11624. @item 20
  11625. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11626. @item 21
  11627. Clips pixels using the averages of opposite neighbour.
  11628. @item 22
  11629. Same as mode 21 but simpler and faster.
  11630. @item 23
  11631. Small edge and halo removal, but reputed useless.
  11632. @item 24
  11633. Similar as 23.
  11634. @end table
  11635. @section removelogo
  11636. Suppress a TV station logo, using an image file to determine which
  11637. pixels comprise the logo. It works by filling in the pixels that
  11638. comprise the logo with neighboring pixels.
  11639. The filter accepts the following options:
  11640. @table @option
  11641. @item filename, f
  11642. Set the filter bitmap file, which can be any image format supported by
  11643. libavformat. The width and height of the image file must match those of the
  11644. video stream being processed.
  11645. @end table
  11646. Pixels in the provided bitmap image with a value of zero are not
  11647. considered part of the logo, non-zero pixels are considered part of
  11648. the logo. If you use white (255) for the logo and black (0) for the
  11649. rest, you will be safe. For making the filter bitmap, it is
  11650. recommended to take a screen capture of a black frame with the logo
  11651. visible, and then using a threshold filter followed by the erode
  11652. filter once or twice.
  11653. If needed, little splotches can be fixed manually. Remember that if
  11654. logo pixels are not covered, the filter quality will be much
  11655. reduced. Marking too many pixels as part of the logo does not hurt as
  11656. much, but it will increase the amount of blurring needed to cover over
  11657. the image and will destroy more information than necessary, and extra
  11658. pixels will slow things down on a large logo.
  11659. @section repeatfields
  11660. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11661. fields based on its value.
  11662. @section reverse
  11663. Reverse a video clip.
  11664. Warning: This filter requires memory to buffer the entire clip, so trimming
  11665. is suggested.
  11666. @subsection Examples
  11667. @itemize
  11668. @item
  11669. Take the first 5 seconds of a clip, and reverse it.
  11670. @example
  11671. trim=end=5,reverse
  11672. @end example
  11673. @end itemize
  11674. @section rgbashift
  11675. Shift R/G/B/A pixels horizontally and/or vertically.
  11676. The filter accepts the following options:
  11677. @table @option
  11678. @item rh
  11679. Set amount to shift red horizontally.
  11680. @item rv
  11681. Set amount to shift red vertically.
  11682. @item gh
  11683. Set amount to shift green horizontally.
  11684. @item gv
  11685. Set amount to shift green vertically.
  11686. @item bh
  11687. Set amount to shift blue horizontally.
  11688. @item bv
  11689. Set amount to shift blue vertically.
  11690. @item ah
  11691. Set amount to shift alpha horizontally.
  11692. @item av
  11693. Set amount to shift alpha vertically.
  11694. @item edge
  11695. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11696. @end table
  11697. @section roberts
  11698. Apply roberts cross operator to input video stream.
  11699. The filter accepts the following option:
  11700. @table @option
  11701. @item planes
  11702. Set which planes will be processed, unprocessed planes will be copied.
  11703. By default value 0xf, all planes will be processed.
  11704. @item scale
  11705. Set value which will be multiplied with filtered result.
  11706. @item delta
  11707. Set value which will be added to filtered result.
  11708. @end table
  11709. @section rotate
  11710. Rotate video by an arbitrary angle expressed in radians.
  11711. The filter accepts the following options:
  11712. A description of the optional parameters follows.
  11713. @table @option
  11714. @item angle, a
  11715. Set an expression for the angle by which to rotate the input video
  11716. clockwise, expressed as a number of radians. A negative value will
  11717. result in a counter-clockwise rotation. By default it is set to "0".
  11718. This expression is evaluated for each frame.
  11719. @item out_w, ow
  11720. Set the output width expression, default value is "iw".
  11721. This expression is evaluated just once during configuration.
  11722. @item out_h, oh
  11723. Set the output height expression, default value is "ih".
  11724. This expression is evaluated just once during configuration.
  11725. @item bilinear
  11726. Enable bilinear interpolation if set to 1, a value of 0 disables
  11727. it. Default value is 1.
  11728. @item fillcolor, c
  11729. Set the color used to fill the output area not covered by the rotated
  11730. image. For the general syntax of this option, check the
  11731. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11732. If the special value "none" is selected then no
  11733. background is printed (useful for example if the background is never shown).
  11734. Default value is "black".
  11735. @end table
  11736. The expressions for the angle and the output size can contain the
  11737. following constants and functions:
  11738. @table @option
  11739. @item n
  11740. sequential number of the input frame, starting from 0. It is always NAN
  11741. before the first frame is filtered.
  11742. @item t
  11743. time in seconds of the input frame, it is set to 0 when the filter is
  11744. configured. It is always NAN before the first frame is filtered.
  11745. @item hsub
  11746. @item vsub
  11747. horizontal and vertical chroma subsample values. For example for the
  11748. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11749. @item in_w, iw
  11750. @item in_h, ih
  11751. the input video width and height
  11752. @item out_w, ow
  11753. @item out_h, oh
  11754. the output width and height, that is the size of the padded area as
  11755. specified by the @var{width} and @var{height} expressions
  11756. @item rotw(a)
  11757. @item roth(a)
  11758. the minimal width/height required for completely containing the input
  11759. video rotated by @var{a} radians.
  11760. These are only available when computing the @option{out_w} and
  11761. @option{out_h} expressions.
  11762. @end table
  11763. @subsection Examples
  11764. @itemize
  11765. @item
  11766. Rotate the input by PI/6 radians clockwise:
  11767. @example
  11768. rotate=PI/6
  11769. @end example
  11770. @item
  11771. Rotate the input by PI/6 radians counter-clockwise:
  11772. @example
  11773. rotate=-PI/6
  11774. @end example
  11775. @item
  11776. Rotate the input by 45 degrees clockwise:
  11777. @example
  11778. rotate=45*PI/180
  11779. @end example
  11780. @item
  11781. Apply a constant rotation with period T, starting from an angle of PI/3:
  11782. @example
  11783. rotate=PI/3+2*PI*t/T
  11784. @end example
  11785. @item
  11786. Make the input video rotation oscillating with a period of T
  11787. seconds and an amplitude of A radians:
  11788. @example
  11789. rotate=A*sin(2*PI/T*t)
  11790. @end example
  11791. @item
  11792. Rotate the video, output size is chosen so that the whole rotating
  11793. input video is always completely contained in the output:
  11794. @example
  11795. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11796. @end example
  11797. @item
  11798. Rotate the video, reduce the output size so that no background is ever
  11799. shown:
  11800. @example
  11801. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11802. @end example
  11803. @end itemize
  11804. @subsection Commands
  11805. The filter supports the following commands:
  11806. @table @option
  11807. @item a, angle
  11808. Set the angle expression.
  11809. The command accepts the same syntax of the corresponding option.
  11810. If the specified expression is not valid, it is kept at its current
  11811. value.
  11812. @end table
  11813. @section sab
  11814. Apply Shape Adaptive Blur.
  11815. The filter accepts the following options:
  11816. @table @option
  11817. @item luma_radius, lr
  11818. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11819. value is 1.0. A greater value will result in a more blurred image, and
  11820. in slower processing.
  11821. @item luma_pre_filter_radius, lpfr
  11822. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11823. value is 1.0.
  11824. @item luma_strength, ls
  11825. Set luma maximum difference between pixels to still be considered, must
  11826. be a value in the 0.1-100.0 range, default value is 1.0.
  11827. @item chroma_radius, cr
  11828. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11829. greater value will result in a more blurred image, and in slower
  11830. processing.
  11831. @item chroma_pre_filter_radius, cpfr
  11832. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11833. @item chroma_strength, cs
  11834. Set chroma maximum difference between pixels to still be considered,
  11835. must be a value in the -0.9-100.0 range.
  11836. @end table
  11837. Each chroma option value, if not explicitly specified, is set to the
  11838. corresponding luma option value.
  11839. @anchor{scale}
  11840. @section scale
  11841. Scale (resize) the input video, using the libswscale library.
  11842. The scale filter forces the output display aspect ratio to be the same
  11843. of the input, by changing the output sample aspect ratio.
  11844. If the input image format is different from the format requested by
  11845. the next filter, the scale filter will convert the input to the
  11846. requested format.
  11847. @subsection Options
  11848. The filter accepts the following options, or any of the options
  11849. supported by the libswscale scaler.
  11850. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11851. the complete list of scaler options.
  11852. @table @option
  11853. @item width, w
  11854. @item height, h
  11855. Set the output video dimension expression. Default value is the input
  11856. dimension.
  11857. If the @var{width} or @var{w} value is 0, the input width is used for
  11858. the output. If the @var{height} or @var{h} value is 0, the input height
  11859. is used for the output.
  11860. If one and only one of the values is -n with n >= 1, the scale filter
  11861. will use a value that maintains the aspect ratio of the input image,
  11862. calculated from the other specified dimension. After that it will,
  11863. however, make sure that the calculated dimension is divisible by n and
  11864. adjust the value if necessary.
  11865. If both values are -n with n >= 1, the behavior will be identical to
  11866. both values being set to 0 as previously detailed.
  11867. See below for the list of accepted constants for use in the dimension
  11868. expression.
  11869. @item eval
  11870. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11871. @table @samp
  11872. @item init
  11873. Only evaluate expressions once during the filter initialization or when a command is processed.
  11874. @item frame
  11875. Evaluate expressions for each incoming frame.
  11876. @end table
  11877. Default value is @samp{init}.
  11878. @item interl
  11879. Set the interlacing mode. It accepts the following values:
  11880. @table @samp
  11881. @item 1
  11882. Force interlaced aware scaling.
  11883. @item 0
  11884. Do not apply interlaced scaling.
  11885. @item -1
  11886. Select interlaced aware scaling depending on whether the source frames
  11887. are flagged as interlaced or not.
  11888. @end table
  11889. Default value is @samp{0}.
  11890. @item flags
  11891. Set libswscale scaling flags. See
  11892. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11893. complete list of values. If not explicitly specified the filter applies
  11894. the default flags.
  11895. @item param0, param1
  11896. Set libswscale input parameters for scaling algorithms that need them. See
  11897. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11898. complete documentation. If not explicitly specified the filter applies
  11899. empty parameters.
  11900. @item size, s
  11901. Set the video size. For the syntax of this option, check the
  11902. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11903. @item in_color_matrix
  11904. @item out_color_matrix
  11905. Set in/output YCbCr color space type.
  11906. This allows the autodetected value to be overridden as well as allows forcing
  11907. a specific value used for the output and encoder.
  11908. If not specified, the color space type depends on the pixel format.
  11909. Possible values:
  11910. @table @samp
  11911. @item auto
  11912. Choose automatically.
  11913. @item bt709
  11914. Format conforming to International Telecommunication Union (ITU)
  11915. Recommendation BT.709.
  11916. @item fcc
  11917. Set color space conforming to the United States Federal Communications
  11918. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11919. @item bt601
  11920. @item bt470
  11921. @item smpte170m
  11922. Set color space conforming to:
  11923. @itemize
  11924. @item
  11925. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11926. @item
  11927. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11928. @item
  11929. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11930. @end itemize
  11931. @item smpte240m
  11932. Set color space conforming to SMPTE ST 240:1999.
  11933. @item bt2020
  11934. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  11935. @end table
  11936. @item in_range
  11937. @item out_range
  11938. Set in/output YCbCr sample range.
  11939. This allows the autodetected value to be overridden as well as allows forcing
  11940. a specific value used for the output and encoder. If not specified, the
  11941. range depends on the pixel format. Possible values:
  11942. @table @samp
  11943. @item auto/unknown
  11944. Choose automatically.
  11945. @item jpeg/full/pc
  11946. Set full range (0-255 in case of 8-bit luma).
  11947. @item mpeg/limited/tv
  11948. Set "MPEG" range (16-235 in case of 8-bit luma).
  11949. @end table
  11950. @item force_original_aspect_ratio
  11951. Enable decreasing or increasing output video width or height if necessary to
  11952. keep the original aspect ratio. Possible values:
  11953. @table @samp
  11954. @item disable
  11955. Scale the video as specified and disable this feature.
  11956. @item decrease
  11957. The output video dimensions will automatically be decreased if needed.
  11958. @item increase
  11959. The output video dimensions will automatically be increased if needed.
  11960. @end table
  11961. One useful instance of this option is that when you know a specific device's
  11962. maximum allowed resolution, you can use this to limit the output video to
  11963. that, while retaining the aspect ratio. For example, device A allows
  11964. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11965. decrease) and specifying 1280x720 to the command line makes the output
  11966. 1280x533.
  11967. Please note that this is a different thing than specifying -1 for @option{w}
  11968. or @option{h}, you still need to specify the output resolution for this option
  11969. to work.
  11970. @item force_divisible_by
  11971. Ensures that both the output dimensions, width and height, are divisible by the
  11972. given integer when used together with @option{force_original_aspect_ratio}. This
  11973. works similar to using @code{-n} in the @option{w} and @option{h} options.
  11974. This option respects the value set for @option{force_original_aspect_ratio},
  11975. increasing or decreasing the resolution accordingly. The video's aspect ratio
  11976. may be slightly modified.
  11977. This option can be handy if you need to have a video fit within or exceed
  11978. a defined resolution using @option{force_original_aspect_ratio} but also have
  11979. encoder restrictions on width or height divisibility.
  11980. @end table
  11981. The values of the @option{w} and @option{h} options are expressions
  11982. containing the following constants:
  11983. @table @var
  11984. @item in_w
  11985. @item in_h
  11986. The input width and height
  11987. @item iw
  11988. @item ih
  11989. These are the same as @var{in_w} and @var{in_h}.
  11990. @item out_w
  11991. @item out_h
  11992. The output (scaled) width and height
  11993. @item ow
  11994. @item oh
  11995. These are the same as @var{out_w} and @var{out_h}
  11996. @item a
  11997. The same as @var{iw} / @var{ih}
  11998. @item sar
  11999. input sample aspect ratio
  12000. @item dar
  12001. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12002. @item hsub
  12003. @item vsub
  12004. horizontal and vertical input chroma subsample values. For example for the
  12005. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12006. @item ohsub
  12007. @item ovsub
  12008. horizontal and vertical output chroma subsample values. For example for the
  12009. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12010. @end table
  12011. @subsection Examples
  12012. @itemize
  12013. @item
  12014. Scale the input video to a size of 200x100
  12015. @example
  12016. scale=w=200:h=100
  12017. @end example
  12018. This is equivalent to:
  12019. @example
  12020. scale=200:100
  12021. @end example
  12022. or:
  12023. @example
  12024. scale=200x100
  12025. @end example
  12026. @item
  12027. Specify a size abbreviation for the output size:
  12028. @example
  12029. scale=qcif
  12030. @end example
  12031. which can also be written as:
  12032. @example
  12033. scale=size=qcif
  12034. @end example
  12035. @item
  12036. Scale the input to 2x:
  12037. @example
  12038. scale=w=2*iw:h=2*ih
  12039. @end example
  12040. @item
  12041. The above is the same as:
  12042. @example
  12043. scale=2*in_w:2*in_h
  12044. @end example
  12045. @item
  12046. Scale the input to 2x with forced interlaced scaling:
  12047. @example
  12048. scale=2*iw:2*ih:interl=1
  12049. @end example
  12050. @item
  12051. Scale the input to half size:
  12052. @example
  12053. scale=w=iw/2:h=ih/2
  12054. @end example
  12055. @item
  12056. Increase the width, and set the height to the same size:
  12057. @example
  12058. scale=3/2*iw:ow
  12059. @end example
  12060. @item
  12061. Seek Greek harmony:
  12062. @example
  12063. scale=iw:1/PHI*iw
  12064. scale=ih*PHI:ih
  12065. @end example
  12066. @item
  12067. Increase the height, and set the width to 3/2 of the height:
  12068. @example
  12069. scale=w=3/2*oh:h=3/5*ih
  12070. @end example
  12071. @item
  12072. Increase the size, making the size a multiple of the chroma
  12073. subsample values:
  12074. @example
  12075. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12076. @end example
  12077. @item
  12078. Increase the width to a maximum of 500 pixels,
  12079. keeping the same aspect ratio as the input:
  12080. @example
  12081. scale=w='min(500\, iw*3/2):h=-1'
  12082. @end example
  12083. @item
  12084. Make pixels square by combining scale and setsar:
  12085. @example
  12086. scale='trunc(ih*dar):ih',setsar=1/1
  12087. @end example
  12088. @item
  12089. Make pixels square by combining scale and setsar,
  12090. making sure the resulting resolution is even (required by some codecs):
  12091. @example
  12092. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12093. @end example
  12094. @end itemize
  12095. @subsection Commands
  12096. This filter supports the following commands:
  12097. @table @option
  12098. @item width, w
  12099. @item height, h
  12100. Set the output video dimension expression.
  12101. The command accepts the same syntax of the corresponding option.
  12102. If the specified expression is not valid, it is kept at its current
  12103. value.
  12104. @end table
  12105. @section scale_npp
  12106. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12107. format conversion on CUDA video frames. Setting the output width and height
  12108. works in the same way as for the @var{scale} filter.
  12109. The following additional options are accepted:
  12110. @table @option
  12111. @item format
  12112. The pixel format of the output CUDA frames. If set to the string "same" (the
  12113. default), the input format will be kept. Note that automatic format negotiation
  12114. and conversion is not yet supported for hardware frames
  12115. @item interp_algo
  12116. The interpolation algorithm used for resizing. One of the following:
  12117. @table @option
  12118. @item nn
  12119. Nearest neighbour.
  12120. @item linear
  12121. @item cubic
  12122. @item cubic2p_bspline
  12123. 2-parameter cubic (B=1, C=0)
  12124. @item cubic2p_catmullrom
  12125. 2-parameter cubic (B=0, C=1/2)
  12126. @item cubic2p_b05c03
  12127. 2-parameter cubic (B=1/2, C=3/10)
  12128. @item super
  12129. Supersampling
  12130. @item lanczos
  12131. @end table
  12132. @end table
  12133. @section scale2ref
  12134. Scale (resize) the input video, based on a reference video.
  12135. See the scale filter for available options, scale2ref supports the same but
  12136. uses the reference video instead of the main input as basis. scale2ref also
  12137. supports the following additional constants for the @option{w} and
  12138. @option{h} options:
  12139. @table @var
  12140. @item main_w
  12141. @item main_h
  12142. The main input video's width and height
  12143. @item main_a
  12144. The same as @var{main_w} / @var{main_h}
  12145. @item main_sar
  12146. The main input video's sample aspect ratio
  12147. @item main_dar, mdar
  12148. The main input video's display aspect ratio. Calculated from
  12149. @code{(main_w / main_h) * main_sar}.
  12150. @item main_hsub
  12151. @item main_vsub
  12152. The main input video's horizontal and vertical chroma subsample values.
  12153. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12154. is 1.
  12155. @end table
  12156. @subsection Examples
  12157. @itemize
  12158. @item
  12159. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12160. @example
  12161. 'scale2ref[b][a];[a][b]overlay'
  12162. @end example
  12163. @item
  12164. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12165. @example
  12166. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12167. @end example
  12168. @end itemize
  12169. @section scroll
  12170. Scroll input video horizontally and/or vertically by constant speed.
  12171. The filter accepts the following options:
  12172. @table @option
  12173. @item horizontal, h
  12174. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12175. Negative values changes scrolling direction.
  12176. @item vertical, v
  12177. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12178. Negative values changes scrolling direction.
  12179. @item hpos
  12180. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12181. @item vpos
  12182. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12183. @end table
  12184. @subsection Commands
  12185. This filter supports the following @ref{commands}:
  12186. @table @option
  12187. @item horizontal, h
  12188. Set the horizontal scrolling speed.
  12189. @item vertical, v
  12190. Set the vertical scrolling speed.
  12191. @end table
  12192. @anchor{selectivecolor}
  12193. @section selectivecolor
  12194. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12195. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12196. by the "purity" of the color (that is, how saturated it already is).
  12197. This filter is similar to the Adobe Photoshop Selective Color tool.
  12198. The filter accepts the following options:
  12199. @table @option
  12200. @item correction_method
  12201. Select color correction method.
  12202. Available values are:
  12203. @table @samp
  12204. @item absolute
  12205. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12206. component value).
  12207. @item relative
  12208. Specified adjustments are relative to the original component value.
  12209. @end table
  12210. Default is @code{absolute}.
  12211. @item reds
  12212. Adjustments for red pixels (pixels where the red component is the maximum)
  12213. @item yellows
  12214. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12215. @item greens
  12216. Adjustments for green pixels (pixels where the green component is the maximum)
  12217. @item cyans
  12218. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12219. @item blues
  12220. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12221. @item magentas
  12222. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12223. @item whites
  12224. Adjustments for white pixels (pixels where all components are greater than 128)
  12225. @item neutrals
  12226. Adjustments for all pixels except pure black and pure white
  12227. @item blacks
  12228. Adjustments for black pixels (pixels where all components are lesser than 128)
  12229. @item psfile
  12230. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12231. @end table
  12232. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12233. 4 space separated floating point adjustment values in the [-1,1] range,
  12234. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12235. pixels of its range.
  12236. @subsection Examples
  12237. @itemize
  12238. @item
  12239. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12240. increase magenta by 27% in blue areas:
  12241. @example
  12242. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12243. @end example
  12244. @item
  12245. Use a Photoshop selective color preset:
  12246. @example
  12247. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12248. @end example
  12249. @end itemize
  12250. @anchor{separatefields}
  12251. @section separatefields
  12252. The @code{separatefields} takes a frame-based video input and splits
  12253. each frame into its components fields, producing a new half height clip
  12254. with twice the frame rate and twice the frame count.
  12255. This filter use field-dominance information in frame to decide which
  12256. of each pair of fields to place first in the output.
  12257. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12258. @section setdar, setsar
  12259. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12260. output video.
  12261. This is done by changing the specified Sample (aka Pixel) Aspect
  12262. Ratio, according to the following equation:
  12263. @example
  12264. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12265. @end example
  12266. Keep in mind that the @code{setdar} filter does not modify the pixel
  12267. dimensions of the video frame. Also, the display aspect ratio set by
  12268. this filter may be changed by later filters in the filterchain,
  12269. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12270. applied.
  12271. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12272. the filter output video.
  12273. Note that as a consequence of the application of this filter, the
  12274. output display aspect ratio will change according to the equation
  12275. above.
  12276. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12277. filter may be changed by later filters in the filterchain, e.g. if
  12278. another "setsar" or a "setdar" filter is applied.
  12279. It accepts the following parameters:
  12280. @table @option
  12281. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12282. Set the aspect ratio used by the filter.
  12283. The parameter can be a floating point number string, an expression, or
  12284. a string of the form @var{num}:@var{den}, where @var{num} and
  12285. @var{den} are the numerator and denominator of the aspect ratio. If
  12286. the parameter is not specified, it is assumed the value "0".
  12287. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12288. should be escaped.
  12289. @item max
  12290. Set the maximum integer value to use for expressing numerator and
  12291. denominator when reducing the expressed aspect ratio to a rational.
  12292. Default value is @code{100}.
  12293. @end table
  12294. The parameter @var{sar} is an expression containing
  12295. the following constants:
  12296. @table @option
  12297. @item E, PI, PHI
  12298. These are approximated values for the mathematical constants e
  12299. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12300. @item w, h
  12301. The input width and height.
  12302. @item a
  12303. These are the same as @var{w} / @var{h}.
  12304. @item sar
  12305. The input sample aspect ratio.
  12306. @item dar
  12307. The input display aspect ratio. It is the same as
  12308. (@var{w} / @var{h}) * @var{sar}.
  12309. @item hsub, vsub
  12310. Horizontal and vertical chroma subsample values. For example, for the
  12311. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12312. @end table
  12313. @subsection Examples
  12314. @itemize
  12315. @item
  12316. To change the display aspect ratio to 16:9, specify one of the following:
  12317. @example
  12318. setdar=dar=1.77777
  12319. setdar=dar=16/9
  12320. @end example
  12321. @item
  12322. To change the sample aspect ratio to 10:11, specify:
  12323. @example
  12324. setsar=sar=10/11
  12325. @end example
  12326. @item
  12327. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12328. 1000 in the aspect ratio reduction, use the command:
  12329. @example
  12330. setdar=ratio=16/9:max=1000
  12331. @end example
  12332. @end itemize
  12333. @anchor{setfield}
  12334. @section setfield
  12335. Force field for the output video frame.
  12336. The @code{setfield} filter marks the interlace type field for the
  12337. output frames. It does not change the input frame, but only sets the
  12338. corresponding property, which affects how the frame is treated by
  12339. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12340. The filter accepts the following options:
  12341. @table @option
  12342. @item mode
  12343. Available values are:
  12344. @table @samp
  12345. @item auto
  12346. Keep the same field property.
  12347. @item bff
  12348. Mark the frame as bottom-field-first.
  12349. @item tff
  12350. Mark the frame as top-field-first.
  12351. @item prog
  12352. Mark the frame as progressive.
  12353. @end table
  12354. @end table
  12355. @anchor{setparams}
  12356. @section setparams
  12357. Force frame parameter for the output video frame.
  12358. The @code{setparams} filter marks interlace and color range for the
  12359. output frames. It does not change the input frame, but only sets the
  12360. corresponding property, which affects how the frame is treated by
  12361. filters/encoders.
  12362. @table @option
  12363. @item field_mode
  12364. Available values are:
  12365. @table @samp
  12366. @item auto
  12367. Keep the same field property (default).
  12368. @item bff
  12369. Mark the frame as bottom-field-first.
  12370. @item tff
  12371. Mark the frame as top-field-first.
  12372. @item prog
  12373. Mark the frame as progressive.
  12374. @end table
  12375. @item range
  12376. Available values are:
  12377. @table @samp
  12378. @item auto
  12379. Keep the same color range property (default).
  12380. @item unspecified, unknown
  12381. Mark the frame as unspecified color range.
  12382. @item limited, tv, mpeg
  12383. Mark the frame as limited range.
  12384. @item full, pc, jpeg
  12385. Mark the frame as full range.
  12386. @end table
  12387. @item color_primaries
  12388. Set the color primaries.
  12389. Available values are:
  12390. @table @samp
  12391. @item auto
  12392. Keep the same color primaries property (default).
  12393. @item bt709
  12394. @item unknown
  12395. @item bt470m
  12396. @item bt470bg
  12397. @item smpte170m
  12398. @item smpte240m
  12399. @item film
  12400. @item bt2020
  12401. @item smpte428
  12402. @item smpte431
  12403. @item smpte432
  12404. @item jedec-p22
  12405. @end table
  12406. @item color_trc
  12407. Set the color transfer.
  12408. Available values are:
  12409. @table @samp
  12410. @item auto
  12411. Keep the same color trc property (default).
  12412. @item bt709
  12413. @item unknown
  12414. @item bt470m
  12415. @item bt470bg
  12416. @item smpte170m
  12417. @item smpte240m
  12418. @item linear
  12419. @item log100
  12420. @item log316
  12421. @item iec61966-2-4
  12422. @item bt1361e
  12423. @item iec61966-2-1
  12424. @item bt2020-10
  12425. @item bt2020-12
  12426. @item smpte2084
  12427. @item smpte428
  12428. @item arib-std-b67
  12429. @end table
  12430. @item colorspace
  12431. Set the colorspace.
  12432. Available values are:
  12433. @table @samp
  12434. @item auto
  12435. Keep the same colorspace property (default).
  12436. @item gbr
  12437. @item bt709
  12438. @item unknown
  12439. @item fcc
  12440. @item bt470bg
  12441. @item smpte170m
  12442. @item smpte240m
  12443. @item ycgco
  12444. @item bt2020nc
  12445. @item bt2020c
  12446. @item smpte2085
  12447. @item chroma-derived-nc
  12448. @item chroma-derived-c
  12449. @item ictcp
  12450. @end table
  12451. @end table
  12452. @section showinfo
  12453. Show a line containing various information for each input video frame.
  12454. The input video is not modified.
  12455. This filter supports the following options:
  12456. @table @option
  12457. @item checksum
  12458. Calculate checksums of each plane. By default enabled.
  12459. @end table
  12460. The shown line contains a sequence of key/value pairs of the form
  12461. @var{key}:@var{value}.
  12462. The following values are shown in the output:
  12463. @table @option
  12464. @item n
  12465. The (sequential) number of the input frame, starting from 0.
  12466. @item pts
  12467. The Presentation TimeStamp of the input frame, expressed as a number of
  12468. time base units. The time base unit depends on the filter input pad.
  12469. @item pts_time
  12470. The Presentation TimeStamp of the input frame, expressed as a number of
  12471. seconds.
  12472. @item pos
  12473. The position of the frame in the input stream, or -1 if this information is
  12474. unavailable and/or meaningless (for example in case of synthetic video).
  12475. @item fmt
  12476. The pixel format name.
  12477. @item sar
  12478. The sample aspect ratio of the input frame, expressed in the form
  12479. @var{num}/@var{den}.
  12480. @item s
  12481. The size of the input frame. For the syntax of this option, check the
  12482. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12483. @item i
  12484. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12485. for bottom field first).
  12486. @item iskey
  12487. This is 1 if the frame is a key frame, 0 otherwise.
  12488. @item type
  12489. The picture type of the input frame ("I" for an I-frame, "P" for a
  12490. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12491. Also refer to the documentation of the @code{AVPictureType} enum and of
  12492. the @code{av_get_picture_type_char} function defined in
  12493. @file{libavutil/avutil.h}.
  12494. @item checksum
  12495. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12496. @item plane_checksum
  12497. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12498. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12499. @end table
  12500. @section showpalette
  12501. Displays the 256 colors palette of each frame. This filter is only relevant for
  12502. @var{pal8} pixel format frames.
  12503. It accepts the following option:
  12504. @table @option
  12505. @item s
  12506. Set the size of the box used to represent one palette color entry. Default is
  12507. @code{30} (for a @code{30x30} pixel box).
  12508. @end table
  12509. @section shuffleframes
  12510. Reorder and/or duplicate and/or drop video frames.
  12511. It accepts the following parameters:
  12512. @table @option
  12513. @item mapping
  12514. Set the destination indexes of input frames.
  12515. This is space or '|' separated list of indexes that maps input frames to output
  12516. frames. Number of indexes also sets maximal value that each index may have.
  12517. '-1' index have special meaning and that is to drop frame.
  12518. @end table
  12519. The first frame has the index 0. The default is to keep the input unchanged.
  12520. @subsection Examples
  12521. @itemize
  12522. @item
  12523. Swap second and third frame of every three frames of the input:
  12524. @example
  12525. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12526. @end example
  12527. @item
  12528. Swap 10th and 1st frame of every ten frames of the input:
  12529. @example
  12530. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12531. @end example
  12532. @end itemize
  12533. @section shuffleplanes
  12534. Reorder and/or duplicate video planes.
  12535. It accepts the following parameters:
  12536. @table @option
  12537. @item map0
  12538. The index of the input plane to be used as the first output plane.
  12539. @item map1
  12540. The index of the input plane to be used as the second output plane.
  12541. @item map2
  12542. The index of the input plane to be used as the third output plane.
  12543. @item map3
  12544. The index of the input plane to be used as the fourth output plane.
  12545. @end table
  12546. The first plane has the index 0. The default is to keep the input unchanged.
  12547. @subsection Examples
  12548. @itemize
  12549. @item
  12550. Swap the second and third planes of the input:
  12551. @example
  12552. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12553. @end example
  12554. @end itemize
  12555. @anchor{signalstats}
  12556. @section signalstats
  12557. Evaluate various visual metrics that assist in determining issues associated
  12558. with the digitization of analog video media.
  12559. By default the filter will log these metadata values:
  12560. @table @option
  12561. @item YMIN
  12562. Display the minimal Y value contained within the input frame. Expressed in
  12563. range of [0-255].
  12564. @item YLOW
  12565. Display the Y value at the 10% percentile within the input frame. Expressed in
  12566. range of [0-255].
  12567. @item YAVG
  12568. Display the average Y value within the input frame. Expressed in range of
  12569. [0-255].
  12570. @item YHIGH
  12571. Display the Y value at the 90% percentile within the input frame. Expressed in
  12572. range of [0-255].
  12573. @item YMAX
  12574. Display the maximum Y value contained within the input frame. Expressed in
  12575. range of [0-255].
  12576. @item UMIN
  12577. Display the minimal U value contained within the input frame. Expressed in
  12578. range of [0-255].
  12579. @item ULOW
  12580. Display the U value at the 10% percentile within the input frame. Expressed in
  12581. range of [0-255].
  12582. @item UAVG
  12583. Display the average U value within the input frame. Expressed in range of
  12584. [0-255].
  12585. @item UHIGH
  12586. Display the U value at the 90% percentile within the input frame. Expressed in
  12587. range of [0-255].
  12588. @item UMAX
  12589. Display the maximum U value contained within the input frame. Expressed in
  12590. range of [0-255].
  12591. @item VMIN
  12592. Display the minimal V value contained within the input frame. Expressed in
  12593. range of [0-255].
  12594. @item VLOW
  12595. Display the V value at the 10% percentile within the input frame. Expressed in
  12596. range of [0-255].
  12597. @item VAVG
  12598. Display the average V value within the input frame. Expressed in range of
  12599. [0-255].
  12600. @item VHIGH
  12601. Display the V value at the 90% percentile within the input frame. Expressed in
  12602. range of [0-255].
  12603. @item VMAX
  12604. Display the maximum V value contained within the input frame. Expressed in
  12605. range of [0-255].
  12606. @item SATMIN
  12607. Display the minimal saturation value contained within the input frame.
  12608. Expressed in range of [0-~181.02].
  12609. @item SATLOW
  12610. Display the saturation value at the 10% percentile within the input frame.
  12611. Expressed in range of [0-~181.02].
  12612. @item SATAVG
  12613. Display the average saturation value within the input frame. Expressed in range
  12614. of [0-~181.02].
  12615. @item SATHIGH
  12616. Display the saturation value at the 90% percentile within the input frame.
  12617. Expressed in range of [0-~181.02].
  12618. @item SATMAX
  12619. Display the maximum saturation value contained within the input frame.
  12620. Expressed in range of [0-~181.02].
  12621. @item HUEMED
  12622. Display the median value for hue within the input frame. Expressed in range of
  12623. [0-360].
  12624. @item HUEAVG
  12625. Display the average value for hue within the input frame. Expressed in range of
  12626. [0-360].
  12627. @item YDIF
  12628. Display the average of sample value difference between all values of the Y
  12629. plane in the current frame and corresponding values of the previous input frame.
  12630. Expressed in range of [0-255].
  12631. @item UDIF
  12632. Display the average of sample value difference between all values of the U
  12633. plane in the current frame and corresponding values of the previous input frame.
  12634. Expressed in range of [0-255].
  12635. @item VDIF
  12636. Display the average of sample value difference between all values of the V
  12637. plane in the current frame and corresponding values of the previous input frame.
  12638. Expressed in range of [0-255].
  12639. @item YBITDEPTH
  12640. Display bit depth of Y plane in current frame.
  12641. Expressed in range of [0-16].
  12642. @item UBITDEPTH
  12643. Display bit depth of U plane in current frame.
  12644. Expressed in range of [0-16].
  12645. @item VBITDEPTH
  12646. Display bit depth of V plane in current frame.
  12647. Expressed in range of [0-16].
  12648. @end table
  12649. The filter accepts the following options:
  12650. @table @option
  12651. @item stat
  12652. @item out
  12653. @option{stat} specify an additional form of image analysis.
  12654. @option{out} output video with the specified type of pixel highlighted.
  12655. Both options accept the following values:
  12656. @table @samp
  12657. @item tout
  12658. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12659. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12660. include the results of video dropouts, head clogs, or tape tracking issues.
  12661. @item vrep
  12662. Identify @var{vertical line repetition}. Vertical line repetition includes
  12663. similar rows of pixels within a frame. In born-digital video vertical line
  12664. repetition is common, but this pattern is uncommon in video digitized from an
  12665. analog source. When it occurs in video that results from the digitization of an
  12666. analog source it can indicate concealment from a dropout compensator.
  12667. @item brng
  12668. Identify pixels that fall outside of legal broadcast range.
  12669. @end table
  12670. @item color, c
  12671. Set the highlight color for the @option{out} option. The default color is
  12672. yellow.
  12673. @end table
  12674. @subsection Examples
  12675. @itemize
  12676. @item
  12677. Output data of various video metrics:
  12678. @example
  12679. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12680. @end example
  12681. @item
  12682. Output specific data about the minimum and maximum values of the Y plane per frame:
  12683. @example
  12684. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12685. @end example
  12686. @item
  12687. Playback video while highlighting pixels that are outside of broadcast range in red.
  12688. @example
  12689. ffplay example.mov -vf signalstats="out=brng:color=red"
  12690. @end example
  12691. @item
  12692. Playback video with signalstats metadata drawn over the frame.
  12693. @example
  12694. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12695. @end example
  12696. The contents of signalstat_drawtext.txt used in the command are:
  12697. @example
  12698. time %@{pts:hms@}
  12699. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12700. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12701. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12702. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12703. @end example
  12704. @end itemize
  12705. @anchor{signature}
  12706. @section signature
  12707. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12708. input. In this case the matching between the inputs can be calculated additionally.
  12709. The filter always passes through the first input. The signature of each stream can
  12710. be written into a file.
  12711. It accepts the following options:
  12712. @table @option
  12713. @item detectmode
  12714. Enable or disable the matching process.
  12715. Available values are:
  12716. @table @samp
  12717. @item off
  12718. Disable the calculation of a matching (default).
  12719. @item full
  12720. Calculate the matching for the whole video and output whether the whole video
  12721. matches or only parts.
  12722. @item fast
  12723. Calculate only until a matching is found or the video ends. Should be faster in
  12724. some cases.
  12725. @end table
  12726. @item nb_inputs
  12727. Set the number of inputs. The option value must be a non negative integer.
  12728. Default value is 1.
  12729. @item filename
  12730. Set the path to which the output is written. If there is more than one input,
  12731. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12732. integer), that will be replaced with the input number. If no filename is
  12733. specified, no output will be written. This is the default.
  12734. @item format
  12735. Choose the output format.
  12736. Available values are:
  12737. @table @samp
  12738. @item binary
  12739. Use the specified binary representation (default).
  12740. @item xml
  12741. Use the specified xml representation.
  12742. @end table
  12743. @item th_d
  12744. Set threshold to detect one word as similar. The option value must be an integer
  12745. greater than zero. The default value is 9000.
  12746. @item th_dc
  12747. Set threshold to detect all words as similar. The option value must be an integer
  12748. greater than zero. The default value is 60000.
  12749. @item th_xh
  12750. Set threshold to detect frames as similar. The option value must be an integer
  12751. greater than zero. The default value is 116.
  12752. @item th_di
  12753. Set the minimum length of a sequence in frames to recognize it as matching
  12754. sequence. The option value must be a non negative integer value.
  12755. The default value is 0.
  12756. @item th_it
  12757. Set the minimum relation, that matching frames to all frames must have.
  12758. The option value must be a double value between 0 and 1. The default value is 0.5.
  12759. @end table
  12760. @subsection Examples
  12761. @itemize
  12762. @item
  12763. To calculate the signature of an input video and store it in signature.bin:
  12764. @example
  12765. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12766. @end example
  12767. @item
  12768. To detect whether two videos match and store the signatures in XML format in
  12769. signature0.xml and signature1.xml:
  12770. @example
  12771. 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 -
  12772. @end example
  12773. @end itemize
  12774. @anchor{smartblur}
  12775. @section smartblur
  12776. Blur the input video without impacting the outlines.
  12777. It accepts the following options:
  12778. @table @option
  12779. @item luma_radius, lr
  12780. Set the luma radius. The option value must be a float number in
  12781. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12782. used to blur the image (slower if larger). Default value is 1.0.
  12783. @item luma_strength, ls
  12784. Set the luma strength. The option value must be a float number
  12785. in the range [-1.0,1.0] that configures the blurring. A value included
  12786. in [0.0,1.0] will blur the image whereas a value included in
  12787. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12788. @item luma_threshold, lt
  12789. Set the luma threshold used as a coefficient to determine
  12790. whether a pixel should be blurred or not. The option value must be an
  12791. integer in the range [-30,30]. A value of 0 will filter all the image,
  12792. a value included in [0,30] will filter flat areas and a value included
  12793. in [-30,0] will filter edges. Default value is 0.
  12794. @item chroma_radius, cr
  12795. Set the chroma radius. The option value must be a float number in
  12796. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12797. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12798. @item chroma_strength, cs
  12799. Set the chroma strength. The option value must be a float number
  12800. in the range [-1.0,1.0] that configures the blurring. A value included
  12801. in [0.0,1.0] will blur the image whereas a value included in
  12802. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12803. @item chroma_threshold, ct
  12804. Set the chroma threshold used as a coefficient to determine
  12805. whether a pixel should be blurred or not. The option value must be an
  12806. integer in the range [-30,30]. A value of 0 will filter all the image,
  12807. a value included in [0,30] will filter flat areas and a value included
  12808. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12809. @end table
  12810. If a chroma option is not explicitly set, the corresponding luma value
  12811. is set.
  12812. @section sobel
  12813. Apply sobel operator to input video stream.
  12814. The filter accepts the following option:
  12815. @table @option
  12816. @item planes
  12817. Set which planes will be processed, unprocessed planes will be copied.
  12818. By default value 0xf, all planes will be processed.
  12819. @item scale
  12820. Set value which will be multiplied with filtered result.
  12821. @item delta
  12822. Set value which will be added to filtered result.
  12823. @end table
  12824. @anchor{spp}
  12825. @section spp
  12826. Apply a simple postprocessing filter that compresses and decompresses the image
  12827. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12828. and average the results.
  12829. The filter accepts the following options:
  12830. @table @option
  12831. @item quality
  12832. Set quality. This option defines the number of levels for averaging. It accepts
  12833. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12834. effect. A value of @code{6} means the higher quality. For each increment of
  12835. that value the speed drops by a factor of approximately 2. Default value is
  12836. @code{3}.
  12837. @item qp
  12838. Force a constant quantization parameter. If not set, the filter will use the QP
  12839. from the video stream (if available).
  12840. @item mode
  12841. Set thresholding mode. Available modes are:
  12842. @table @samp
  12843. @item hard
  12844. Set hard thresholding (default).
  12845. @item soft
  12846. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12847. @end table
  12848. @item use_bframe_qp
  12849. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12850. option may cause flicker since the B-Frames have often larger QP. Default is
  12851. @code{0} (not enabled).
  12852. @end table
  12853. @section sr
  12854. Scale the input by applying one of the super-resolution methods based on
  12855. convolutional neural networks. Supported models:
  12856. @itemize
  12857. @item
  12858. Super-Resolution Convolutional Neural Network model (SRCNN).
  12859. See @url{https://arxiv.org/abs/1501.00092}.
  12860. @item
  12861. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12862. See @url{https://arxiv.org/abs/1609.05158}.
  12863. @end itemize
  12864. Training scripts as well as scripts for model file (.pb) saving can be found at
  12865. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  12866. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12867. Native model files (.model) can be generated from TensorFlow model
  12868. files (.pb) by using tools/python/convert.py
  12869. The filter accepts the following options:
  12870. @table @option
  12871. @item dnn_backend
  12872. Specify which DNN backend to use for model loading and execution. This option accepts
  12873. the following values:
  12874. @table @samp
  12875. @item native
  12876. Native implementation of DNN loading and execution.
  12877. @item tensorflow
  12878. TensorFlow backend. To enable this backend you
  12879. need to install the TensorFlow for C library (see
  12880. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12881. @code{--enable-libtensorflow}
  12882. @end table
  12883. Default value is @samp{native}.
  12884. @item model
  12885. Set path to model file specifying network architecture and its parameters.
  12886. Note that different backends use different file formats. TensorFlow backend
  12887. can load files for both formats, while native backend can load files for only
  12888. its format.
  12889. @item scale_factor
  12890. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12891. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12892. input upscaled using bicubic upscaling with proper scale factor.
  12893. @end table
  12894. @section ssim
  12895. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12896. This filter takes in input two input videos, the first input is
  12897. considered the "main" source and is passed unchanged to the
  12898. output. The second input is used as a "reference" video for computing
  12899. the SSIM.
  12900. Both video inputs must have the same resolution and pixel format for
  12901. this filter to work correctly. Also it assumes that both inputs
  12902. have the same number of frames, which are compared one by one.
  12903. The filter stores the calculated SSIM of each frame.
  12904. The description of the accepted parameters follows.
  12905. @table @option
  12906. @item stats_file, f
  12907. If specified the filter will use the named file to save the SSIM of
  12908. each individual frame. When filename equals "-" the data is sent to
  12909. standard output.
  12910. @end table
  12911. The file printed if @var{stats_file} is selected, contains a sequence of
  12912. key/value pairs of the form @var{key}:@var{value} for each compared
  12913. couple of frames.
  12914. A description of each shown parameter follows:
  12915. @table @option
  12916. @item n
  12917. sequential number of the input frame, starting from 1
  12918. @item Y, U, V, R, G, B
  12919. SSIM of the compared frames for the component specified by the suffix.
  12920. @item All
  12921. SSIM of the compared frames for the whole frame.
  12922. @item dB
  12923. Same as above but in dB representation.
  12924. @end table
  12925. This filter also supports the @ref{framesync} options.
  12926. @subsection Examples
  12927. @itemize
  12928. @item
  12929. For example:
  12930. @example
  12931. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12932. [main][ref] ssim="stats_file=stats.log" [out]
  12933. @end example
  12934. On this example the input file being processed is compared with the
  12935. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12936. is stored in @file{stats.log}.
  12937. @item
  12938. Another example with both psnr and ssim at same time:
  12939. @example
  12940. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12941. @end example
  12942. @item
  12943. Another example with different containers:
  12944. @example
  12945. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=1/AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=1/AVTB,setpts=PTS-STARTPTS[ref];[main][ref]ssim" -f null -
  12946. @end example
  12947. @end itemize
  12948. @section stereo3d
  12949. Convert between different stereoscopic image formats.
  12950. The filters accept the following options:
  12951. @table @option
  12952. @item in
  12953. Set stereoscopic image format of input.
  12954. Available values for input image formats are:
  12955. @table @samp
  12956. @item sbsl
  12957. side by side parallel (left eye left, right eye right)
  12958. @item sbsr
  12959. side by side crosseye (right eye left, left eye right)
  12960. @item sbs2l
  12961. side by side parallel with half width resolution
  12962. (left eye left, right eye right)
  12963. @item sbs2r
  12964. side by side crosseye with half width resolution
  12965. (right eye left, left eye right)
  12966. @item abl
  12967. @item tbl
  12968. above-below (left eye above, right eye below)
  12969. @item abr
  12970. @item tbr
  12971. above-below (right eye above, left eye below)
  12972. @item ab2l
  12973. @item tb2l
  12974. above-below with half height resolution
  12975. (left eye above, right eye below)
  12976. @item ab2r
  12977. @item tb2r
  12978. above-below with half height resolution
  12979. (right eye above, left eye below)
  12980. @item al
  12981. alternating frames (left eye first, right eye second)
  12982. @item ar
  12983. alternating frames (right eye first, left eye second)
  12984. @item irl
  12985. interleaved rows (left eye has top row, right eye starts on next row)
  12986. @item irr
  12987. interleaved rows (right eye has top row, left eye starts on next row)
  12988. @item icl
  12989. interleaved columns, left eye first
  12990. @item icr
  12991. interleaved columns, right eye first
  12992. Default value is @samp{sbsl}.
  12993. @end table
  12994. @item out
  12995. Set stereoscopic image format of output.
  12996. @table @samp
  12997. @item sbsl
  12998. side by side parallel (left eye left, right eye right)
  12999. @item sbsr
  13000. side by side crosseye (right eye left, left eye right)
  13001. @item sbs2l
  13002. side by side parallel with half width resolution
  13003. (left eye left, right eye right)
  13004. @item sbs2r
  13005. side by side crosseye with half width resolution
  13006. (right eye left, left eye right)
  13007. @item abl
  13008. @item tbl
  13009. above-below (left eye above, right eye below)
  13010. @item abr
  13011. @item tbr
  13012. above-below (right eye above, left eye below)
  13013. @item ab2l
  13014. @item tb2l
  13015. above-below with half height resolution
  13016. (left eye above, right eye below)
  13017. @item ab2r
  13018. @item tb2r
  13019. above-below with half height resolution
  13020. (right eye above, left eye below)
  13021. @item al
  13022. alternating frames (left eye first, right eye second)
  13023. @item ar
  13024. alternating frames (right eye first, left eye second)
  13025. @item irl
  13026. interleaved rows (left eye has top row, right eye starts on next row)
  13027. @item irr
  13028. interleaved rows (right eye has top row, left eye starts on next row)
  13029. @item arbg
  13030. anaglyph red/blue gray
  13031. (red filter on left eye, blue filter on right eye)
  13032. @item argg
  13033. anaglyph red/green gray
  13034. (red filter on left eye, green filter on right eye)
  13035. @item arcg
  13036. anaglyph red/cyan gray
  13037. (red filter on left eye, cyan filter on right eye)
  13038. @item arch
  13039. anaglyph red/cyan half colored
  13040. (red filter on left eye, cyan filter on right eye)
  13041. @item arcc
  13042. anaglyph red/cyan color
  13043. (red filter on left eye, cyan filter on right eye)
  13044. @item arcd
  13045. anaglyph red/cyan color optimized with the least squares projection of dubois
  13046. (red filter on left eye, cyan filter on right eye)
  13047. @item agmg
  13048. anaglyph green/magenta gray
  13049. (green filter on left eye, magenta filter on right eye)
  13050. @item agmh
  13051. anaglyph green/magenta half colored
  13052. (green filter on left eye, magenta filter on right eye)
  13053. @item agmc
  13054. anaglyph green/magenta colored
  13055. (green filter on left eye, magenta filter on right eye)
  13056. @item agmd
  13057. anaglyph green/magenta color optimized with the least squares projection of dubois
  13058. (green filter on left eye, magenta filter on right eye)
  13059. @item aybg
  13060. anaglyph yellow/blue gray
  13061. (yellow filter on left eye, blue filter on right eye)
  13062. @item aybh
  13063. anaglyph yellow/blue half colored
  13064. (yellow filter on left eye, blue filter on right eye)
  13065. @item aybc
  13066. anaglyph yellow/blue colored
  13067. (yellow filter on left eye, blue filter on right eye)
  13068. @item aybd
  13069. anaglyph yellow/blue color optimized with the least squares projection of dubois
  13070. (yellow filter on left eye, blue filter on right eye)
  13071. @item ml
  13072. mono output (left eye only)
  13073. @item mr
  13074. mono output (right eye only)
  13075. @item chl
  13076. checkerboard, left eye first
  13077. @item chr
  13078. checkerboard, right eye first
  13079. @item icl
  13080. interleaved columns, left eye first
  13081. @item icr
  13082. interleaved columns, right eye first
  13083. @item hdmi
  13084. HDMI frame pack
  13085. @end table
  13086. Default value is @samp{arcd}.
  13087. @end table
  13088. @subsection Examples
  13089. @itemize
  13090. @item
  13091. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  13092. @example
  13093. stereo3d=sbsl:aybd
  13094. @end example
  13095. @item
  13096. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  13097. @example
  13098. stereo3d=abl:sbsr
  13099. @end example
  13100. @end itemize
  13101. @section streamselect, astreamselect
  13102. Select video or audio streams.
  13103. The filter accepts the following options:
  13104. @table @option
  13105. @item inputs
  13106. Set number of inputs. Default is 2.
  13107. @item map
  13108. Set input indexes to remap to outputs.
  13109. @end table
  13110. @subsection Commands
  13111. The @code{streamselect} and @code{astreamselect} filter supports the following
  13112. commands:
  13113. @table @option
  13114. @item map
  13115. Set input indexes to remap to outputs.
  13116. @end table
  13117. @subsection Examples
  13118. @itemize
  13119. @item
  13120. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13121. @example
  13122. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13123. @end example
  13124. @item
  13125. Same as above, but for audio:
  13126. @example
  13127. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13128. @end example
  13129. @end itemize
  13130. @anchor{subtitles}
  13131. @section subtitles
  13132. Draw subtitles on top of input video using the libass library.
  13133. To enable compilation of this filter you need to configure FFmpeg with
  13134. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13135. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13136. Alpha) subtitles format.
  13137. The filter accepts the following options:
  13138. @table @option
  13139. @item filename, f
  13140. Set the filename of the subtitle file to read. It must be specified.
  13141. @item original_size
  13142. Specify the size of the original video, the video for which the ASS file
  13143. was composed. For the syntax of this option, check the
  13144. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13145. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13146. correctly scale the fonts if the aspect ratio has been changed.
  13147. @item fontsdir
  13148. Set a directory path containing fonts that can be used by the filter.
  13149. These fonts will be used in addition to whatever the font provider uses.
  13150. @item alpha
  13151. Process alpha channel, by default alpha channel is untouched.
  13152. @item charenc
  13153. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13154. useful if not UTF-8.
  13155. @item stream_index, si
  13156. Set subtitles stream index. @code{subtitles} filter only.
  13157. @item force_style
  13158. Override default style or script info parameters of the subtitles. It accepts a
  13159. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13160. @end table
  13161. If the first key is not specified, it is assumed that the first value
  13162. specifies the @option{filename}.
  13163. For example, to render the file @file{sub.srt} on top of the input
  13164. video, use the command:
  13165. @example
  13166. subtitles=sub.srt
  13167. @end example
  13168. which is equivalent to:
  13169. @example
  13170. subtitles=filename=sub.srt
  13171. @end example
  13172. To render the default subtitles stream from file @file{video.mkv}, use:
  13173. @example
  13174. subtitles=video.mkv
  13175. @end example
  13176. To render the second subtitles stream from that file, use:
  13177. @example
  13178. subtitles=video.mkv:si=1
  13179. @end example
  13180. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13181. @code{DejaVu Serif}, use:
  13182. @example
  13183. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13184. @end example
  13185. @section super2xsai
  13186. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13187. Interpolate) pixel art scaling algorithm.
  13188. Useful for enlarging pixel art images without reducing sharpness.
  13189. @section swaprect
  13190. Swap two rectangular objects in video.
  13191. This filter accepts the following options:
  13192. @table @option
  13193. @item w
  13194. Set object width.
  13195. @item h
  13196. Set object height.
  13197. @item x1
  13198. Set 1st rect x coordinate.
  13199. @item y1
  13200. Set 1st rect y coordinate.
  13201. @item x2
  13202. Set 2nd rect x coordinate.
  13203. @item y2
  13204. Set 2nd rect y coordinate.
  13205. All expressions are evaluated once for each frame.
  13206. @end table
  13207. The all options are expressions containing the following constants:
  13208. @table @option
  13209. @item w
  13210. @item h
  13211. The input width and height.
  13212. @item a
  13213. same as @var{w} / @var{h}
  13214. @item sar
  13215. input sample aspect ratio
  13216. @item dar
  13217. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13218. @item n
  13219. The number of the input frame, starting from 0.
  13220. @item t
  13221. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13222. @item pos
  13223. the position in the file of the input frame, NAN if unknown
  13224. @end table
  13225. @section swapuv
  13226. Swap U & V plane.
  13227. @section telecine
  13228. Apply telecine process to the video.
  13229. This filter accepts the following options:
  13230. @table @option
  13231. @item first_field
  13232. @table @samp
  13233. @item top, t
  13234. top field first
  13235. @item bottom, b
  13236. bottom field first
  13237. The default value is @code{top}.
  13238. @end table
  13239. @item pattern
  13240. A string of numbers representing the pulldown pattern you wish to apply.
  13241. The default value is @code{23}.
  13242. @end table
  13243. @example
  13244. Some typical patterns:
  13245. NTSC output (30i):
  13246. 27.5p: 32222
  13247. 24p: 23 (classic)
  13248. 24p: 2332 (preferred)
  13249. 20p: 33
  13250. 18p: 334
  13251. 16p: 3444
  13252. PAL output (25i):
  13253. 27.5p: 12222
  13254. 24p: 222222222223 ("Euro pulldown")
  13255. 16.67p: 33
  13256. 16p: 33333334
  13257. @end example
  13258. @section threshold
  13259. Apply threshold effect to video stream.
  13260. This filter needs four video streams to perform thresholding.
  13261. First stream is stream we are filtering.
  13262. Second stream is holding threshold values, third stream is holding min values,
  13263. and last, fourth stream is holding max values.
  13264. The filter accepts the following option:
  13265. @table @option
  13266. @item planes
  13267. Set which planes will be processed, unprocessed planes will be copied.
  13268. By default value 0xf, all planes will be processed.
  13269. @end table
  13270. For example if first stream pixel's component value is less then threshold value
  13271. of pixel component from 2nd threshold stream, third stream value will picked,
  13272. otherwise fourth stream pixel component value will be picked.
  13273. Using color source filter one can perform various types of thresholding:
  13274. @subsection Examples
  13275. @itemize
  13276. @item
  13277. Binary threshold, using gray color as threshold:
  13278. @example
  13279. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13280. @end example
  13281. @item
  13282. Inverted binary threshold, using gray color as threshold:
  13283. @example
  13284. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13285. @end example
  13286. @item
  13287. Truncate binary threshold, using gray color as threshold:
  13288. @example
  13289. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13290. @end example
  13291. @item
  13292. Threshold to zero, using gray color as threshold:
  13293. @example
  13294. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13295. @end example
  13296. @item
  13297. Inverted threshold to zero, using gray color as threshold:
  13298. @example
  13299. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13300. @end example
  13301. @end itemize
  13302. @section thumbnail
  13303. Select the most representative frame in a given sequence of consecutive frames.
  13304. The filter accepts the following options:
  13305. @table @option
  13306. @item n
  13307. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13308. will pick one of them, and then handle the next batch of @var{n} frames until
  13309. the end. Default is @code{100}.
  13310. @end table
  13311. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13312. value will result in a higher memory usage, so a high value is not recommended.
  13313. @subsection Examples
  13314. @itemize
  13315. @item
  13316. Extract one picture each 50 frames:
  13317. @example
  13318. thumbnail=50
  13319. @end example
  13320. @item
  13321. Complete example of a thumbnail creation with @command{ffmpeg}:
  13322. @example
  13323. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13324. @end example
  13325. @end itemize
  13326. @section tile
  13327. Tile several successive frames together.
  13328. The filter accepts the following options:
  13329. @table @option
  13330. @item layout
  13331. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13332. this option, check the
  13333. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13334. @item nb_frames
  13335. Set the maximum number of frames to render in the given area. It must be less
  13336. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13337. the area will be used.
  13338. @item margin
  13339. Set the outer border margin in pixels.
  13340. @item padding
  13341. Set the inner border thickness (i.e. the number of pixels between frames). For
  13342. more advanced padding options (such as having different values for the edges),
  13343. refer to the pad video filter.
  13344. @item color
  13345. Specify the color of the unused area. For the syntax of this option, check the
  13346. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13347. The default value of @var{color} is "black".
  13348. @item overlap
  13349. Set the number of frames to overlap when tiling several successive frames together.
  13350. The value must be between @code{0} and @var{nb_frames - 1}.
  13351. @item init_padding
  13352. Set the number of frames to initially be empty before displaying first output frame.
  13353. This controls how soon will one get first output frame.
  13354. The value must be between @code{0} and @var{nb_frames - 1}.
  13355. @end table
  13356. @subsection Examples
  13357. @itemize
  13358. @item
  13359. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13360. @example
  13361. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13362. @end example
  13363. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13364. duplicating each output frame to accommodate the originally detected frame
  13365. rate.
  13366. @item
  13367. Display @code{5} pictures in an area of @code{3x2} frames,
  13368. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13369. mixed flat and named options:
  13370. @example
  13371. tile=3x2:nb_frames=5:padding=7:margin=2
  13372. @end example
  13373. @end itemize
  13374. @section tinterlace
  13375. Perform various types of temporal field interlacing.
  13376. Frames are counted starting from 1, so the first input frame is
  13377. considered odd.
  13378. The filter accepts the following options:
  13379. @table @option
  13380. @item mode
  13381. Specify the mode of the interlacing. This option can also be specified
  13382. as a value alone. See below for a list of values for this option.
  13383. Available values are:
  13384. @table @samp
  13385. @item merge, 0
  13386. Move odd frames into the upper field, even into the lower field,
  13387. generating a double height frame at half frame rate.
  13388. @example
  13389. ------> time
  13390. Input:
  13391. Frame 1 Frame 2 Frame 3 Frame 4
  13392. 11111 22222 33333 44444
  13393. 11111 22222 33333 44444
  13394. 11111 22222 33333 44444
  13395. 11111 22222 33333 44444
  13396. Output:
  13397. 11111 33333
  13398. 22222 44444
  13399. 11111 33333
  13400. 22222 44444
  13401. 11111 33333
  13402. 22222 44444
  13403. 11111 33333
  13404. 22222 44444
  13405. @end example
  13406. @item drop_even, 1
  13407. Only output odd frames, even frames are dropped, generating a frame with
  13408. unchanged height at half frame rate.
  13409. @example
  13410. ------> time
  13411. Input:
  13412. Frame 1 Frame 2 Frame 3 Frame 4
  13413. 11111 22222 33333 44444
  13414. 11111 22222 33333 44444
  13415. 11111 22222 33333 44444
  13416. 11111 22222 33333 44444
  13417. Output:
  13418. 11111 33333
  13419. 11111 33333
  13420. 11111 33333
  13421. 11111 33333
  13422. @end example
  13423. @item drop_odd, 2
  13424. Only output even frames, odd frames are dropped, generating a frame with
  13425. unchanged height at half frame rate.
  13426. @example
  13427. ------> time
  13428. Input:
  13429. Frame 1 Frame 2 Frame 3 Frame 4
  13430. 11111 22222 33333 44444
  13431. 11111 22222 33333 44444
  13432. 11111 22222 33333 44444
  13433. 11111 22222 33333 44444
  13434. Output:
  13435. 22222 44444
  13436. 22222 44444
  13437. 22222 44444
  13438. 22222 44444
  13439. @end example
  13440. @item pad, 3
  13441. Expand each frame to full height, but pad alternate lines with black,
  13442. generating a frame with double height at the same input frame rate.
  13443. @example
  13444. ------> time
  13445. Input:
  13446. Frame 1 Frame 2 Frame 3 Frame 4
  13447. 11111 22222 33333 44444
  13448. 11111 22222 33333 44444
  13449. 11111 22222 33333 44444
  13450. 11111 22222 33333 44444
  13451. Output:
  13452. 11111 ..... 33333 .....
  13453. ..... 22222 ..... 44444
  13454. 11111 ..... 33333 .....
  13455. ..... 22222 ..... 44444
  13456. 11111 ..... 33333 .....
  13457. ..... 22222 ..... 44444
  13458. 11111 ..... 33333 .....
  13459. ..... 22222 ..... 44444
  13460. @end example
  13461. @item interleave_top, 4
  13462. Interleave the upper field from odd frames with the lower field from
  13463. even frames, generating a frame with unchanged height at half frame rate.
  13464. @example
  13465. ------> time
  13466. Input:
  13467. Frame 1 Frame 2 Frame 3 Frame 4
  13468. 11111<- 22222 33333<- 44444
  13469. 11111 22222<- 33333 44444<-
  13470. 11111<- 22222 33333<- 44444
  13471. 11111 22222<- 33333 44444<-
  13472. Output:
  13473. 11111 33333
  13474. 22222 44444
  13475. 11111 33333
  13476. 22222 44444
  13477. @end example
  13478. @item interleave_bottom, 5
  13479. Interleave the lower field from odd frames with the upper field from
  13480. even frames, generating a frame with unchanged height at half frame rate.
  13481. @example
  13482. ------> time
  13483. Input:
  13484. Frame 1 Frame 2 Frame 3 Frame 4
  13485. 11111 22222<- 33333 44444<-
  13486. 11111<- 22222 33333<- 44444
  13487. 11111 22222<- 33333 44444<-
  13488. 11111<- 22222 33333<- 44444
  13489. Output:
  13490. 22222 44444
  13491. 11111 33333
  13492. 22222 44444
  13493. 11111 33333
  13494. @end example
  13495. @item interlacex2, 6
  13496. Double frame rate with unchanged height. Frames are inserted each
  13497. containing the second temporal field from the previous input frame and
  13498. the first temporal field from the next input frame. This mode relies on
  13499. the top_field_first flag. Useful for interlaced video displays with no
  13500. field synchronisation.
  13501. @example
  13502. ------> time
  13503. Input:
  13504. Frame 1 Frame 2 Frame 3 Frame 4
  13505. 11111 22222 33333 44444
  13506. 11111 22222 33333 44444
  13507. 11111 22222 33333 44444
  13508. 11111 22222 33333 44444
  13509. Output:
  13510. 11111 22222 22222 33333 33333 44444 44444
  13511. 11111 11111 22222 22222 33333 33333 44444
  13512. 11111 22222 22222 33333 33333 44444 44444
  13513. 11111 11111 22222 22222 33333 33333 44444
  13514. @end example
  13515. @item mergex2, 7
  13516. Move odd frames into the upper field, even into the lower field,
  13517. generating a double height frame at same frame rate.
  13518. @example
  13519. ------> time
  13520. Input:
  13521. Frame 1 Frame 2 Frame 3 Frame 4
  13522. 11111 22222 33333 44444
  13523. 11111 22222 33333 44444
  13524. 11111 22222 33333 44444
  13525. 11111 22222 33333 44444
  13526. Output:
  13527. 11111 33333 33333 55555
  13528. 22222 22222 44444 44444
  13529. 11111 33333 33333 55555
  13530. 22222 22222 44444 44444
  13531. 11111 33333 33333 55555
  13532. 22222 22222 44444 44444
  13533. 11111 33333 33333 55555
  13534. 22222 22222 44444 44444
  13535. @end example
  13536. @end table
  13537. Numeric values are deprecated but are accepted for backward
  13538. compatibility reasons.
  13539. Default mode is @code{merge}.
  13540. @item flags
  13541. Specify flags influencing the filter process.
  13542. Available value for @var{flags} is:
  13543. @table @option
  13544. @item low_pass_filter, vlpf
  13545. Enable linear vertical low-pass filtering in the filter.
  13546. Vertical low-pass filtering is required when creating an interlaced
  13547. destination from a progressive source which contains high-frequency
  13548. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13549. patterning.
  13550. @item complex_filter, cvlpf
  13551. Enable complex vertical low-pass filtering.
  13552. This will slightly less reduce interlace 'twitter' and Moire
  13553. patterning but better retain detail and subjective sharpness impression.
  13554. @end table
  13555. Vertical low-pass filtering can only be enabled for @option{mode}
  13556. @var{interleave_top} and @var{interleave_bottom}.
  13557. @end table
  13558. @section tmix
  13559. Mix successive video frames.
  13560. A description of the accepted options follows.
  13561. @table @option
  13562. @item frames
  13563. The number of successive frames to mix. If unspecified, it defaults to 3.
  13564. @item weights
  13565. Specify weight of each input video frame.
  13566. Each weight is separated by space. If number of weights is smaller than
  13567. number of @var{frames} last specified weight will be used for all remaining
  13568. unset weights.
  13569. @item scale
  13570. Specify scale, if it is set it will be multiplied with sum
  13571. of each weight multiplied with pixel values to give final destination
  13572. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13573. @end table
  13574. @subsection Examples
  13575. @itemize
  13576. @item
  13577. Average 7 successive frames:
  13578. @example
  13579. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13580. @end example
  13581. @item
  13582. Apply simple temporal convolution:
  13583. @example
  13584. tmix=frames=3:weights="-1 3 -1"
  13585. @end example
  13586. @item
  13587. Similar as above but only showing temporal differences:
  13588. @example
  13589. tmix=frames=3:weights="-1 2 -1":scale=1
  13590. @end example
  13591. @end itemize
  13592. @anchor{tonemap}
  13593. @section tonemap
  13594. Tone map colors from different dynamic ranges.
  13595. This filter expects data in single precision floating point, as it needs to
  13596. operate on (and can output) out-of-range values. Another filter, such as
  13597. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13598. The tonemapping algorithms implemented only work on linear light, so input
  13599. data should be linearized beforehand (and possibly correctly tagged).
  13600. @example
  13601. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13602. @end example
  13603. @subsection Options
  13604. The filter accepts the following options.
  13605. @table @option
  13606. @item tonemap
  13607. Set the tone map algorithm to use.
  13608. Possible values are:
  13609. @table @var
  13610. @item none
  13611. Do not apply any tone map, only desaturate overbright pixels.
  13612. @item clip
  13613. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13614. in-range values, while distorting out-of-range values.
  13615. @item linear
  13616. Stretch the entire reference gamut to a linear multiple of the display.
  13617. @item gamma
  13618. Fit a logarithmic transfer between the tone curves.
  13619. @item reinhard
  13620. Preserve overall image brightness with a simple curve, using nonlinear
  13621. contrast, which results in flattening details and degrading color accuracy.
  13622. @item hable
  13623. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13624. of slightly darkening everything. Use it when detail preservation is more
  13625. important than color and brightness accuracy.
  13626. @item mobius
  13627. Smoothly map out-of-range values, while retaining contrast and colors for
  13628. in-range material as much as possible. Use it when color accuracy is more
  13629. important than detail preservation.
  13630. @end table
  13631. Default is none.
  13632. @item param
  13633. Tune the tone mapping algorithm.
  13634. This affects the following algorithms:
  13635. @table @var
  13636. @item none
  13637. Ignored.
  13638. @item linear
  13639. Specifies the scale factor to use while stretching.
  13640. Default to 1.0.
  13641. @item gamma
  13642. Specifies the exponent of the function.
  13643. Default to 1.8.
  13644. @item clip
  13645. Specify an extra linear coefficient to multiply into the signal before clipping.
  13646. Default to 1.0.
  13647. @item reinhard
  13648. Specify the local contrast coefficient at the display peak.
  13649. Default to 0.5, which means that in-gamut values will be about half as bright
  13650. as when clipping.
  13651. @item hable
  13652. Ignored.
  13653. @item mobius
  13654. Specify the transition point from linear to mobius transform. Every value
  13655. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13656. more accurate the result will be, at the cost of losing bright details.
  13657. Default to 0.3, which due to the steep initial slope still preserves in-range
  13658. colors fairly accurately.
  13659. @end table
  13660. @item desat
  13661. Apply desaturation for highlights that exceed this level of brightness. The
  13662. higher the parameter, the more color information will be preserved. This
  13663. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13664. (smoothly) turning into white instead. This makes images feel more natural,
  13665. at the cost of reducing information about out-of-range colors.
  13666. The default of 2.0 is somewhat conservative and will mostly just apply to
  13667. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13668. This option works only if the input frame has a supported color tag.
  13669. @item peak
  13670. Override signal/nominal/reference peak with this value. Useful when the
  13671. embedded peak information in display metadata is not reliable or when tone
  13672. mapping from a lower range to a higher range.
  13673. @end table
  13674. @section tpad
  13675. Temporarily pad video frames.
  13676. The filter accepts the following options:
  13677. @table @option
  13678. @item start
  13679. Specify number of delay frames before input video stream.
  13680. @item stop
  13681. Specify number of padding frames after input video stream.
  13682. Set to -1 to pad indefinitely.
  13683. @item start_mode
  13684. Set kind of frames added to beginning of stream.
  13685. Can be either @var{add} or @var{clone}.
  13686. With @var{add} frames of solid-color are added.
  13687. With @var{clone} frames are clones of first frame.
  13688. @item stop_mode
  13689. Set kind of frames added to end of stream.
  13690. Can be either @var{add} or @var{clone}.
  13691. With @var{add} frames of solid-color are added.
  13692. With @var{clone} frames are clones of last frame.
  13693. @item start_duration, stop_duration
  13694. Specify the duration of the start/stop delay. See
  13695. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13696. for the accepted syntax.
  13697. These options override @var{start} and @var{stop}.
  13698. @item color
  13699. Specify the color of the padded area. For the syntax of this option,
  13700. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13701. manual,ffmpeg-utils}.
  13702. The default value of @var{color} is "black".
  13703. @end table
  13704. @anchor{transpose}
  13705. @section transpose
  13706. Transpose rows with columns in the input video and optionally flip it.
  13707. It accepts the following parameters:
  13708. @table @option
  13709. @item dir
  13710. Specify the transposition direction.
  13711. Can assume the following values:
  13712. @table @samp
  13713. @item 0, 4, cclock_flip
  13714. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13715. @example
  13716. L.R L.l
  13717. . . -> . .
  13718. l.r R.r
  13719. @end example
  13720. @item 1, 5, clock
  13721. Rotate by 90 degrees clockwise, that is:
  13722. @example
  13723. L.R l.L
  13724. . . -> . .
  13725. l.r r.R
  13726. @end example
  13727. @item 2, 6, cclock
  13728. Rotate by 90 degrees counterclockwise, that is:
  13729. @example
  13730. L.R R.r
  13731. . . -> . .
  13732. l.r L.l
  13733. @end example
  13734. @item 3, 7, clock_flip
  13735. Rotate by 90 degrees clockwise and vertically flip, that is:
  13736. @example
  13737. L.R r.R
  13738. . . -> . .
  13739. l.r l.L
  13740. @end example
  13741. @end table
  13742. For values between 4-7, the transposition is only done if the input
  13743. video geometry is portrait and not landscape. These values are
  13744. deprecated, the @code{passthrough} option should be used instead.
  13745. Numerical values are deprecated, and should be dropped in favor of
  13746. symbolic constants.
  13747. @item passthrough
  13748. Do not apply the transposition if the input geometry matches the one
  13749. specified by the specified value. It accepts the following values:
  13750. @table @samp
  13751. @item none
  13752. Always apply transposition.
  13753. @item portrait
  13754. Preserve portrait geometry (when @var{height} >= @var{width}).
  13755. @item landscape
  13756. Preserve landscape geometry (when @var{width} >= @var{height}).
  13757. @end table
  13758. Default value is @code{none}.
  13759. @end table
  13760. For example to rotate by 90 degrees clockwise and preserve portrait
  13761. layout:
  13762. @example
  13763. transpose=dir=1:passthrough=portrait
  13764. @end example
  13765. The command above can also be specified as:
  13766. @example
  13767. transpose=1:portrait
  13768. @end example
  13769. @section transpose_npp
  13770. Transpose rows with columns in the input video and optionally flip it.
  13771. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13772. It accepts the following parameters:
  13773. @table @option
  13774. @item dir
  13775. Specify the transposition direction.
  13776. Can assume the following values:
  13777. @table @samp
  13778. @item cclock_flip
  13779. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13780. @item clock
  13781. Rotate by 90 degrees clockwise.
  13782. @item cclock
  13783. Rotate by 90 degrees counterclockwise.
  13784. @item clock_flip
  13785. Rotate by 90 degrees clockwise and vertically flip.
  13786. @end table
  13787. @item passthrough
  13788. Do not apply the transposition if the input geometry matches the one
  13789. specified by the specified value. It accepts the following values:
  13790. @table @samp
  13791. @item none
  13792. Always apply transposition. (default)
  13793. @item portrait
  13794. Preserve portrait geometry (when @var{height} >= @var{width}).
  13795. @item landscape
  13796. Preserve landscape geometry (when @var{width} >= @var{height}).
  13797. @end table
  13798. @end table
  13799. @section trim
  13800. Trim the input so that the output contains one continuous subpart of the input.
  13801. It accepts the following parameters:
  13802. @table @option
  13803. @item start
  13804. Specify the time of the start of the kept section, i.e. the frame with the
  13805. timestamp @var{start} will be the first frame in the output.
  13806. @item end
  13807. Specify the time of the first frame that will be dropped, i.e. the frame
  13808. immediately preceding the one with the timestamp @var{end} will be the last
  13809. frame in the output.
  13810. @item start_pts
  13811. This is the same as @var{start}, except this option sets the start timestamp
  13812. in timebase units instead of seconds.
  13813. @item end_pts
  13814. This is the same as @var{end}, except this option sets the end timestamp
  13815. in timebase units instead of seconds.
  13816. @item duration
  13817. The maximum duration of the output in seconds.
  13818. @item start_frame
  13819. The number of the first frame that should be passed to the output.
  13820. @item end_frame
  13821. The number of the first frame that should be dropped.
  13822. @end table
  13823. @option{start}, @option{end}, and @option{duration} are expressed as time
  13824. duration specifications; see
  13825. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13826. for the accepted syntax.
  13827. Note that the first two sets of the start/end options and the @option{duration}
  13828. option look at the frame timestamp, while the _frame variants simply count the
  13829. frames that pass through the filter. Also note that this filter does not modify
  13830. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13831. setpts filter after the trim filter.
  13832. If multiple start or end options are set, this filter tries to be greedy and
  13833. keep all the frames that match at least one of the specified constraints. To keep
  13834. only the part that matches all the constraints at once, chain multiple trim
  13835. filters.
  13836. The defaults are such that all the input is kept. So it is possible to set e.g.
  13837. just the end values to keep everything before the specified time.
  13838. Examples:
  13839. @itemize
  13840. @item
  13841. Drop everything except the second minute of input:
  13842. @example
  13843. ffmpeg -i INPUT -vf trim=60:120
  13844. @end example
  13845. @item
  13846. Keep only the first second:
  13847. @example
  13848. ffmpeg -i INPUT -vf trim=duration=1
  13849. @end example
  13850. @end itemize
  13851. @section unpremultiply
  13852. Apply alpha unpremultiply effect to input video stream using first plane
  13853. of second stream as alpha.
  13854. Both streams must have same dimensions and same pixel format.
  13855. The filter accepts the following option:
  13856. @table @option
  13857. @item planes
  13858. Set which planes will be processed, unprocessed planes will be copied.
  13859. By default value 0xf, all planes will be processed.
  13860. If the format has 1 or 2 components, then luma is bit 0.
  13861. If the format has 3 or 4 components:
  13862. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13863. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13864. If present, the alpha channel is always the last bit.
  13865. @item inplace
  13866. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13867. @end table
  13868. @anchor{unsharp}
  13869. @section unsharp
  13870. Sharpen or blur the input video.
  13871. It accepts the following parameters:
  13872. @table @option
  13873. @item luma_msize_x, lx
  13874. Set the luma matrix horizontal size. It must be an odd integer between
  13875. 3 and 23. The default value is 5.
  13876. @item luma_msize_y, ly
  13877. Set the luma matrix vertical size. It must be an odd integer between 3
  13878. and 23. The default value is 5.
  13879. @item luma_amount, la
  13880. Set the luma effect strength. It must be a floating point number, reasonable
  13881. values lay between -1.5 and 1.5.
  13882. Negative values will blur the input video, while positive values will
  13883. sharpen it, a value of zero will disable the effect.
  13884. Default value is 1.0.
  13885. @item chroma_msize_x, cx
  13886. Set the chroma matrix horizontal size. It must be an odd integer
  13887. between 3 and 23. The default value is 5.
  13888. @item chroma_msize_y, cy
  13889. Set the chroma matrix vertical size. It must be an odd integer
  13890. between 3 and 23. The default value is 5.
  13891. @item chroma_amount, ca
  13892. Set the chroma effect strength. It must be a floating point number, reasonable
  13893. values lay between -1.5 and 1.5.
  13894. Negative values will blur the input video, while positive values will
  13895. sharpen it, a value of zero will disable the effect.
  13896. Default value is 0.0.
  13897. @end table
  13898. All parameters are optional and default to the equivalent of the
  13899. string '5:5:1.0:5:5:0.0'.
  13900. @subsection Examples
  13901. @itemize
  13902. @item
  13903. Apply strong luma sharpen effect:
  13904. @example
  13905. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13906. @end example
  13907. @item
  13908. Apply a strong blur of both luma and chroma parameters:
  13909. @example
  13910. unsharp=7:7:-2:7:7:-2
  13911. @end example
  13912. @end itemize
  13913. @section uspp
  13914. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13915. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13916. shifts and average the results.
  13917. The way this differs from the behavior of spp is that uspp actually encodes &
  13918. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13919. DCT similar to MJPEG.
  13920. The filter accepts the following options:
  13921. @table @option
  13922. @item quality
  13923. Set quality. This option defines the number of levels for averaging. It accepts
  13924. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13925. effect. A value of @code{8} means the higher quality. For each increment of
  13926. that value the speed drops by a factor of approximately 2. Default value is
  13927. @code{3}.
  13928. @item qp
  13929. Force a constant quantization parameter. If not set, the filter will use the QP
  13930. from the video stream (if available).
  13931. @end table
  13932. @section v360
  13933. Convert 360 videos between various formats.
  13934. The filter accepts the following options:
  13935. @table @option
  13936. @item input
  13937. @item output
  13938. Set format of the input/output video.
  13939. Available formats:
  13940. @table @samp
  13941. @item e
  13942. @item equirect
  13943. Equirectangular projection.
  13944. @item c3x2
  13945. @item c6x1
  13946. @item c1x6
  13947. Cubemap with 3x2/6x1/1x6 layout.
  13948. Format specific options:
  13949. @table @option
  13950. @item in_pad
  13951. @item out_pad
  13952. Set padding proportion for the input/output cubemap. Values in decimals.
  13953. Example values:
  13954. @table @samp
  13955. @item 0
  13956. No padding.
  13957. @item 0.01
  13958. 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)
  13959. @end table
  13960. Default value is @b{@samp{0}}.
  13961. @item fin_pad
  13962. @item fout_pad
  13963. Set fixed padding for the input/output cubemap. Values in pixels.
  13964. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  13965. @item in_forder
  13966. @item out_forder
  13967. Set order of faces for the input/output cubemap. Choose one direction for each position.
  13968. Designation of directions:
  13969. @table @samp
  13970. @item r
  13971. right
  13972. @item l
  13973. left
  13974. @item u
  13975. up
  13976. @item d
  13977. down
  13978. @item f
  13979. forward
  13980. @item b
  13981. back
  13982. @end table
  13983. Default value is @b{@samp{rludfb}}.
  13984. @item in_frot
  13985. @item out_frot
  13986. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  13987. Designation of angles:
  13988. @table @samp
  13989. @item 0
  13990. 0 degrees clockwise
  13991. @item 1
  13992. 90 degrees clockwise
  13993. @item 2
  13994. 180 degrees clockwise
  13995. @item 3
  13996. 270 degrees clockwise
  13997. @end table
  13998. Default value is @b{@samp{000000}}.
  13999. @end table
  14000. @item eac
  14001. Equi-Angular Cubemap.
  14002. @item flat
  14003. @item gnomonic
  14004. @item rectilinear
  14005. Regular video. @i{(output only)}
  14006. Format specific options:
  14007. @table @option
  14008. @item h_fov
  14009. @item v_fov
  14010. @item d_fov
  14011. Set horizontal/vertical/diagonal field of view. Values in degrees.
  14012. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14013. @end table
  14014. @item dfisheye
  14015. Dual fisheye.
  14016. Format specific options:
  14017. @table @option
  14018. @item in_pad
  14019. @item out_pad
  14020. Set padding proportion. Values in decimals.
  14021. Example values:
  14022. @table @samp
  14023. @item 0
  14024. No padding.
  14025. @item 0.01
  14026. 1% padding.
  14027. @end table
  14028. Default value is @b{@samp{0}}.
  14029. @end table
  14030. @item barrel
  14031. @item fb
  14032. Facebook's 360 format.
  14033. @item sg
  14034. Stereographic format.
  14035. Format specific options:
  14036. @table @option
  14037. @item h_fov
  14038. @item v_fov
  14039. @item d_fov
  14040. Set horizontal/vertical/diagonal field of view. Values in degrees.
  14041. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14042. @end table
  14043. @item mercator
  14044. Mercator format.
  14045. @item ball
  14046. Ball format, gives significant distortion toward the back.
  14047. @item hammer
  14048. Hammer-Aitoff map projection format.
  14049. @item sinusoidal
  14050. Sinusoidal map projection format.
  14051. @end table
  14052. @item interp
  14053. Set interpolation method.@*
  14054. @i{Note: more complex interpolation methods require much more memory to run.}
  14055. Available methods:
  14056. @table @samp
  14057. @item near
  14058. @item nearest
  14059. Nearest neighbour.
  14060. @item line
  14061. @item linear
  14062. Bilinear interpolation.
  14063. @item cube
  14064. @item cubic
  14065. Bicubic interpolation.
  14066. @item lanc
  14067. @item lanczos
  14068. Lanczos interpolation.
  14069. @end table
  14070. Default value is @b{@samp{line}}.
  14071. @item w
  14072. @item h
  14073. Set the output video resolution.
  14074. Default resolution depends on formats.
  14075. @item in_stereo
  14076. @item out_stereo
  14077. Set the input/output stereo format.
  14078. @table @samp
  14079. @item 2d
  14080. 2D mono
  14081. @item sbs
  14082. Side by side
  14083. @item tb
  14084. Top bottom
  14085. @end table
  14086. Default value is @b{@samp{2d}} for input and output format.
  14087. @item yaw
  14088. @item pitch
  14089. @item roll
  14090. Set rotation for the output video. Values in degrees.
  14091. @item rorder
  14092. Set rotation order for the output video. Choose one item for each position.
  14093. @table @samp
  14094. @item y, Y
  14095. yaw
  14096. @item p, P
  14097. pitch
  14098. @item r, R
  14099. roll
  14100. @end table
  14101. Default value is @b{@samp{ypr}}.
  14102. @item h_flip
  14103. @item v_flip
  14104. @item d_flip
  14105. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  14106. @item ih_flip
  14107. @item iv_flip
  14108. Set if input video is flipped horizontally/vertically. Boolean values.
  14109. @item in_trans
  14110. Set if input video is transposed. Boolean value, by default disabled.
  14111. @item out_trans
  14112. Set if output video needs to be transposed. Boolean value, by default disabled.
  14113. @end table
  14114. @subsection Examples
  14115. @itemize
  14116. @item
  14117. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  14118. @example
  14119. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  14120. @end example
  14121. @item
  14122. Extract back view of Equi-Angular Cubemap:
  14123. @example
  14124. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  14125. @end example
  14126. @item
  14127. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  14128. @example
  14129. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  14130. @end example
  14131. @end itemize
  14132. @section vaguedenoiser
  14133. Apply a wavelet based denoiser.
  14134. It transforms each frame from the video input into the wavelet domain,
  14135. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  14136. the obtained coefficients. It does an inverse wavelet transform after.
  14137. Due to wavelet properties, it should give a nice smoothed result, and
  14138. reduced noise, without blurring picture features.
  14139. This filter accepts the following options:
  14140. @table @option
  14141. @item threshold
  14142. The filtering strength. The higher, the more filtered the video will be.
  14143. Hard thresholding can use a higher threshold than soft thresholding
  14144. before the video looks overfiltered. Default value is 2.
  14145. @item method
  14146. The filtering method the filter will use.
  14147. It accepts the following values:
  14148. @table @samp
  14149. @item hard
  14150. All values under the threshold will be zeroed.
  14151. @item soft
  14152. All values under the threshold will be zeroed. All values above will be
  14153. reduced by the threshold.
  14154. @item garrote
  14155. Scales or nullifies coefficients - intermediary between (more) soft and
  14156. (less) hard thresholding.
  14157. @end table
  14158. Default is garrote.
  14159. @item nsteps
  14160. Number of times, the wavelet will decompose the picture. Picture can't
  14161. be decomposed beyond a particular point (typically, 8 for a 640x480
  14162. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  14163. @item percent
  14164. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  14165. @item planes
  14166. A list of the planes to process. By default all planes are processed.
  14167. @end table
  14168. @section vectorscope
  14169. Display 2 color component values in the two dimensional graph (which is called
  14170. a vectorscope).
  14171. This filter accepts the following options:
  14172. @table @option
  14173. @item mode, m
  14174. Set vectorscope mode.
  14175. It accepts the following values:
  14176. @table @samp
  14177. @item gray
  14178. Gray values are displayed on graph, higher brightness means more pixels have
  14179. same component color value on location in graph. This is the default mode.
  14180. @item color
  14181. Gray values are displayed on graph. Surrounding pixels values which are not
  14182. present in video frame are drawn in gradient of 2 color components which are
  14183. set by option @code{x} and @code{y}. The 3rd color component is static.
  14184. @item color2
  14185. Actual color components values present in video frame are displayed on graph.
  14186. @item color3
  14187. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  14188. on graph increases value of another color component, which is luminance by
  14189. default values of @code{x} and @code{y}.
  14190. @item color4
  14191. Actual colors present in video frame are displayed on graph. If two different
  14192. colors map to same position on graph then color with higher value of component
  14193. not present in graph is picked.
  14194. @item color5
  14195. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  14196. component picked from radial gradient.
  14197. @end table
  14198. @item x
  14199. Set which color component will be represented on X-axis. Default is @code{1}.
  14200. @item y
  14201. Set which color component will be represented on Y-axis. Default is @code{2}.
  14202. @item intensity, i
  14203. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  14204. of color component which represents frequency of (X, Y) location in graph.
  14205. @item envelope, e
  14206. @table @samp
  14207. @item none
  14208. No envelope, this is default.
  14209. @item instant
  14210. Instant envelope, even darkest single pixel will be clearly highlighted.
  14211. @item peak
  14212. Hold maximum and minimum values presented in graph over time. This way you
  14213. can still spot out of range values without constantly looking at vectorscope.
  14214. @item peak+instant
  14215. Peak and instant envelope combined together.
  14216. @end table
  14217. @item graticule, g
  14218. Set what kind of graticule to draw.
  14219. @table @samp
  14220. @item none
  14221. @item green
  14222. @item color
  14223. @end table
  14224. @item opacity, o
  14225. Set graticule opacity.
  14226. @item flags, f
  14227. Set graticule flags.
  14228. @table @samp
  14229. @item white
  14230. Draw graticule for white point.
  14231. @item black
  14232. Draw graticule for black point.
  14233. @item name
  14234. Draw color points short names.
  14235. @end table
  14236. @item bgopacity, b
  14237. Set background opacity.
  14238. @item lthreshold, l
  14239. Set low threshold for color component not represented on X or Y axis.
  14240. Values lower than this value will be ignored. Default is 0.
  14241. Note this value is multiplied with actual max possible value one pixel component
  14242. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  14243. is 0.1 * 255 = 25.
  14244. @item hthreshold, h
  14245. Set high threshold for color component not represented on X or Y axis.
  14246. Values higher than this value will be ignored. Default is 1.
  14247. Note this value is multiplied with actual max possible value one pixel component
  14248. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  14249. is 0.9 * 255 = 230.
  14250. @item colorspace, c
  14251. Set what kind of colorspace to use when drawing graticule.
  14252. @table @samp
  14253. @item auto
  14254. @item 601
  14255. @item 709
  14256. @end table
  14257. Default is auto.
  14258. @end table
  14259. @anchor{vidstabdetect}
  14260. @section vidstabdetect
  14261. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  14262. @ref{vidstabtransform} for pass 2.
  14263. This filter generates a file with relative translation and rotation
  14264. transform information about subsequent frames, which is then used by
  14265. the @ref{vidstabtransform} filter.
  14266. To enable compilation of this filter you need to configure FFmpeg with
  14267. @code{--enable-libvidstab}.
  14268. This filter accepts the following options:
  14269. @table @option
  14270. @item result
  14271. Set the path to the file used to write the transforms information.
  14272. Default value is @file{transforms.trf}.
  14273. @item shakiness
  14274. Set how shaky the video is and how quick the camera is. It accepts an
  14275. integer in the range 1-10, a value of 1 means little shakiness, a
  14276. value of 10 means strong shakiness. Default value is 5.
  14277. @item accuracy
  14278. Set the accuracy of the detection process. It must be a value in the
  14279. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  14280. accuracy. Default value is 15.
  14281. @item stepsize
  14282. Set stepsize of the search process. The region around minimum is
  14283. scanned with 1 pixel resolution. Default value is 6.
  14284. @item mincontrast
  14285. Set minimum contrast. Below this value a local measurement field is
  14286. discarded. Must be a floating point value in the range 0-1. Default
  14287. value is 0.3.
  14288. @item tripod
  14289. Set reference frame number for tripod mode.
  14290. If enabled, the motion of the frames is compared to a reference frame
  14291. in the filtered stream, identified by the specified number. The idea
  14292. is to compensate all movements in a more-or-less static scene and keep
  14293. the camera view absolutely still.
  14294. If set to 0, it is disabled. The frames are counted starting from 1.
  14295. @item show
  14296. Show fields and transforms in the resulting frames. It accepts an
  14297. integer in the range 0-2. Default value is 0, which disables any
  14298. visualization.
  14299. @end table
  14300. @subsection Examples
  14301. @itemize
  14302. @item
  14303. Use default values:
  14304. @example
  14305. vidstabdetect
  14306. @end example
  14307. @item
  14308. Analyze strongly shaky movie and put the results in file
  14309. @file{mytransforms.trf}:
  14310. @example
  14311. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  14312. @end example
  14313. @item
  14314. Visualize the result of internal transformations in the resulting
  14315. video:
  14316. @example
  14317. vidstabdetect=show=1
  14318. @end example
  14319. @item
  14320. Analyze a video with medium shakiness using @command{ffmpeg}:
  14321. @example
  14322. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  14323. @end example
  14324. @end itemize
  14325. @anchor{vidstabtransform}
  14326. @section vidstabtransform
  14327. Video stabilization/deshaking: pass 2 of 2,
  14328. see @ref{vidstabdetect} for pass 1.
  14329. Read a file with transform information for each frame and
  14330. apply/compensate them. Together with the @ref{vidstabdetect}
  14331. filter this can be used to deshake videos. See also
  14332. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  14333. the @ref{unsharp} filter, see below.
  14334. To enable compilation of this filter you need to configure FFmpeg with
  14335. @code{--enable-libvidstab}.
  14336. @subsection Options
  14337. @table @option
  14338. @item input
  14339. Set path to the file used to read the transforms. Default value is
  14340. @file{transforms.trf}.
  14341. @item smoothing
  14342. Set the number of frames (value*2 + 1) used for lowpass filtering the
  14343. camera movements. Default value is 10.
  14344. For example a number of 10 means that 21 frames are used (10 in the
  14345. past and 10 in the future) to smoothen the motion in the video. A
  14346. larger value leads to a smoother video, but limits the acceleration of
  14347. the camera (pan/tilt movements). 0 is a special case where a static
  14348. camera is simulated.
  14349. @item optalgo
  14350. Set the camera path optimization algorithm.
  14351. Accepted values are:
  14352. @table @samp
  14353. @item gauss
  14354. gaussian kernel low-pass filter on camera motion (default)
  14355. @item avg
  14356. averaging on transformations
  14357. @end table
  14358. @item maxshift
  14359. Set maximal number of pixels to translate frames. Default value is -1,
  14360. meaning no limit.
  14361. @item maxangle
  14362. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  14363. value is -1, meaning no limit.
  14364. @item crop
  14365. Specify how to deal with borders that may be visible due to movement
  14366. compensation.
  14367. Available values are:
  14368. @table @samp
  14369. @item keep
  14370. keep image information from previous frame (default)
  14371. @item black
  14372. fill the border black
  14373. @end table
  14374. @item invert
  14375. Invert transforms if set to 1. Default value is 0.
  14376. @item relative
  14377. Consider transforms as relative to previous frame if set to 1,
  14378. absolute if set to 0. Default value is 0.
  14379. @item zoom
  14380. Set percentage to zoom. A positive value will result in a zoom-in
  14381. effect, a negative value in a zoom-out effect. Default value is 0 (no
  14382. zoom).
  14383. @item optzoom
  14384. Set optimal zooming to avoid borders.
  14385. Accepted values are:
  14386. @table @samp
  14387. @item 0
  14388. disabled
  14389. @item 1
  14390. optimal static zoom value is determined (only very strong movements
  14391. will lead to visible borders) (default)
  14392. @item 2
  14393. optimal adaptive zoom value is determined (no borders will be
  14394. visible), see @option{zoomspeed}
  14395. @end table
  14396. Note that the value given at zoom is added to the one calculated here.
  14397. @item zoomspeed
  14398. Set percent to zoom maximally each frame (enabled when
  14399. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  14400. 0.25.
  14401. @item interpol
  14402. Specify type of interpolation.
  14403. Available values are:
  14404. @table @samp
  14405. @item no
  14406. no interpolation
  14407. @item linear
  14408. linear only horizontal
  14409. @item bilinear
  14410. linear in both directions (default)
  14411. @item bicubic
  14412. cubic in both directions (slow)
  14413. @end table
  14414. @item tripod
  14415. Enable virtual tripod mode if set to 1, which is equivalent to
  14416. @code{relative=0:smoothing=0}. Default value is 0.
  14417. Use also @code{tripod} option of @ref{vidstabdetect}.
  14418. @item debug
  14419. Increase log verbosity if set to 1. Also the detected global motions
  14420. are written to the temporary file @file{global_motions.trf}. Default
  14421. value is 0.
  14422. @end table
  14423. @subsection Examples
  14424. @itemize
  14425. @item
  14426. Use @command{ffmpeg} for a typical stabilization with default values:
  14427. @example
  14428. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  14429. @end example
  14430. Note the use of the @ref{unsharp} filter which is always recommended.
  14431. @item
  14432. Zoom in a bit more and load transform data from a given file:
  14433. @example
  14434. vidstabtransform=zoom=5:input="mytransforms.trf"
  14435. @end example
  14436. @item
  14437. Smoothen the video even more:
  14438. @example
  14439. vidstabtransform=smoothing=30
  14440. @end example
  14441. @end itemize
  14442. @section vflip
  14443. Flip the input video vertically.
  14444. For example, to vertically flip a video with @command{ffmpeg}:
  14445. @example
  14446. ffmpeg -i in.avi -vf "vflip" out.avi
  14447. @end example
  14448. @section vfrdet
  14449. Detect variable frame rate video.
  14450. This filter tries to detect if the input is variable or constant frame rate.
  14451. At end it will output number of frames detected as having variable delta pts,
  14452. and ones with constant delta pts.
  14453. If there was frames with variable delta, than it will also show min and max delta
  14454. encountered.
  14455. @section vibrance
  14456. Boost or alter saturation.
  14457. The filter accepts the following options:
  14458. @table @option
  14459. @item intensity
  14460. Set strength of boost if positive value or strength of alter if negative value.
  14461. Default is 0. Allowed range is from -2 to 2.
  14462. @item rbal
  14463. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  14464. @item gbal
  14465. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  14466. @item bbal
  14467. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  14468. @item rlum
  14469. Set the red luma coefficient.
  14470. @item glum
  14471. Set the green luma coefficient.
  14472. @item blum
  14473. Set the blue luma coefficient.
  14474. @item alternate
  14475. If @code{intensity} is negative and this is set to 1, colors will change,
  14476. otherwise colors will be less saturated, more towards gray.
  14477. @end table
  14478. @anchor{vignette}
  14479. @section vignette
  14480. Make or reverse a natural vignetting effect.
  14481. The filter accepts the following options:
  14482. @table @option
  14483. @item angle, a
  14484. Set lens angle expression as a number of radians.
  14485. The value is clipped in the @code{[0,PI/2]} range.
  14486. Default value: @code{"PI/5"}
  14487. @item x0
  14488. @item y0
  14489. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  14490. by default.
  14491. @item mode
  14492. Set forward/backward mode.
  14493. Available modes are:
  14494. @table @samp
  14495. @item forward
  14496. The larger the distance from the central point, the darker the image becomes.
  14497. @item backward
  14498. The larger the distance from the central point, the brighter the image becomes.
  14499. This can be used to reverse a vignette effect, though there is no automatic
  14500. detection to extract the lens @option{angle} and other settings (yet). It can
  14501. also be used to create a burning effect.
  14502. @end table
  14503. Default value is @samp{forward}.
  14504. @item eval
  14505. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  14506. It accepts the following values:
  14507. @table @samp
  14508. @item init
  14509. Evaluate expressions only once during the filter initialization.
  14510. @item frame
  14511. Evaluate expressions for each incoming frame. This is way slower than the
  14512. @samp{init} mode since it requires all the scalers to be re-computed, but it
  14513. allows advanced dynamic expressions.
  14514. @end table
  14515. Default value is @samp{init}.
  14516. @item dither
  14517. Set dithering to reduce the circular banding effects. Default is @code{1}
  14518. (enabled).
  14519. @item aspect
  14520. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  14521. Setting this value to the SAR of the input will make a rectangular vignetting
  14522. following the dimensions of the video.
  14523. Default is @code{1/1}.
  14524. @end table
  14525. @subsection Expressions
  14526. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  14527. following parameters.
  14528. @table @option
  14529. @item w
  14530. @item h
  14531. input width and height
  14532. @item n
  14533. the number of input frame, starting from 0
  14534. @item pts
  14535. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  14536. @var{TB} units, NAN if undefined
  14537. @item r
  14538. frame rate of the input video, NAN if the input frame rate is unknown
  14539. @item t
  14540. the PTS (Presentation TimeStamp) of the filtered video frame,
  14541. expressed in seconds, NAN if undefined
  14542. @item tb
  14543. time base of the input video
  14544. @end table
  14545. @subsection Examples
  14546. @itemize
  14547. @item
  14548. Apply simple strong vignetting effect:
  14549. @example
  14550. vignette=PI/4
  14551. @end example
  14552. @item
  14553. Make a flickering vignetting:
  14554. @example
  14555. vignette='PI/4+random(1)*PI/50':eval=frame
  14556. @end example
  14557. @end itemize
  14558. @section vmafmotion
  14559. Obtain the average vmaf motion score of a video.
  14560. It is one of the component filters of VMAF.
  14561. The obtained average motion score is printed through the logging system.
  14562. In the below example the input file @file{ref.mpg} is being processed and score
  14563. is computed.
  14564. @example
  14565. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  14566. @end example
  14567. @section vstack
  14568. Stack input videos vertically.
  14569. All streams must be of same pixel format and of same width.
  14570. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  14571. to create same output.
  14572. The filter accepts the following options:
  14573. @table @option
  14574. @item inputs
  14575. Set number of input streams. Default is 2.
  14576. @item shortest
  14577. If set to 1, force the output to terminate when the shortest input
  14578. terminates. Default value is 0.
  14579. @end table
  14580. @section w3fdif
  14581. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  14582. Deinterlacing Filter").
  14583. Based on the process described by Martin Weston for BBC R&D, and
  14584. implemented based on the de-interlace algorithm written by Jim
  14585. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  14586. uses filter coefficients calculated by BBC R&D.
  14587. This filter uses field-dominance information in frame to decide which
  14588. of each pair of fields to place first in the output.
  14589. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  14590. There are two sets of filter coefficients, so called "simple"
  14591. and "complex". Which set of filter coefficients is used can
  14592. be set by passing an optional parameter:
  14593. @table @option
  14594. @item filter
  14595. Set the interlacing filter coefficients. Accepts one of the following values:
  14596. @table @samp
  14597. @item simple
  14598. Simple filter coefficient set.
  14599. @item complex
  14600. More-complex filter coefficient set.
  14601. @end table
  14602. Default value is @samp{complex}.
  14603. @item deint
  14604. Specify which frames to deinterlace. Accepts one of the following values:
  14605. @table @samp
  14606. @item all
  14607. Deinterlace all frames,
  14608. @item interlaced
  14609. Only deinterlace frames marked as interlaced.
  14610. @end table
  14611. Default value is @samp{all}.
  14612. @end table
  14613. @section waveform
  14614. Video waveform monitor.
  14615. The waveform monitor plots color component intensity. By default luminance
  14616. only. Each column of the waveform corresponds to a column of pixels in the
  14617. source video.
  14618. It accepts the following options:
  14619. @table @option
  14620. @item mode, m
  14621. Can be either @code{row}, or @code{column}. Default is @code{column}.
  14622. In row mode, the graph on the left side represents color component value 0 and
  14623. the right side represents value = 255. In column mode, the top side represents
  14624. color component value = 0 and bottom side represents value = 255.
  14625. @item intensity, i
  14626. Set intensity. Smaller values are useful to find out how many values of the same
  14627. luminance are distributed across input rows/columns.
  14628. Default value is @code{0.04}. Allowed range is [0, 1].
  14629. @item mirror, r
  14630. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  14631. In mirrored mode, higher values will be represented on the left
  14632. side for @code{row} mode and at the top for @code{column} mode. Default is
  14633. @code{1} (mirrored).
  14634. @item display, d
  14635. Set display mode.
  14636. It accepts the following values:
  14637. @table @samp
  14638. @item overlay
  14639. Presents information identical to that in the @code{parade}, except
  14640. that the graphs representing color components are superimposed directly
  14641. over one another.
  14642. This display mode makes it easier to spot relative differences or similarities
  14643. in overlapping areas of the color components that are supposed to be identical,
  14644. such as neutral whites, grays, or blacks.
  14645. @item stack
  14646. Display separate graph for the color components side by side in
  14647. @code{row} mode or one below the other in @code{column} mode.
  14648. @item parade
  14649. Display separate graph for the color components side by side in
  14650. @code{column} mode or one below the other in @code{row} mode.
  14651. Using this display mode makes it easy to spot color casts in the highlights
  14652. and shadows of an image, by comparing the contours of the top and the bottom
  14653. graphs of each waveform. Since whites, grays, and blacks are characterized
  14654. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  14655. should display three waveforms of roughly equal width/height. If not, the
  14656. correction is easy to perform by making level adjustments the three waveforms.
  14657. @end table
  14658. Default is @code{stack}.
  14659. @item components, c
  14660. Set which color components to display. Default is 1, which means only luminance
  14661. or red color component if input is in RGB colorspace. If is set for example to
  14662. 7 it will display all 3 (if) available color components.
  14663. @item envelope, e
  14664. @table @samp
  14665. @item none
  14666. No envelope, this is default.
  14667. @item instant
  14668. Instant envelope, minimum and maximum values presented in graph will be easily
  14669. visible even with small @code{step} value.
  14670. @item peak
  14671. Hold minimum and maximum values presented in graph across time. This way you
  14672. can still spot out of range values without constantly looking at waveforms.
  14673. @item peak+instant
  14674. Peak and instant envelope combined together.
  14675. @end table
  14676. @item filter, f
  14677. @table @samp
  14678. @item lowpass
  14679. No filtering, this is default.
  14680. @item flat
  14681. Luma and chroma combined together.
  14682. @item aflat
  14683. Similar as above, but shows difference between blue and red chroma.
  14684. @item xflat
  14685. Similar as above, but use different colors.
  14686. @item yflat
  14687. Similar as above, but again with different colors.
  14688. @item chroma
  14689. Displays only chroma.
  14690. @item color
  14691. Displays actual color value on waveform.
  14692. @item acolor
  14693. Similar as above, but with luma showing frequency of chroma values.
  14694. @end table
  14695. @item graticule, g
  14696. Set which graticule to display.
  14697. @table @samp
  14698. @item none
  14699. Do not display graticule.
  14700. @item green
  14701. Display green graticule showing legal broadcast ranges.
  14702. @item orange
  14703. Display orange graticule showing legal broadcast ranges.
  14704. @item invert
  14705. Display invert graticule showing legal broadcast ranges.
  14706. @end table
  14707. @item opacity, o
  14708. Set graticule opacity.
  14709. @item flags, fl
  14710. Set graticule flags.
  14711. @table @samp
  14712. @item numbers
  14713. Draw numbers above lines. By default enabled.
  14714. @item dots
  14715. Draw dots instead of lines.
  14716. @end table
  14717. @item scale, s
  14718. Set scale used for displaying graticule.
  14719. @table @samp
  14720. @item digital
  14721. @item millivolts
  14722. @item ire
  14723. @end table
  14724. Default is digital.
  14725. @item bgopacity, b
  14726. Set background opacity.
  14727. @end table
  14728. @section weave, doubleweave
  14729. The @code{weave} takes a field-based video input and join
  14730. each two sequential fields into single frame, producing a new double
  14731. height clip with half the frame rate and half the frame count.
  14732. The @code{doubleweave} works same as @code{weave} but without
  14733. halving frame rate and frame count.
  14734. It accepts the following option:
  14735. @table @option
  14736. @item first_field
  14737. Set first field. Available values are:
  14738. @table @samp
  14739. @item top, t
  14740. Set the frame as top-field-first.
  14741. @item bottom, b
  14742. Set the frame as bottom-field-first.
  14743. @end table
  14744. @end table
  14745. @subsection Examples
  14746. @itemize
  14747. @item
  14748. Interlace video using @ref{select} and @ref{separatefields} filter:
  14749. @example
  14750. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  14751. @end example
  14752. @end itemize
  14753. @section xbr
  14754. Apply the xBR high-quality magnification filter which is designed for pixel
  14755. art. It follows a set of edge-detection rules, see
  14756. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  14757. It accepts the following option:
  14758. @table @option
  14759. @item n
  14760. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  14761. @code{3xBR} and @code{4} for @code{4xBR}.
  14762. Default is @code{3}.
  14763. @end table
  14764. @section xmedian
  14765. Pick median pixels from several input videos.
  14766. The filter accepts the following options:
  14767. @table @option
  14768. @item inputs
  14769. Set number of inputs.
  14770. Default is 3. Allowed range is from 3 to 255.
  14771. If number of inputs is even number, than result will be mean value between two median values.
  14772. @item planes
  14773. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14774. @end table
  14775. @section xstack
  14776. Stack video inputs into custom layout.
  14777. All streams must be of same pixel format.
  14778. The filter accepts the following options:
  14779. @table @option
  14780. @item inputs
  14781. Set number of input streams. Default is 2.
  14782. @item layout
  14783. Specify layout of inputs.
  14784. This option requires the desired layout configuration to be explicitly set by the user.
  14785. This sets position of each video input in output. Each input
  14786. is separated by '|'.
  14787. The first number represents the column, and the second number represents the row.
  14788. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  14789. where X is video input from which to take width or height.
  14790. Multiple values can be used when separated by '+'. In such
  14791. case values are summed together.
  14792. Note that if inputs are of different sizes gaps may appear, as not all of
  14793. the output video frame will be filled. Similarly, videos can overlap each
  14794. other if their position doesn't leave enough space for the full frame of
  14795. adjoining videos.
  14796. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  14797. a layout must be set by the user.
  14798. @item shortest
  14799. If set to 1, force the output to terminate when the shortest input
  14800. terminates. Default value is 0.
  14801. @end table
  14802. @subsection Examples
  14803. @itemize
  14804. @item
  14805. Display 4 inputs into 2x2 grid.
  14806. Layout:
  14807. @example
  14808. input1(0, 0) | input3(w0, 0)
  14809. input2(0, h0) | input4(w0, h0)
  14810. @end example
  14811. @example
  14812. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  14813. @end example
  14814. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14815. @item
  14816. Display 4 inputs into 1x4 grid.
  14817. Layout:
  14818. @example
  14819. input1(0, 0)
  14820. input2(0, h0)
  14821. input3(0, h0+h1)
  14822. input4(0, h0+h1+h2)
  14823. @end example
  14824. @example
  14825. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  14826. @end example
  14827. Note that if inputs are of different widths, unused space will appear.
  14828. @item
  14829. Display 9 inputs into 3x3 grid.
  14830. Layout:
  14831. @example
  14832. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  14833. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  14834. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  14835. @end example
  14836. @example
  14837. 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
  14838. @end example
  14839. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14840. @item
  14841. Display 16 inputs into 4x4 grid.
  14842. Layout:
  14843. @example
  14844. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  14845. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  14846. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  14847. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  14848. @end example
  14849. @example
  14850. 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|
  14851. 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
  14852. @end example
  14853. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14854. @end itemize
  14855. @anchor{yadif}
  14856. @section yadif
  14857. Deinterlace the input video ("yadif" means "yet another deinterlacing
  14858. filter").
  14859. It accepts the following parameters:
  14860. @table @option
  14861. @item mode
  14862. The interlacing mode to adopt. It accepts one of the following values:
  14863. @table @option
  14864. @item 0, send_frame
  14865. Output one frame for each frame.
  14866. @item 1, send_field
  14867. Output one frame for each field.
  14868. @item 2, send_frame_nospatial
  14869. Like @code{send_frame}, but it skips the spatial interlacing check.
  14870. @item 3, send_field_nospatial
  14871. Like @code{send_field}, but it skips the spatial interlacing check.
  14872. @end table
  14873. The default value is @code{send_frame}.
  14874. @item parity
  14875. The picture field parity assumed for the input interlaced video. It accepts one
  14876. of the following values:
  14877. @table @option
  14878. @item 0, tff
  14879. Assume the top field is first.
  14880. @item 1, bff
  14881. Assume the bottom field is first.
  14882. @item -1, auto
  14883. Enable automatic detection of field parity.
  14884. @end table
  14885. The default value is @code{auto}.
  14886. If the interlacing is unknown or the decoder does not export this information,
  14887. top field first will be assumed.
  14888. @item deint
  14889. Specify which frames to deinterlace. Accepts one of the following
  14890. values:
  14891. @table @option
  14892. @item 0, all
  14893. Deinterlace all frames.
  14894. @item 1, interlaced
  14895. Only deinterlace frames marked as interlaced.
  14896. @end table
  14897. The default value is @code{all}.
  14898. @end table
  14899. @section yadif_cuda
  14900. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  14901. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  14902. and/or nvenc.
  14903. It accepts the following parameters:
  14904. @table @option
  14905. @item mode
  14906. The interlacing mode to adopt. It accepts one of the following values:
  14907. @table @option
  14908. @item 0, send_frame
  14909. Output one frame for each frame.
  14910. @item 1, send_field
  14911. Output one frame for each field.
  14912. @item 2, send_frame_nospatial
  14913. Like @code{send_frame}, but it skips the spatial interlacing check.
  14914. @item 3, send_field_nospatial
  14915. Like @code{send_field}, but it skips the spatial interlacing check.
  14916. @end table
  14917. The default value is @code{send_frame}.
  14918. @item parity
  14919. The picture field parity assumed for the input interlaced video. It accepts one
  14920. of the following values:
  14921. @table @option
  14922. @item 0, tff
  14923. Assume the top field is first.
  14924. @item 1, bff
  14925. Assume the bottom field is first.
  14926. @item -1, auto
  14927. Enable automatic detection of field parity.
  14928. @end table
  14929. The default value is @code{auto}.
  14930. If the interlacing is unknown or the decoder does not export this information,
  14931. top field first will be assumed.
  14932. @item deint
  14933. Specify which frames to deinterlace. Accepts one of the following
  14934. values:
  14935. @table @option
  14936. @item 0, all
  14937. Deinterlace all frames.
  14938. @item 1, interlaced
  14939. Only deinterlace frames marked as interlaced.
  14940. @end table
  14941. The default value is @code{all}.
  14942. @end table
  14943. @section zoompan
  14944. Apply Zoom & Pan effect.
  14945. This filter accepts the following options:
  14946. @table @option
  14947. @item zoom, z
  14948. Set the zoom expression. Range is 1-10. Default is 1.
  14949. @item x
  14950. @item y
  14951. Set the x and y expression. Default is 0.
  14952. @item d
  14953. Set the duration expression in number of frames.
  14954. This sets for how many number of frames effect will last for
  14955. single input image.
  14956. @item s
  14957. Set the output image size, default is 'hd720'.
  14958. @item fps
  14959. Set the output frame rate, default is '25'.
  14960. @end table
  14961. Each expression can contain the following constants:
  14962. @table @option
  14963. @item in_w, iw
  14964. Input width.
  14965. @item in_h, ih
  14966. Input height.
  14967. @item out_w, ow
  14968. Output width.
  14969. @item out_h, oh
  14970. Output height.
  14971. @item in
  14972. Input frame count.
  14973. @item on
  14974. Output frame count.
  14975. @item x
  14976. @item y
  14977. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14978. for current input frame.
  14979. @item px
  14980. @item py
  14981. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14982. not yet such frame (first input frame).
  14983. @item zoom
  14984. Last calculated zoom from 'z' expression for current input frame.
  14985. @item pzoom
  14986. Last calculated zoom of last output frame of previous input frame.
  14987. @item duration
  14988. Number of output frames for current input frame. Calculated from 'd' expression
  14989. for each input frame.
  14990. @item pduration
  14991. number of output frames created for previous input frame
  14992. @item a
  14993. Rational number: input width / input height
  14994. @item sar
  14995. sample aspect ratio
  14996. @item dar
  14997. display aspect ratio
  14998. @end table
  14999. @subsection Examples
  15000. @itemize
  15001. @item
  15002. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  15003. @example
  15004. 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
  15005. @end example
  15006. @item
  15007. Zoom-in up to 1.5 and pan always at center of picture:
  15008. @example
  15009. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15010. @end example
  15011. @item
  15012. Same as above but without pausing:
  15013. @example
  15014. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15015. @end example
  15016. @end itemize
  15017. @anchor{zscale}
  15018. @section zscale
  15019. Scale (resize) the input video, using the z.lib library:
  15020. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  15021. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  15022. The zscale filter forces the output display aspect ratio to be the same
  15023. as the input, by changing the output sample aspect ratio.
  15024. If the input image format is different from the format requested by
  15025. the next filter, the zscale filter will convert the input to the
  15026. requested format.
  15027. @subsection Options
  15028. The filter accepts the following options.
  15029. @table @option
  15030. @item width, w
  15031. @item height, h
  15032. Set the output video dimension expression. Default value is the input
  15033. dimension.
  15034. If the @var{width} or @var{w} value is 0, the input width is used for
  15035. the output. If the @var{height} or @var{h} value is 0, the input height
  15036. is used for the output.
  15037. If one and only one of the values is -n with n >= 1, the zscale filter
  15038. will use a value that maintains the aspect ratio of the input image,
  15039. calculated from the other specified dimension. After that it will,
  15040. however, make sure that the calculated dimension is divisible by n and
  15041. adjust the value if necessary.
  15042. If both values are -n with n >= 1, the behavior will be identical to
  15043. both values being set to 0 as previously detailed.
  15044. See below for the list of accepted constants for use in the dimension
  15045. expression.
  15046. @item size, s
  15047. Set the video size. For the syntax of this option, check the
  15048. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15049. @item dither, d
  15050. Set the dither type.
  15051. Possible values are:
  15052. @table @var
  15053. @item none
  15054. @item ordered
  15055. @item random
  15056. @item error_diffusion
  15057. @end table
  15058. Default is none.
  15059. @item filter, f
  15060. Set the resize filter type.
  15061. Possible values are:
  15062. @table @var
  15063. @item point
  15064. @item bilinear
  15065. @item bicubic
  15066. @item spline16
  15067. @item spline36
  15068. @item lanczos
  15069. @end table
  15070. Default is bilinear.
  15071. @item range, r
  15072. Set the color range.
  15073. Possible values are:
  15074. @table @var
  15075. @item input
  15076. @item limited
  15077. @item full
  15078. @end table
  15079. Default is same as input.
  15080. @item primaries, p
  15081. Set the color primaries.
  15082. Possible values are:
  15083. @table @var
  15084. @item input
  15085. @item 709
  15086. @item unspecified
  15087. @item 170m
  15088. @item 240m
  15089. @item 2020
  15090. @end table
  15091. Default is same as input.
  15092. @item transfer, t
  15093. Set the transfer characteristics.
  15094. Possible values are:
  15095. @table @var
  15096. @item input
  15097. @item 709
  15098. @item unspecified
  15099. @item 601
  15100. @item linear
  15101. @item 2020_10
  15102. @item 2020_12
  15103. @item smpte2084
  15104. @item iec61966-2-1
  15105. @item arib-std-b67
  15106. @end table
  15107. Default is same as input.
  15108. @item matrix, m
  15109. Set the colorspace matrix.
  15110. Possible value are:
  15111. @table @var
  15112. @item input
  15113. @item 709
  15114. @item unspecified
  15115. @item 470bg
  15116. @item 170m
  15117. @item 2020_ncl
  15118. @item 2020_cl
  15119. @end table
  15120. Default is same as input.
  15121. @item rangein, rin
  15122. Set the input color range.
  15123. Possible values are:
  15124. @table @var
  15125. @item input
  15126. @item limited
  15127. @item full
  15128. @end table
  15129. Default is same as input.
  15130. @item primariesin, pin
  15131. Set the input color primaries.
  15132. Possible values are:
  15133. @table @var
  15134. @item input
  15135. @item 709
  15136. @item unspecified
  15137. @item 170m
  15138. @item 240m
  15139. @item 2020
  15140. @end table
  15141. Default is same as input.
  15142. @item transferin, tin
  15143. Set the input transfer characteristics.
  15144. Possible values are:
  15145. @table @var
  15146. @item input
  15147. @item 709
  15148. @item unspecified
  15149. @item 601
  15150. @item linear
  15151. @item 2020_10
  15152. @item 2020_12
  15153. @end table
  15154. Default is same as input.
  15155. @item matrixin, min
  15156. Set the input colorspace matrix.
  15157. Possible value are:
  15158. @table @var
  15159. @item input
  15160. @item 709
  15161. @item unspecified
  15162. @item 470bg
  15163. @item 170m
  15164. @item 2020_ncl
  15165. @item 2020_cl
  15166. @end table
  15167. @item chromal, c
  15168. Set the output chroma location.
  15169. Possible values are:
  15170. @table @var
  15171. @item input
  15172. @item left
  15173. @item center
  15174. @item topleft
  15175. @item top
  15176. @item bottomleft
  15177. @item bottom
  15178. @end table
  15179. @item chromalin, cin
  15180. Set the input chroma location.
  15181. Possible values are:
  15182. @table @var
  15183. @item input
  15184. @item left
  15185. @item center
  15186. @item topleft
  15187. @item top
  15188. @item bottomleft
  15189. @item bottom
  15190. @end table
  15191. @item npl
  15192. Set the nominal peak luminance.
  15193. @end table
  15194. The values of the @option{w} and @option{h} options are expressions
  15195. containing the following constants:
  15196. @table @var
  15197. @item in_w
  15198. @item in_h
  15199. The input width and height
  15200. @item iw
  15201. @item ih
  15202. These are the same as @var{in_w} and @var{in_h}.
  15203. @item out_w
  15204. @item out_h
  15205. The output (scaled) width and height
  15206. @item ow
  15207. @item oh
  15208. These are the same as @var{out_w} and @var{out_h}
  15209. @item a
  15210. The same as @var{iw} / @var{ih}
  15211. @item sar
  15212. input sample aspect ratio
  15213. @item dar
  15214. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15215. @item hsub
  15216. @item vsub
  15217. horizontal and vertical input chroma subsample values. For example for the
  15218. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15219. @item ohsub
  15220. @item ovsub
  15221. horizontal and vertical output chroma subsample values. For example for the
  15222. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15223. @end table
  15224. @table @option
  15225. @end table
  15226. @c man end VIDEO FILTERS
  15227. @chapter OpenCL Video Filters
  15228. @c man begin OPENCL VIDEO FILTERS
  15229. Below is a description of the currently available OpenCL video filters.
  15230. To enable compilation of these filters you need to configure FFmpeg with
  15231. @code{--enable-opencl}.
  15232. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  15233. @table @option
  15234. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  15235. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  15236. given device parameters.
  15237. @item -filter_hw_device @var{name}
  15238. Pass the hardware device called @var{name} to all filters in any filter graph.
  15239. @end table
  15240. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  15241. @itemize
  15242. @item
  15243. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  15244. @example
  15245. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  15246. @end example
  15247. @end itemize
  15248. 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.
  15249. @section avgblur_opencl
  15250. Apply average blur filter.
  15251. The filter accepts the following options:
  15252. @table @option
  15253. @item sizeX
  15254. Set horizontal radius size.
  15255. Range is @code{[1, 1024]} and default value is @code{1}.
  15256. @item planes
  15257. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15258. @item sizeY
  15259. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  15260. @end table
  15261. @subsection Example
  15262. @itemize
  15263. @item
  15264. 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.
  15265. @example
  15266. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  15267. @end example
  15268. @end itemize
  15269. @section boxblur_opencl
  15270. Apply a boxblur algorithm to the input video.
  15271. It accepts the following parameters:
  15272. @table @option
  15273. @item luma_radius, lr
  15274. @item luma_power, lp
  15275. @item chroma_radius, cr
  15276. @item chroma_power, cp
  15277. @item alpha_radius, ar
  15278. @item alpha_power, ap
  15279. @end table
  15280. A description of the accepted options follows.
  15281. @table @option
  15282. @item luma_radius, lr
  15283. @item chroma_radius, cr
  15284. @item alpha_radius, ar
  15285. Set an expression for the box radius in pixels used for blurring the
  15286. corresponding input plane.
  15287. The radius value must be a non-negative number, and must not be
  15288. greater than the value of the expression @code{min(w,h)/2} for the
  15289. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  15290. planes.
  15291. Default value for @option{luma_radius} is "2". If not specified,
  15292. @option{chroma_radius} and @option{alpha_radius} default to the
  15293. corresponding value set for @option{luma_radius}.
  15294. The expressions can contain the following constants:
  15295. @table @option
  15296. @item w
  15297. @item h
  15298. The input width and height in pixels.
  15299. @item cw
  15300. @item ch
  15301. The input chroma image width and height in pixels.
  15302. @item hsub
  15303. @item vsub
  15304. The horizontal and vertical chroma subsample values. For example, for the
  15305. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  15306. @end table
  15307. @item luma_power, lp
  15308. @item chroma_power, cp
  15309. @item alpha_power, ap
  15310. Specify how many times the boxblur filter is applied to the
  15311. corresponding plane.
  15312. Default value for @option{luma_power} is 2. If not specified,
  15313. @option{chroma_power} and @option{alpha_power} default to the
  15314. corresponding value set for @option{luma_power}.
  15315. A value of 0 will disable the effect.
  15316. @end table
  15317. @subsection Examples
  15318. 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.
  15319. @itemize
  15320. @item
  15321. Apply a boxblur filter with the luma, chroma, and alpha radius
  15322. 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.
  15323. @example
  15324. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  15325. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  15326. @end example
  15327. @item
  15328. 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.
  15329. For the luma plane, a 2x2 box radius will be run once.
  15330. For the chroma plane, a 4x4 box radius will be run 5 times.
  15331. For the alpha plane, a 3x3 box radius will be run 7 times.
  15332. @example
  15333. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  15334. @end example
  15335. @end itemize
  15336. @section convolution_opencl
  15337. Apply convolution of 3x3, 5x5, 7x7 matrix.
  15338. The filter accepts the following options:
  15339. @table @option
  15340. @item 0m
  15341. @item 1m
  15342. @item 2m
  15343. @item 3m
  15344. Set matrix for each plane.
  15345. Matrix is sequence of 9, 25 or 49 signed numbers.
  15346. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  15347. @item 0rdiv
  15348. @item 1rdiv
  15349. @item 2rdiv
  15350. @item 3rdiv
  15351. Set multiplier for calculated value for each plane.
  15352. If unset or 0, it will be sum of all matrix elements.
  15353. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  15354. @item 0bias
  15355. @item 1bias
  15356. @item 2bias
  15357. @item 3bias
  15358. Set bias for each plane. This value is added to the result of the multiplication.
  15359. Useful for making the overall image brighter or darker.
  15360. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  15361. @end table
  15362. @subsection Examples
  15363. @itemize
  15364. @item
  15365. Apply sharpen:
  15366. @example
  15367. -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
  15368. @end example
  15369. @item
  15370. Apply blur:
  15371. @example
  15372. -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
  15373. @end example
  15374. @item
  15375. Apply edge enhance:
  15376. @example
  15377. -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
  15378. @end example
  15379. @item
  15380. Apply edge detect:
  15381. @example
  15382. -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
  15383. @end example
  15384. @item
  15385. Apply laplacian edge detector which includes diagonals:
  15386. @example
  15387. -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
  15388. @end example
  15389. @item
  15390. Apply emboss:
  15391. @example
  15392. -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
  15393. @end example
  15394. @end itemize
  15395. @section dilation_opencl
  15396. Apply dilation effect to the video.
  15397. This filter replaces the pixel by the local(3x3) maximum.
  15398. It accepts the following options:
  15399. @table @option
  15400. @item threshold0
  15401. @item threshold1
  15402. @item threshold2
  15403. @item threshold3
  15404. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15405. If @code{0}, plane will remain unchanged.
  15406. @item coordinates
  15407. Flag which specifies the pixel to refer to.
  15408. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15409. Flags to local 3x3 coordinates region centered on @code{x}:
  15410. 1 2 3
  15411. 4 x 5
  15412. 6 7 8
  15413. @end table
  15414. @subsection Example
  15415. @itemize
  15416. @item
  15417. 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.
  15418. @example
  15419. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15420. @end example
  15421. @end itemize
  15422. @section erosion_opencl
  15423. Apply erosion effect to the video.
  15424. This filter replaces the pixel by the local(3x3) minimum.
  15425. It accepts the following options:
  15426. @table @option
  15427. @item threshold0
  15428. @item threshold1
  15429. @item threshold2
  15430. @item threshold3
  15431. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15432. If @code{0}, plane will remain unchanged.
  15433. @item coordinates
  15434. Flag which specifies the pixel to refer to.
  15435. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15436. Flags to local 3x3 coordinates region centered on @code{x}:
  15437. 1 2 3
  15438. 4 x 5
  15439. 6 7 8
  15440. @end table
  15441. @subsection Example
  15442. @itemize
  15443. @item
  15444. 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.
  15445. @example
  15446. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15447. @end example
  15448. @end itemize
  15449. @section colorkey_opencl
  15450. RGB colorspace color keying.
  15451. The filter accepts the following options:
  15452. @table @option
  15453. @item color
  15454. The color which will be replaced with transparency.
  15455. @item similarity
  15456. Similarity percentage with the key color.
  15457. 0.01 matches only the exact key color, while 1.0 matches everything.
  15458. @item blend
  15459. Blend percentage.
  15460. 0.0 makes pixels either fully transparent, or not transparent at all.
  15461. Higher values result in semi-transparent pixels, with a higher transparency
  15462. the more similar the pixels color is to the key color.
  15463. @end table
  15464. @subsection Examples
  15465. @itemize
  15466. @item
  15467. Make every semi-green pixel in the input transparent with some slight blending:
  15468. @example
  15469. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  15470. @end example
  15471. @end itemize
  15472. @section deshake_opencl
  15473. Feature-point based video stabilization filter.
  15474. The filter accepts the following options:
  15475. @table @option
  15476. @item tripod
  15477. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  15478. @item debug
  15479. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  15480. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  15481. Viewing point matches in the output video is only supported for RGB input.
  15482. Defaults to @code{0}.
  15483. @item adaptive_crop
  15484. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  15485. Defaults to @code{1}.
  15486. @item refine_features
  15487. Whether or not feature points should be refined at a sub-pixel level.
  15488. This can be turned off for a slight performance gain at the cost of precision.
  15489. Defaults to @code{1}.
  15490. @item smooth_strength
  15491. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  15492. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  15493. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  15494. Defaults to @code{0.0}.
  15495. @item smooth_window_multiplier
  15496. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  15497. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  15498. Acceptable values range from @code{0.1} to @code{10.0}.
  15499. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  15500. potentially improving smoothness, but also increase latency and memory usage.
  15501. Defaults to @code{2.0}.
  15502. @end table
  15503. @subsection Examples
  15504. @itemize
  15505. @item
  15506. Stabilize a video with a fixed, medium smoothing strength:
  15507. @example
  15508. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  15509. @end example
  15510. @item
  15511. Stabilize a video with debugging (both in console and in rendered video):
  15512. @example
  15513. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  15514. @end example
  15515. @end itemize
  15516. @section nlmeans_opencl
  15517. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  15518. @section overlay_opencl
  15519. Overlay one video on top of another.
  15520. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  15521. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  15522. The filter accepts the following options:
  15523. @table @option
  15524. @item x
  15525. Set the x coordinate of the overlaid video on the main video.
  15526. Default value is @code{0}.
  15527. @item y
  15528. Set the x coordinate of the overlaid video on the main video.
  15529. Default value is @code{0}.
  15530. @end table
  15531. @subsection Examples
  15532. @itemize
  15533. @item
  15534. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  15535. @example
  15536. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15537. @end example
  15538. @item
  15539. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  15540. @example
  15541. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15542. @end example
  15543. @end itemize
  15544. @section prewitt_opencl
  15545. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  15546. The filter accepts the following option:
  15547. @table @option
  15548. @item planes
  15549. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15550. @item scale
  15551. Set value which will be multiplied with filtered result.
  15552. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15553. @item delta
  15554. Set value which will be added to filtered result.
  15555. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15556. @end table
  15557. @subsection Example
  15558. @itemize
  15559. @item
  15560. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  15561. @example
  15562. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15563. @end example
  15564. @end itemize
  15565. @section roberts_opencl
  15566. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  15567. The filter accepts the following option:
  15568. @table @option
  15569. @item planes
  15570. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15571. @item scale
  15572. Set value which will be multiplied with filtered result.
  15573. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15574. @item delta
  15575. Set value which will be added to filtered result.
  15576. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15577. @end table
  15578. @subsection Example
  15579. @itemize
  15580. @item
  15581. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  15582. @example
  15583. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15584. @end example
  15585. @end itemize
  15586. @section sobel_opencl
  15587. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  15588. The filter accepts the following option:
  15589. @table @option
  15590. @item planes
  15591. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15592. @item scale
  15593. Set value which will be multiplied with filtered result.
  15594. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15595. @item delta
  15596. Set value which will be added to filtered result.
  15597. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15598. @end table
  15599. @subsection Example
  15600. @itemize
  15601. @item
  15602. Apply sobel operator with scale set to 2 and delta set to 10
  15603. @example
  15604. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15605. @end example
  15606. @end itemize
  15607. @section tonemap_opencl
  15608. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  15609. It accepts the following parameters:
  15610. @table @option
  15611. @item tonemap
  15612. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  15613. @item param
  15614. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  15615. @item desat
  15616. Apply desaturation for highlights that exceed this level of brightness. The
  15617. higher the parameter, the more color information will be preserved. This
  15618. setting helps prevent unnaturally blown-out colors for super-highlights, by
  15619. (smoothly) turning into white instead. This makes images feel more natural,
  15620. at the cost of reducing information about out-of-range colors.
  15621. The default value is 0.5, and the algorithm here is a little different from
  15622. the cpu version tonemap currently. A setting of 0.0 disables this option.
  15623. @item threshold
  15624. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  15625. is used to detect whether the scene has changed or not. If the distance between
  15626. the current frame average brightness and the current running average exceeds
  15627. a threshold value, we would re-calculate scene average and peak brightness.
  15628. The default value is 0.2.
  15629. @item format
  15630. Specify the output pixel format.
  15631. Currently supported formats are:
  15632. @table @var
  15633. @item p010
  15634. @item nv12
  15635. @end table
  15636. @item range, r
  15637. Set the output color range.
  15638. Possible values are:
  15639. @table @var
  15640. @item tv/mpeg
  15641. @item pc/jpeg
  15642. @end table
  15643. Default is same as input.
  15644. @item primaries, p
  15645. Set the output color primaries.
  15646. Possible values are:
  15647. @table @var
  15648. @item bt709
  15649. @item bt2020
  15650. @end table
  15651. Default is same as input.
  15652. @item transfer, t
  15653. Set the output transfer characteristics.
  15654. Possible values are:
  15655. @table @var
  15656. @item bt709
  15657. @item bt2020
  15658. @end table
  15659. Default is bt709.
  15660. @item matrix, m
  15661. Set the output colorspace matrix.
  15662. Possible value are:
  15663. @table @var
  15664. @item bt709
  15665. @item bt2020
  15666. @end table
  15667. Default is same as input.
  15668. @end table
  15669. @subsection Example
  15670. @itemize
  15671. @item
  15672. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  15673. @example
  15674. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  15675. @end example
  15676. @end itemize
  15677. @section unsharp_opencl
  15678. Sharpen or blur the input video.
  15679. It accepts the following parameters:
  15680. @table @option
  15681. @item luma_msize_x, lx
  15682. Set the luma matrix horizontal size.
  15683. Range is @code{[1, 23]} and default value is @code{5}.
  15684. @item luma_msize_y, ly
  15685. Set the luma matrix vertical size.
  15686. Range is @code{[1, 23]} and default value is @code{5}.
  15687. @item luma_amount, la
  15688. Set the luma effect strength.
  15689. Range is @code{[-10, 10]} and default value is @code{1.0}.
  15690. Negative values will blur the input video, while positive values will
  15691. sharpen it, a value of zero will disable the effect.
  15692. @item chroma_msize_x, cx
  15693. Set the chroma matrix horizontal size.
  15694. Range is @code{[1, 23]} and default value is @code{5}.
  15695. @item chroma_msize_y, cy
  15696. Set the chroma matrix vertical size.
  15697. Range is @code{[1, 23]} and default value is @code{5}.
  15698. @item chroma_amount, ca
  15699. Set the chroma effect strength.
  15700. Range is @code{[-10, 10]} and default value is @code{0.0}.
  15701. Negative values will blur the input video, while positive values will
  15702. sharpen it, a value of zero will disable the effect.
  15703. @end table
  15704. All parameters are optional and default to the equivalent of the
  15705. string '5:5:1.0:5:5:0.0'.
  15706. @subsection Examples
  15707. @itemize
  15708. @item
  15709. Apply strong luma sharpen effect:
  15710. @example
  15711. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  15712. @end example
  15713. @item
  15714. Apply a strong blur of both luma and chroma parameters:
  15715. @example
  15716. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  15717. @end example
  15718. @end itemize
  15719. @c man end OPENCL VIDEO FILTERS
  15720. @chapter Video Sources
  15721. @c man begin VIDEO SOURCES
  15722. Below is a description of the currently available video sources.
  15723. @section buffer
  15724. Buffer video frames, and make them available to the filter chain.
  15725. This source is mainly intended for a programmatic use, in particular
  15726. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  15727. It accepts the following parameters:
  15728. @table @option
  15729. @item video_size
  15730. Specify the size (width and height) of the buffered video frames. For the
  15731. syntax of this option, check the
  15732. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15733. @item width
  15734. The input video width.
  15735. @item height
  15736. The input video height.
  15737. @item pix_fmt
  15738. A string representing the pixel format of the buffered video frames.
  15739. It may be a number corresponding to a pixel format, or a pixel format
  15740. name.
  15741. @item time_base
  15742. Specify the timebase assumed by the timestamps of the buffered frames.
  15743. @item frame_rate
  15744. Specify the frame rate expected for the video stream.
  15745. @item pixel_aspect, sar
  15746. The sample (pixel) aspect ratio of the input video.
  15747. @item sws_param
  15748. Specify the optional parameters to be used for the scale filter which
  15749. is automatically inserted when an input change is detected in the
  15750. input size or format.
  15751. @item hw_frames_ctx
  15752. When using a hardware pixel format, this should be a reference to an
  15753. AVHWFramesContext describing input frames.
  15754. @end table
  15755. For example:
  15756. @example
  15757. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  15758. @end example
  15759. will instruct the source to accept video frames with size 320x240 and
  15760. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  15761. square pixels (1:1 sample aspect ratio).
  15762. Since the pixel format with name "yuv410p" corresponds to the number 6
  15763. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  15764. this example corresponds to:
  15765. @example
  15766. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  15767. @end example
  15768. Alternatively, the options can be specified as a flat string, but this
  15769. syntax is deprecated:
  15770. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}[:@var{sws_param}]
  15771. @section cellauto
  15772. Create a pattern generated by an elementary cellular automaton.
  15773. The initial state of the cellular automaton can be defined through the
  15774. @option{filename} and @option{pattern} options. If such options are
  15775. not specified an initial state is created randomly.
  15776. At each new frame a new row in the video is filled with the result of
  15777. the cellular automaton next generation. The behavior when the whole
  15778. frame is filled is defined by the @option{scroll} option.
  15779. This source accepts the following options:
  15780. @table @option
  15781. @item filename, f
  15782. Read the initial cellular automaton state, i.e. the starting row, from
  15783. the specified file.
  15784. In the file, each non-whitespace character is considered an alive
  15785. cell, a newline will terminate the row, and further characters in the
  15786. file will be ignored.
  15787. @item pattern, p
  15788. Read the initial cellular automaton state, i.e. the starting row, from
  15789. the specified string.
  15790. Each non-whitespace character in the string is considered an alive
  15791. cell, a newline will terminate the row, and further characters in the
  15792. string will be ignored.
  15793. @item rate, r
  15794. Set the video rate, that is the number of frames generated per second.
  15795. Default is 25.
  15796. @item random_fill_ratio, ratio
  15797. Set the random fill ratio for the initial cellular automaton row. It
  15798. is a floating point number value ranging from 0 to 1, defaults to
  15799. 1/PHI.
  15800. This option is ignored when a file or a pattern is specified.
  15801. @item random_seed, seed
  15802. Set the seed for filling randomly the initial row, must be an integer
  15803. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15804. set to -1, the filter will try to use a good random seed on a best
  15805. effort basis.
  15806. @item rule
  15807. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  15808. Default value is 110.
  15809. @item size, s
  15810. Set the size of the output video. For the syntax of this option, check the
  15811. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15812. If @option{filename} or @option{pattern} is specified, the size is set
  15813. by default to the width of the specified initial state row, and the
  15814. height is set to @var{width} * PHI.
  15815. If @option{size} is set, it must contain the width of the specified
  15816. pattern string, and the specified pattern will be centered in the
  15817. larger row.
  15818. If a filename or a pattern string is not specified, the size value
  15819. defaults to "320x518" (used for a randomly generated initial state).
  15820. @item scroll
  15821. If set to 1, scroll the output upward when all the rows in the output
  15822. have been already filled. If set to 0, the new generated row will be
  15823. written over the top row just after the bottom row is filled.
  15824. Defaults to 1.
  15825. @item start_full, full
  15826. If set to 1, completely fill the output with generated rows before
  15827. outputting the first frame.
  15828. This is the default behavior, for disabling set the value to 0.
  15829. @item stitch
  15830. If set to 1, stitch the left and right row edges together.
  15831. This is the default behavior, for disabling set the value to 0.
  15832. @end table
  15833. @subsection Examples
  15834. @itemize
  15835. @item
  15836. Read the initial state from @file{pattern}, and specify an output of
  15837. size 200x400.
  15838. @example
  15839. cellauto=f=pattern:s=200x400
  15840. @end example
  15841. @item
  15842. Generate a random initial row with a width of 200 cells, with a fill
  15843. ratio of 2/3:
  15844. @example
  15845. cellauto=ratio=2/3:s=200x200
  15846. @end example
  15847. @item
  15848. Create a pattern generated by rule 18 starting by a single alive cell
  15849. centered on an initial row with width 100:
  15850. @example
  15851. cellauto=p=@@:s=100x400:full=0:rule=18
  15852. @end example
  15853. @item
  15854. Specify a more elaborated initial pattern:
  15855. @example
  15856. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  15857. @end example
  15858. @end itemize
  15859. @anchor{coreimagesrc}
  15860. @section coreimagesrc
  15861. Video source generated on GPU using Apple's CoreImage API on OSX.
  15862. This video source is a specialized version of the @ref{coreimage} video filter.
  15863. Use a core image generator at the beginning of the applied filterchain to
  15864. generate the content.
  15865. The coreimagesrc video source accepts the following options:
  15866. @table @option
  15867. @item list_generators
  15868. List all available generators along with all their respective options as well as
  15869. possible minimum and maximum values along with the default values.
  15870. @example
  15871. list_generators=true
  15872. @end example
  15873. @item size, s
  15874. Specify the size of the sourced video. For the syntax of this option, check the
  15875. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15876. The default value is @code{320x240}.
  15877. @item rate, r
  15878. Specify the frame rate of the sourced video, as the number of frames
  15879. generated per second. It has to be a string in the format
  15880. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15881. number or a valid video frame rate abbreviation. The default value is
  15882. "25".
  15883. @item sar
  15884. Set the sample aspect ratio of the sourced video.
  15885. @item duration, d
  15886. Set the duration of the sourced video. See
  15887. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15888. for the accepted syntax.
  15889. If not specified, or the expressed duration is negative, the video is
  15890. supposed to be generated forever.
  15891. @end table
  15892. Additionally, all options of the @ref{coreimage} video filter are accepted.
  15893. A complete filterchain can be used for further processing of the
  15894. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  15895. and examples for details.
  15896. @subsection Examples
  15897. @itemize
  15898. @item
  15899. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  15900. given as complete and escaped command-line for Apple's standard bash shell:
  15901. @example
  15902. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  15903. @end example
  15904. This example is equivalent to the QRCode example of @ref{coreimage} without the
  15905. need for a nullsrc video source.
  15906. @end itemize
  15907. @section mandelbrot
  15908. Generate a Mandelbrot set fractal, and progressively zoom towards the
  15909. point specified with @var{start_x} and @var{start_y}.
  15910. This source accepts the following options:
  15911. @table @option
  15912. @item end_pts
  15913. Set the terminal pts value. Default value is 400.
  15914. @item end_scale
  15915. Set the terminal scale value.
  15916. Must be a floating point value. Default value is 0.3.
  15917. @item inner
  15918. Set the inner coloring mode, that is the algorithm used to draw the
  15919. Mandelbrot fractal internal region.
  15920. It shall assume one of the following values:
  15921. @table @option
  15922. @item black
  15923. Set black mode.
  15924. @item convergence
  15925. Show time until convergence.
  15926. @item mincol
  15927. Set color based on point closest to the origin of the iterations.
  15928. @item period
  15929. Set period mode.
  15930. @end table
  15931. Default value is @var{mincol}.
  15932. @item bailout
  15933. Set the bailout value. Default value is 10.0.
  15934. @item maxiter
  15935. Set the maximum of iterations performed by the rendering
  15936. algorithm. Default value is 7189.
  15937. @item outer
  15938. Set outer coloring mode.
  15939. It shall assume one of following values:
  15940. @table @option
  15941. @item iteration_count
  15942. Set iteration count mode.
  15943. @item normalized_iteration_count
  15944. set normalized iteration count mode.
  15945. @end table
  15946. Default value is @var{normalized_iteration_count}.
  15947. @item rate, r
  15948. Set frame rate, expressed as number of frames per second. Default
  15949. value is "25".
  15950. @item size, s
  15951. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  15952. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  15953. @item start_scale
  15954. Set the initial scale value. Default value is 3.0.
  15955. @item start_x
  15956. Set the initial x position. Must be a floating point value between
  15957. -100 and 100. Default value is -0.743643887037158704752191506114774.
  15958. @item start_y
  15959. Set the initial y position. Must be a floating point value between
  15960. -100 and 100. Default value is -0.131825904205311970493132056385139.
  15961. @end table
  15962. @section mptestsrc
  15963. Generate various test patterns, as generated by the MPlayer test filter.
  15964. The size of the generated video is fixed, and is 256x256.
  15965. This source is useful in particular for testing encoding features.
  15966. This source accepts the following options:
  15967. @table @option
  15968. @item rate, r
  15969. Specify the frame rate of the sourced video, as the number of frames
  15970. generated per second. It has to be a string in the format
  15971. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15972. number or a valid video frame rate abbreviation. The default value is
  15973. "25".
  15974. @item duration, d
  15975. Set the duration of the sourced video. See
  15976. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15977. for the accepted syntax.
  15978. If not specified, or the expressed duration is negative, the video is
  15979. supposed to be generated forever.
  15980. @item test, t
  15981. Set the number or the name of the test to perform. Supported tests are:
  15982. @table @option
  15983. @item dc_luma
  15984. @item dc_chroma
  15985. @item freq_luma
  15986. @item freq_chroma
  15987. @item amp_luma
  15988. @item amp_chroma
  15989. @item cbp
  15990. @item mv
  15991. @item ring1
  15992. @item ring2
  15993. @item all
  15994. @item max_frames, m
  15995. Set the maximum number of frames generated for each test, default value is 30.
  15996. @end table
  15997. Default value is "all", which will cycle through the list of all tests.
  15998. @end table
  15999. Some examples:
  16000. @example
  16001. mptestsrc=t=dc_luma
  16002. @end example
  16003. will generate a "dc_luma" test pattern.
  16004. @section frei0r_src
  16005. Provide a frei0r source.
  16006. To enable compilation of this filter you need to install the frei0r
  16007. header and configure FFmpeg with @code{--enable-frei0r}.
  16008. This source accepts the following parameters:
  16009. @table @option
  16010. @item size
  16011. The size of the video to generate. For the syntax of this option, check the
  16012. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16013. @item framerate
  16014. The framerate of the generated video. It may be a string of the form
  16015. @var{num}/@var{den} or a frame rate abbreviation.
  16016. @item filter_name
  16017. The name to the frei0r source to load. For more information regarding frei0r and
  16018. how to set the parameters, read the @ref{frei0r} section in the video filters
  16019. documentation.
  16020. @item filter_params
  16021. A '|'-separated list of parameters to pass to the frei0r source.
  16022. @end table
  16023. For example, to generate a frei0r partik0l source with size 200x200
  16024. and frame rate 10 which is overlaid on the overlay filter main input:
  16025. @example
  16026. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  16027. @end example
  16028. @section life
  16029. Generate a life pattern.
  16030. This source is based on a generalization of John Conway's life game.
  16031. The sourced input represents a life grid, each pixel represents a cell
  16032. which can be in one of two possible states, alive or dead. Every cell
  16033. interacts with its eight neighbours, which are the cells that are
  16034. horizontally, vertically, or diagonally adjacent.
  16035. At each interaction the grid evolves according to the adopted rule,
  16036. which specifies the number of neighbor alive cells which will make a
  16037. cell stay alive or born. The @option{rule} option allows one to specify
  16038. the rule to adopt.
  16039. This source accepts the following options:
  16040. @table @option
  16041. @item filename, f
  16042. Set the file from which to read the initial grid state. In the file,
  16043. each non-whitespace character is considered an alive cell, and newline
  16044. is used to delimit the end of each row.
  16045. If this option is not specified, the initial grid is generated
  16046. randomly.
  16047. @item rate, r
  16048. Set the video rate, that is the number of frames generated per second.
  16049. Default is 25.
  16050. @item random_fill_ratio, ratio
  16051. Set the random fill ratio for the initial random grid. It is a
  16052. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  16053. It is ignored when a file is specified.
  16054. @item random_seed, seed
  16055. Set the seed for filling the initial random grid, must be an integer
  16056. included between 0 and UINT32_MAX. If not specified, or if explicitly
  16057. set to -1, the filter will try to use a good random seed on a best
  16058. effort basis.
  16059. @item rule
  16060. Set the life rule.
  16061. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  16062. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  16063. @var{NS} specifies the number of alive neighbor cells which make a
  16064. live cell stay alive, and @var{NB} the number of alive neighbor cells
  16065. which make a dead cell to become alive (i.e. to "born").
  16066. "s" and "b" can be used in place of "S" and "B", respectively.
  16067. Alternatively a rule can be specified by an 18-bits integer. The 9
  16068. high order bits are used to encode the next cell state if it is alive
  16069. for each number of neighbor alive cells, the low order bits specify
  16070. the rule for "borning" new cells. Higher order bits encode for an
  16071. higher number of neighbor cells.
  16072. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  16073. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  16074. Default value is "S23/B3", which is the original Conway's game of life
  16075. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  16076. cells, and will born a new cell if there are three alive cells around
  16077. a dead cell.
  16078. @item size, s
  16079. Set the size of the output video. For the syntax of this option, check the
  16080. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16081. If @option{filename} is specified, the size is set by default to the
  16082. same size of the input file. If @option{size} is set, it must contain
  16083. the size specified in the input file, and the initial grid defined in
  16084. that file is centered in the larger resulting area.
  16085. If a filename is not specified, the size value defaults to "320x240"
  16086. (used for a randomly generated initial grid).
  16087. @item stitch
  16088. If set to 1, stitch the left and right grid edges together, and the
  16089. top and bottom edges also. Defaults to 1.
  16090. @item mold
  16091. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  16092. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  16093. value from 0 to 255.
  16094. @item life_color
  16095. Set the color of living (or new born) cells.
  16096. @item death_color
  16097. Set the color of dead cells. If @option{mold} is set, this is the first color
  16098. used to represent a dead cell.
  16099. @item mold_color
  16100. Set mold color, for definitely dead and moldy cells.
  16101. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  16102. ffmpeg-utils manual,ffmpeg-utils}.
  16103. @end table
  16104. @subsection Examples
  16105. @itemize
  16106. @item
  16107. Read a grid from @file{pattern}, and center it on a grid of size
  16108. 300x300 pixels:
  16109. @example
  16110. life=f=pattern:s=300x300
  16111. @end example
  16112. @item
  16113. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  16114. @example
  16115. life=ratio=2/3:s=200x200
  16116. @end example
  16117. @item
  16118. Specify a custom rule for evolving a randomly generated grid:
  16119. @example
  16120. life=rule=S14/B34
  16121. @end example
  16122. @item
  16123. Full example with slow death effect (mold) using @command{ffplay}:
  16124. @example
  16125. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  16126. @end example
  16127. @end itemize
  16128. @anchor{allrgb}
  16129. @anchor{allyuv}
  16130. @anchor{color}
  16131. @anchor{haldclutsrc}
  16132. @anchor{nullsrc}
  16133. @anchor{pal75bars}
  16134. @anchor{pal100bars}
  16135. @anchor{rgbtestsrc}
  16136. @anchor{smptebars}
  16137. @anchor{smptehdbars}
  16138. @anchor{testsrc}
  16139. @anchor{testsrc2}
  16140. @anchor{yuvtestsrc}
  16141. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  16142. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  16143. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  16144. The @code{color} source provides an uniformly colored input.
  16145. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  16146. @ref{haldclut} filter.
  16147. The @code{nullsrc} source returns unprocessed video frames. It is
  16148. mainly useful to be employed in analysis / debugging tools, or as the
  16149. source for filters which ignore the input data.
  16150. The @code{pal75bars} source generates a color bars pattern, based on
  16151. EBU PAL recommendations with 75% color levels.
  16152. The @code{pal100bars} source generates a color bars pattern, based on
  16153. EBU PAL recommendations with 100% color levels.
  16154. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  16155. detecting RGB vs BGR issues. You should see a red, green and blue
  16156. stripe from top to bottom.
  16157. The @code{smptebars} source generates a color bars pattern, based on
  16158. the SMPTE Engineering Guideline EG 1-1990.
  16159. The @code{smptehdbars} source generates a color bars pattern, based on
  16160. the SMPTE RP 219-2002.
  16161. The @code{testsrc} source generates a test video pattern, showing a
  16162. color pattern, a scrolling gradient and a timestamp. This is mainly
  16163. intended for testing purposes.
  16164. The @code{testsrc2} source is similar to testsrc, but supports more
  16165. pixel formats instead of just @code{rgb24}. This allows using it as an
  16166. input for other tests without requiring a format conversion.
  16167. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  16168. see a y, cb and cr stripe from top to bottom.
  16169. The sources accept the following parameters:
  16170. @table @option
  16171. @item level
  16172. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  16173. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  16174. pixels to be used as identity matrix for 3D lookup tables. Each component is
  16175. coded on a @code{1/(N*N)} scale.
  16176. @item color, c
  16177. Specify the color of the source, only available in the @code{color}
  16178. source. For the syntax of this option, check the
  16179. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16180. @item size, s
  16181. Specify the size of the sourced video. For the syntax of this option, check the
  16182. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16183. The default value is @code{320x240}.
  16184. This option is not available with the @code{allrgb}, @code{allyuv}, and
  16185. @code{haldclutsrc} filters.
  16186. @item rate, r
  16187. Specify the frame rate of the sourced video, as the number of frames
  16188. generated per second. It has to be a string in the format
  16189. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16190. number or a valid video frame rate abbreviation. The default value is
  16191. "25".
  16192. @item duration, d
  16193. Set the duration of the sourced video. See
  16194. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16195. for the accepted syntax.
  16196. If not specified, or the expressed duration is negative, the video is
  16197. supposed to be generated forever.
  16198. @item sar
  16199. Set the sample aspect ratio of the sourced video.
  16200. @item alpha
  16201. Specify the alpha (opacity) of the background, only available in the
  16202. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  16203. 255 (fully opaque, the default).
  16204. @item decimals, n
  16205. Set the number of decimals to show in the timestamp, only available in the
  16206. @code{testsrc} source.
  16207. The displayed timestamp value will correspond to the original
  16208. timestamp value multiplied by the power of 10 of the specified
  16209. value. Default value is 0.
  16210. @end table
  16211. @subsection Examples
  16212. @itemize
  16213. @item
  16214. Generate a video with a duration of 5.3 seconds, with size
  16215. 176x144 and a frame rate of 10 frames per second:
  16216. @example
  16217. testsrc=duration=5.3:size=qcif:rate=10
  16218. @end example
  16219. @item
  16220. The following graph description will generate a red source
  16221. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  16222. frames per second:
  16223. @example
  16224. color=c=red@@0.2:s=qcif:r=10
  16225. @end example
  16226. @item
  16227. If the input content is to be ignored, @code{nullsrc} can be used. The
  16228. following command generates noise in the luminance plane by employing
  16229. the @code{geq} filter:
  16230. @example
  16231. nullsrc=s=256x256, geq=random(1)*255:128:128
  16232. @end example
  16233. @end itemize
  16234. @subsection Commands
  16235. The @code{color} source supports the following commands:
  16236. @table @option
  16237. @item c, color
  16238. Set the color of the created image. Accepts the same syntax of the
  16239. corresponding @option{color} option.
  16240. @end table
  16241. @section openclsrc
  16242. Generate video using an OpenCL program.
  16243. @table @option
  16244. @item source
  16245. OpenCL program source file.
  16246. @item kernel
  16247. Kernel name in program.
  16248. @item size, s
  16249. Size of frames to generate. This must be set.
  16250. @item format
  16251. Pixel format to use for the generated frames. This must be set.
  16252. @item rate, r
  16253. Number of frames generated every second. Default value is '25'.
  16254. @end table
  16255. For details of how the program loading works, see the @ref{program_opencl}
  16256. filter.
  16257. Example programs:
  16258. @itemize
  16259. @item
  16260. Generate a colour ramp by setting pixel values from the position of the pixel
  16261. in the output image. (Note that this will work with all pixel formats, but
  16262. the generated output will not be the same.)
  16263. @verbatim
  16264. __kernel void ramp(__write_only image2d_t dst,
  16265. unsigned int index)
  16266. {
  16267. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16268. float4 val;
  16269. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  16270. write_imagef(dst, loc, val);
  16271. }
  16272. @end verbatim
  16273. @item
  16274. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  16275. @verbatim
  16276. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  16277. unsigned int index)
  16278. {
  16279. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16280. float4 value = 0.0f;
  16281. int x = loc.x + index;
  16282. int y = loc.y + index;
  16283. while (x > 0 || y > 0) {
  16284. if (x % 3 == 1 && y % 3 == 1) {
  16285. value = 1.0f;
  16286. break;
  16287. }
  16288. x /= 3;
  16289. y /= 3;
  16290. }
  16291. write_imagef(dst, loc, value);
  16292. }
  16293. @end verbatim
  16294. @end itemize
  16295. @section sierpinski
  16296. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  16297. This source accepts the following options:
  16298. @table @option
  16299. @item size, s
  16300. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16301. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16302. @item rate, r
  16303. Set frame rate, expressed as number of frames per second. Default
  16304. value is "25".
  16305. @item seed
  16306. Set seed which is used for random panning.
  16307. @item jump
  16308. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  16309. @item type
  16310. Set fractal type, can be default @code{carpet} or @code{triangle}.
  16311. @end table
  16312. @c man end VIDEO SOURCES
  16313. @chapter Video Sinks
  16314. @c man begin VIDEO SINKS
  16315. Below is a description of the currently available video sinks.
  16316. @section buffersink
  16317. Buffer video frames, and make them available to the end of the filter
  16318. graph.
  16319. This sink is mainly intended for programmatic use, in particular
  16320. through the interface defined in @file{libavfilter/buffersink.h}
  16321. or the options system.
  16322. It accepts a pointer to an AVBufferSinkContext structure, which
  16323. defines the incoming buffers' formats, to be passed as the opaque
  16324. parameter to @code{avfilter_init_filter} for initialization.
  16325. @section nullsink
  16326. Null video sink: do absolutely nothing with the input video. It is
  16327. mainly useful as a template and for use in analysis / debugging
  16328. tools.
  16329. @c man end VIDEO SINKS
  16330. @chapter Multimedia Filters
  16331. @c man begin MULTIMEDIA FILTERS
  16332. Below is a description of the currently available multimedia filters.
  16333. @section abitscope
  16334. Convert input audio to a video output, displaying the audio bit scope.
  16335. The filter accepts the following options:
  16336. @table @option
  16337. @item rate, r
  16338. Set frame rate, expressed as number of frames per second. Default
  16339. value is "25".
  16340. @item size, s
  16341. Specify the video size for the output. For the syntax of this option, check the
  16342. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16343. Default value is @code{1024x256}.
  16344. @item colors
  16345. Specify list of colors separated by space or by '|' which will be used to
  16346. draw channels. Unrecognized or missing colors will be replaced
  16347. by white color.
  16348. @end table
  16349. @section ahistogram
  16350. Convert input audio to a video output, displaying the volume histogram.
  16351. The filter accepts the following options:
  16352. @table @option
  16353. @item dmode
  16354. Specify how histogram is calculated.
  16355. It accepts the following values:
  16356. @table @samp
  16357. @item single
  16358. Use single histogram for all channels.
  16359. @item separate
  16360. Use separate histogram for each channel.
  16361. @end table
  16362. Default is @code{single}.
  16363. @item rate, r
  16364. Set frame rate, expressed as number of frames per second. Default
  16365. value is "25".
  16366. @item size, s
  16367. Specify the video size for the output. For the syntax of this option, check the
  16368. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16369. Default value is @code{hd720}.
  16370. @item scale
  16371. Set display scale.
  16372. It accepts the following values:
  16373. @table @samp
  16374. @item log
  16375. logarithmic
  16376. @item sqrt
  16377. square root
  16378. @item cbrt
  16379. cubic root
  16380. @item lin
  16381. linear
  16382. @item rlog
  16383. reverse logarithmic
  16384. @end table
  16385. Default is @code{log}.
  16386. @item ascale
  16387. Set amplitude scale.
  16388. It accepts the following values:
  16389. @table @samp
  16390. @item log
  16391. logarithmic
  16392. @item lin
  16393. linear
  16394. @end table
  16395. Default is @code{log}.
  16396. @item acount
  16397. Set how much frames to accumulate in histogram.
  16398. Default is 1. Setting this to -1 accumulates all frames.
  16399. @item rheight
  16400. Set histogram ratio of window height.
  16401. @item slide
  16402. Set sonogram sliding.
  16403. It accepts the following values:
  16404. @table @samp
  16405. @item replace
  16406. replace old rows with new ones.
  16407. @item scroll
  16408. scroll from top to bottom.
  16409. @end table
  16410. Default is @code{replace}.
  16411. @end table
  16412. @section aphasemeter
  16413. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  16414. representing mean phase of current audio frame. A video output can also be produced and is
  16415. enabled by default. The audio is passed through as first output.
  16416. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  16417. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  16418. and @code{1} means channels are in phase.
  16419. The filter accepts the following options, all related to its video output:
  16420. @table @option
  16421. @item rate, r
  16422. Set the output frame rate. Default value is @code{25}.
  16423. @item size, s
  16424. Set the video size for the output. For the syntax of this option, check the
  16425. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16426. Default value is @code{800x400}.
  16427. @item rc
  16428. @item gc
  16429. @item bc
  16430. Specify the red, green, blue contrast. Default values are @code{2},
  16431. @code{7} and @code{1}.
  16432. Allowed range is @code{[0, 255]}.
  16433. @item mpc
  16434. Set color which will be used for drawing median phase. If color is
  16435. @code{none} which is default, no median phase value will be drawn.
  16436. @item video
  16437. Enable video output. Default is enabled.
  16438. @end table
  16439. @section avectorscope
  16440. Convert input audio to a video output, representing the audio vector
  16441. scope.
  16442. The filter is used to measure the difference between channels of stereo
  16443. audio stream. A monaural signal, consisting of identical left and right
  16444. signal, results in straight vertical line. Any stereo separation is visible
  16445. as a deviation from this line, creating a Lissajous figure.
  16446. If the straight (or deviation from it) but horizontal line appears this
  16447. indicates that the left and right channels are out of phase.
  16448. The filter accepts the following options:
  16449. @table @option
  16450. @item mode, m
  16451. Set the vectorscope mode.
  16452. Available values are:
  16453. @table @samp
  16454. @item lissajous
  16455. Lissajous rotated by 45 degrees.
  16456. @item lissajous_xy
  16457. Same as above but not rotated.
  16458. @item polar
  16459. Shape resembling half of circle.
  16460. @end table
  16461. Default value is @samp{lissajous}.
  16462. @item size, s
  16463. Set the video size for the output. For the syntax of this option, check the
  16464. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16465. Default value is @code{400x400}.
  16466. @item rate, r
  16467. Set the output frame rate. Default value is @code{25}.
  16468. @item rc
  16469. @item gc
  16470. @item bc
  16471. @item ac
  16472. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  16473. @code{160}, @code{80} and @code{255}.
  16474. Allowed range is @code{[0, 255]}.
  16475. @item rf
  16476. @item gf
  16477. @item bf
  16478. @item af
  16479. Specify the red, green, blue and alpha fade. Default values are @code{15},
  16480. @code{10}, @code{5} and @code{5}.
  16481. Allowed range is @code{[0, 255]}.
  16482. @item zoom
  16483. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  16484. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  16485. @item draw
  16486. Set the vectorscope drawing mode.
  16487. Available values are:
  16488. @table @samp
  16489. @item dot
  16490. Draw dot for each sample.
  16491. @item line
  16492. Draw line between previous and current sample.
  16493. @end table
  16494. Default value is @samp{dot}.
  16495. @item scale
  16496. Specify amplitude scale of audio samples.
  16497. Available values are:
  16498. @table @samp
  16499. @item lin
  16500. Linear.
  16501. @item sqrt
  16502. Square root.
  16503. @item cbrt
  16504. Cubic root.
  16505. @item log
  16506. Logarithmic.
  16507. @end table
  16508. @item swap
  16509. Swap left channel axis with right channel axis.
  16510. @item mirror
  16511. Mirror axis.
  16512. @table @samp
  16513. @item none
  16514. No mirror.
  16515. @item x
  16516. Mirror only x axis.
  16517. @item y
  16518. Mirror only y axis.
  16519. @item xy
  16520. Mirror both axis.
  16521. @end table
  16522. @end table
  16523. @subsection Examples
  16524. @itemize
  16525. @item
  16526. Complete example using @command{ffplay}:
  16527. @example
  16528. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16529. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  16530. @end example
  16531. @end itemize
  16532. @section bench, abench
  16533. Benchmark part of a filtergraph.
  16534. The filter accepts the following options:
  16535. @table @option
  16536. @item action
  16537. Start or stop a timer.
  16538. Available values are:
  16539. @table @samp
  16540. @item start
  16541. Get the current time, set it as frame metadata (using the key
  16542. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  16543. @item stop
  16544. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  16545. the input frame metadata to get the time difference. Time difference, average,
  16546. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  16547. @code{min}) are then printed. The timestamps are expressed in seconds.
  16548. @end table
  16549. @end table
  16550. @subsection Examples
  16551. @itemize
  16552. @item
  16553. Benchmark @ref{selectivecolor} filter:
  16554. @example
  16555. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  16556. @end example
  16557. @end itemize
  16558. @section concat
  16559. Concatenate audio and video streams, joining them together one after the
  16560. other.
  16561. The filter works on segments of synchronized video and audio streams. All
  16562. segments must have the same number of streams of each type, and that will
  16563. also be the number of streams at output.
  16564. The filter accepts the following options:
  16565. @table @option
  16566. @item n
  16567. Set the number of segments. Default is 2.
  16568. @item v
  16569. Set the number of output video streams, that is also the number of video
  16570. streams in each segment. Default is 1.
  16571. @item a
  16572. Set the number of output audio streams, that is also the number of audio
  16573. streams in each segment. Default is 0.
  16574. @item unsafe
  16575. Activate unsafe mode: do not fail if segments have a different format.
  16576. @end table
  16577. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  16578. @var{a} audio outputs.
  16579. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  16580. segment, in the same order as the outputs, then the inputs for the second
  16581. segment, etc.
  16582. Related streams do not always have exactly the same duration, for various
  16583. reasons including codec frame size or sloppy authoring. For that reason,
  16584. related synchronized streams (e.g. a video and its audio track) should be
  16585. concatenated at once. The concat filter will use the duration of the longest
  16586. stream in each segment (except the last one), and if necessary pad shorter
  16587. audio streams with silence.
  16588. For this filter to work correctly, all segments must start at timestamp 0.
  16589. All corresponding streams must have the same parameters in all segments; the
  16590. filtering system will automatically select a common pixel format for video
  16591. streams, and a common sample format, sample rate and channel layout for
  16592. audio streams, but other settings, such as resolution, must be converted
  16593. explicitly by the user.
  16594. Different frame rates are acceptable but will result in variable frame rate
  16595. at output; be sure to configure the output file to handle it.
  16596. @subsection Examples
  16597. @itemize
  16598. @item
  16599. Concatenate an opening, an episode and an ending, all in bilingual version
  16600. (video in stream 0, audio in streams 1 and 2):
  16601. @example
  16602. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  16603. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  16604. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  16605. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  16606. @end example
  16607. @item
  16608. Concatenate two parts, handling audio and video separately, using the
  16609. (a)movie sources, and adjusting the resolution:
  16610. @example
  16611. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  16612. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  16613. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  16614. @end example
  16615. Note that a desync will happen at the stitch if the audio and video streams
  16616. do not have exactly the same duration in the first file.
  16617. @end itemize
  16618. @subsection Commands
  16619. This filter supports the following commands:
  16620. @table @option
  16621. @item next
  16622. Close the current segment and step to the next one
  16623. @end table
  16624. @section drawgraph, adrawgraph
  16625. Draw a graph using input video or audio metadata.
  16626. It accepts the following parameters:
  16627. @table @option
  16628. @item m1
  16629. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  16630. @item fg1
  16631. Set 1st foreground color expression.
  16632. @item m2
  16633. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  16634. @item fg2
  16635. Set 2nd foreground color expression.
  16636. @item m3
  16637. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  16638. @item fg3
  16639. Set 3rd foreground color expression.
  16640. @item m4
  16641. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  16642. @item fg4
  16643. Set 4th foreground color expression.
  16644. @item min
  16645. Set minimal value of metadata value.
  16646. @item max
  16647. Set maximal value of metadata value.
  16648. @item bg
  16649. Set graph background color. Default is white.
  16650. @item mode
  16651. Set graph mode.
  16652. Available values for mode is:
  16653. @table @samp
  16654. @item bar
  16655. @item dot
  16656. @item line
  16657. @end table
  16658. Default is @code{line}.
  16659. @item slide
  16660. Set slide mode.
  16661. Available values for slide is:
  16662. @table @samp
  16663. @item frame
  16664. Draw new frame when right border is reached.
  16665. @item replace
  16666. Replace old columns with new ones.
  16667. @item scroll
  16668. Scroll from right to left.
  16669. @item rscroll
  16670. Scroll from left to right.
  16671. @item picture
  16672. Draw single picture.
  16673. @end table
  16674. Default is @code{frame}.
  16675. @item size
  16676. Set size of graph video. For the syntax of this option, check the
  16677. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16678. The default value is @code{900x256}.
  16679. The foreground color expressions can use the following variables:
  16680. @table @option
  16681. @item MIN
  16682. Minimal value of metadata value.
  16683. @item MAX
  16684. Maximal value of metadata value.
  16685. @item VAL
  16686. Current metadata key value.
  16687. @end table
  16688. The color is defined as 0xAABBGGRR.
  16689. @end table
  16690. Example using metadata from @ref{signalstats} filter:
  16691. @example
  16692. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  16693. @end example
  16694. Example using metadata from @ref{ebur128} filter:
  16695. @example
  16696. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  16697. @end example
  16698. @anchor{ebur128}
  16699. @section ebur128
  16700. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  16701. level. By default, it logs a message at a frequency of 10Hz with the
  16702. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  16703. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  16704. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  16705. sample format is double-precision floating point. The input stream will be converted to
  16706. this specification, if needed. Users may need to insert aformat and/or aresample filters
  16707. after this filter to obtain the original parameters.
  16708. The filter also has a video output (see the @var{video} option) with a real
  16709. time graph to observe the loudness evolution. The graphic contains the logged
  16710. message mentioned above, so it is not printed anymore when this option is set,
  16711. unless the verbose logging is set. The main graphing area contains the
  16712. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  16713. the momentary loudness (400 milliseconds), but can optionally be configured
  16714. to instead display short-term loudness (see @var{gauge}).
  16715. The green area marks a +/- 1LU target range around the target loudness
  16716. (-23LUFS by default, unless modified through @var{target}).
  16717. More information about the Loudness Recommendation EBU R128 on
  16718. @url{http://tech.ebu.ch/loudness}.
  16719. The filter accepts the following options:
  16720. @table @option
  16721. @item video
  16722. Activate the video output. The audio stream is passed unchanged whether this
  16723. option is set or no. The video stream will be the first output stream if
  16724. activated. Default is @code{0}.
  16725. @item size
  16726. Set the video size. This option is for video only. For the syntax of this
  16727. option, check the
  16728. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16729. Default and minimum resolution is @code{640x480}.
  16730. @item meter
  16731. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  16732. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  16733. other integer value between this range is allowed.
  16734. @item metadata
  16735. Set metadata injection. If set to @code{1}, the audio input will be segmented
  16736. into 100ms output frames, each of them containing various loudness information
  16737. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  16738. Default is @code{0}.
  16739. @item framelog
  16740. Force the frame logging level.
  16741. Available values are:
  16742. @table @samp
  16743. @item info
  16744. information logging level
  16745. @item verbose
  16746. verbose logging level
  16747. @end table
  16748. By default, the logging level is set to @var{info}. If the @option{video} or
  16749. the @option{metadata} options are set, it switches to @var{verbose}.
  16750. @item peak
  16751. Set peak mode(s).
  16752. Available modes can be cumulated (the option is a @code{flag} type). Possible
  16753. values are:
  16754. @table @samp
  16755. @item none
  16756. Disable any peak mode (default).
  16757. @item sample
  16758. Enable sample-peak mode.
  16759. Simple peak mode looking for the higher sample value. It logs a message
  16760. for sample-peak (identified by @code{SPK}).
  16761. @item true
  16762. Enable true-peak mode.
  16763. If enabled, the peak lookup is done on an over-sampled version of the input
  16764. stream for better peak accuracy. It logs a message for true-peak.
  16765. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  16766. This mode requires a build with @code{libswresample}.
  16767. @end table
  16768. @item dualmono
  16769. Treat mono input files as "dual mono". If a mono file is intended for playback
  16770. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  16771. If set to @code{true}, this option will compensate for this effect.
  16772. Multi-channel input files are not affected by this option.
  16773. @item panlaw
  16774. Set a specific pan law to be used for the measurement of dual mono files.
  16775. This parameter is optional, and has a default value of -3.01dB.
  16776. @item target
  16777. Set a specific target level (in LUFS) used as relative zero in the visualization.
  16778. This parameter is optional and has a default value of -23LUFS as specified
  16779. by EBU R128. However, material published online may prefer a level of -16LUFS
  16780. (e.g. for use with podcasts or video platforms).
  16781. @item gauge
  16782. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  16783. @code{shortterm}. By default the momentary value will be used, but in certain
  16784. scenarios it may be more useful to observe the short term value instead (e.g.
  16785. live mixing).
  16786. @item scale
  16787. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  16788. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  16789. video output, not the summary or continuous log output.
  16790. @end table
  16791. @subsection Examples
  16792. @itemize
  16793. @item
  16794. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  16795. @example
  16796. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  16797. @end example
  16798. @item
  16799. Run an analysis with @command{ffmpeg}:
  16800. @example
  16801. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  16802. @end example
  16803. @end itemize
  16804. @section interleave, ainterleave
  16805. Temporally interleave frames from several inputs.
  16806. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  16807. These filters read frames from several inputs and send the oldest
  16808. queued frame to the output.
  16809. Input streams must have well defined, monotonically increasing frame
  16810. timestamp values.
  16811. In order to submit one frame to output, these filters need to enqueue
  16812. at least one frame for each input, so they cannot work in case one
  16813. input is not yet terminated and will not receive incoming frames.
  16814. For example consider the case when one input is a @code{select} filter
  16815. which always drops input frames. The @code{interleave} filter will keep
  16816. reading from that input, but it will never be able to send new frames
  16817. to output until the input sends an end-of-stream signal.
  16818. Also, depending on inputs synchronization, the filters will drop
  16819. frames in case one input receives more frames than the other ones, and
  16820. the queue is already filled.
  16821. These filters accept the following options:
  16822. @table @option
  16823. @item nb_inputs, n
  16824. Set the number of different inputs, it is 2 by default.
  16825. @end table
  16826. @subsection Examples
  16827. @itemize
  16828. @item
  16829. Interleave frames belonging to different streams using @command{ffmpeg}:
  16830. @example
  16831. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  16832. @end example
  16833. @item
  16834. Add flickering blur effect:
  16835. @example
  16836. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  16837. @end example
  16838. @end itemize
  16839. @section metadata, ametadata
  16840. Manipulate frame metadata.
  16841. This filter accepts the following options:
  16842. @table @option
  16843. @item mode
  16844. Set mode of operation of the filter.
  16845. Can be one of the following:
  16846. @table @samp
  16847. @item select
  16848. If both @code{value} and @code{key} is set, select frames
  16849. which have such metadata. If only @code{key} is set, select
  16850. every frame that has such key in metadata.
  16851. @item add
  16852. Add new metadata @code{key} and @code{value}. If key is already available
  16853. do nothing.
  16854. @item modify
  16855. Modify value of already present key.
  16856. @item delete
  16857. If @code{value} is set, delete only keys that have such value.
  16858. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  16859. the frame.
  16860. @item print
  16861. Print key and its value if metadata was found. If @code{key} is not set print all
  16862. metadata values available in frame.
  16863. @end table
  16864. @item key
  16865. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  16866. @item value
  16867. Set metadata value which will be used. This option is mandatory for
  16868. @code{modify} and @code{add} mode.
  16869. @item function
  16870. Which function to use when comparing metadata value and @code{value}.
  16871. Can be one of following:
  16872. @table @samp
  16873. @item same_str
  16874. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  16875. @item starts_with
  16876. Values are interpreted as strings, returns true if metadata value starts with
  16877. the @code{value} option string.
  16878. @item less
  16879. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  16880. @item equal
  16881. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  16882. @item greater
  16883. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  16884. @item expr
  16885. Values are interpreted as floats, returns true if expression from option @code{expr}
  16886. evaluates to true.
  16887. @item ends_with
  16888. Values are interpreted as strings, returns true if metadata value ends with
  16889. the @code{value} option string.
  16890. @end table
  16891. @item expr
  16892. Set expression which is used when @code{function} is set to @code{expr}.
  16893. The expression is evaluated through the eval API and can contain the following
  16894. constants:
  16895. @table @option
  16896. @item VALUE1
  16897. Float representation of @code{value} from metadata key.
  16898. @item VALUE2
  16899. Float representation of @code{value} as supplied by user in @code{value} option.
  16900. @end table
  16901. @item file
  16902. If specified in @code{print} mode, output is written to the named file. Instead of
  16903. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  16904. for standard output. If @code{file} option is not set, output is written to the log
  16905. with AV_LOG_INFO loglevel.
  16906. @end table
  16907. @subsection Examples
  16908. @itemize
  16909. @item
  16910. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  16911. between 0 and 1.
  16912. @example
  16913. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  16914. @end example
  16915. @item
  16916. Print silencedetect output to file @file{metadata.txt}.
  16917. @example
  16918. silencedetect,ametadata=mode=print:file=metadata.txt
  16919. @end example
  16920. @item
  16921. Direct all metadata to a pipe with file descriptor 4.
  16922. @example
  16923. metadata=mode=print:file='pipe\:4'
  16924. @end example
  16925. @end itemize
  16926. @section perms, aperms
  16927. Set read/write permissions for the output frames.
  16928. These filters are mainly aimed at developers to test direct path in the
  16929. following filter in the filtergraph.
  16930. The filters accept the following options:
  16931. @table @option
  16932. @item mode
  16933. Select the permissions mode.
  16934. It accepts the following values:
  16935. @table @samp
  16936. @item none
  16937. Do nothing. This is the default.
  16938. @item ro
  16939. Set all the output frames read-only.
  16940. @item rw
  16941. Set all the output frames directly writable.
  16942. @item toggle
  16943. Make the frame read-only if writable, and writable if read-only.
  16944. @item random
  16945. Set each output frame read-only or writable randomly.
  16946. @end table
  16947. @item seed
  16948. Set the seed for the @var{random} mode, must be an integer included between
  16949. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  16950. @code{-1}, the filter will try to use a good random seed on a best effort
  16951. basis.
  16952. @end table
  16953. Note: in case of auto-inserted filter between the permission filter and the
  16954. following one, the permission might not be received as expected in that
  16955. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  16956. perms/aperms filter can avoid this problem.
  16957. @section realtime, arealtime
  16958. Slow down filtering to match real time approximately.
  16959. These filters will pause the filtering for a variable amount of time to
  16960. match the output rate with the input timestamps.
  16961. They are similar to the @option{re} option to @code{ffmpeg}.
  16962. They accept the following options:
  16963. @table @option
  16964. @item limit
  16965. Time limit for the pauses. Any pause longer than that will be considered
  16966. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  16967. @item speed
  16968. Speed factor for processing. The value must be a float larger than zero.
  16969. Values larger than 1.0 will result in faster than realtime processing,
  16970. smaller will slow processing down. The @var{limit} is automatically adapted
  16971. accordingly. Default is 1.0.
  16972. A processing speed faster than what is possible without these filters cannot
  16973. be achieved.
  16974. @end table
  16975. @anchor{select}
  16976. @section select, aselect
  16977. Select frames to pass in output.
  16978. This filter accepts the following options:
  16979. @table @option
  16980. @item expr, e
  16981. Set expression, which is evaluated for each input frame.
  16982. If the expression is evaluated to zero, the frame is discarded.
  16983. If the evaluation result is negative or NaN, the frame is sent to the
  16984. first output; otherwise it is sent to the output with index
  16985. @code{ceil(val)-1}, assuming that the input index starts from 0.
  16986. For example a value of @code{1.2} corresponds to the output with index
  16987. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  16988. @item outputs, n
  16989. Set the number of outputs. The output to which to send the selected
  16990. frame is based on the result of the evaluation. Default value is 1.
  16991. @end table
  16992. The expression can contain the following constants:
  16993. @table @option
  16994. @item n
  16995. The (sequential) number of the filtered frame, starting from 0.
  16996. @item selected_n
  16997. The (sequential) number of the selected frame, starting from 0.
  16998. @item prev_selected_n
  16999. The sequential number of the last selected frame. It's NAN if undefined.
  17000. @item TB
  17001. The timebase of the input timestamps.
  17002. @item pts
  17003. The PTS (Presentation TimeStamp) of the filtered video frame,
  17004. expressed in @var{TB} units. It's NAN if undefined.
  17005. @item t
  17006. The PTS of the filtered video frame,
  17007. expressed in seconds. It's NAN if undefined.
  17008. @item prev_pts
  17009. The PTS of the previously filtered video frame. It's NAN if undefined.
  17010. @item prev_selected_pts
  17011. The PTS of the last previously filtered video frame. It's NAN if undefined.
  17012. @item prev_selected_t
  17013. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  17014. @item start_pts
  17015. The PTS of the first video frame in the video. It's NAN if undefined.
  17016. @item start_t
  17017. The time of the first video frame in the video. It's NAN if undefined.
  17018. @item pict_type @emph{(video only)}
  17019. The type of the filtered frame. It can assume one of the following
  17020. values:
  17021. @table @option
  17022. @item I
  17023. @item P
  17024. @item B
  17025. @item S
  17026. @item SI
  17027. @item SP
  17028. @item BI
  17029. @end table
  17030. @item interlace_type @emph{(video only)}
  17031. The frame interlace type. It can assume one of the following values:
  17032. @table @option
  17033. @item PROGRESSIVE
  17034. The frame is progressive (not interlaced).
  17035. @item TOPFIRST
  17036. The frame is top-field-first.
  17037. @item BOTTOMFIRST
  17038. The frame is bottom-field-first.
  17039. @end table
  17040. @item consumed_sample_n @emph{(audio only)}
  17041. the number of selected samples before the current frame
  17042. @item samples_n @emph{(audio only)}
  17043. the number of samples in the current frame
  17044. @item sample_rate @emph{(audio only)}
  17045. the input sample rate
  17046. @item key
  17047. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  17048. @item pos
  17049. the position in the file of the filtered frame, -1 if the information
  17050. is not available (e.g. for synthetic video)
  17051. @item scene @emph{(video only)}
  17052. value between 0 and 1 to indicate a new scene; a low value reflects a low
  17053. probability for the current frame to introduce a new scene, while a higher
  17054. value means the current frame is more likely to be one (see the example below)
  17055. @item concatdec_select
  17056. The concat demuxer can select only part of a concat input file by setting an
  17057. inpoint and an outpoint, but the output packets may not be entirely contained
  17058. in the selected interval. By using this variable, it is possible to skip frames
  17059. generated by the concat demuxer which are not exactly contained in the selected
  17060. interval.
  17061. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  17062. and the @var{lavf.concat.duration} packet metadata values which are also
  17063. present in the decoded frames.
  17064. The @var{concatdec_select} variable is -1 if the frame pts is at least
  17065. start_time and either the duration metadata is missing or the frame pts is less
  17066. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  17067. missing.
  17068. That basically means that an input frame is selected if its pts is within the
  17069. interval set by the concat demuxer.
  17070. @end table
  17071. The default value of the select expression is "1".
  17072. @subsection Examples
  17073. @itemize
  17074. @item
  17075. Select all frames in input:
  17076. @example
  17077. select
  17078. @end example
  17079. The example above is the same as:
  17080. @example
  17081. select=1
  17082. @end example
  17083. @item
  17084. Skip all frames:
  17085. @example
  17086. select=0
  17087. @end example
  17088. @item
  17089. Select only I-frames:
  17090. @example
  17091. select='eq(pict_type\,I)'
  17092. @end example
  17093. @item
  17094. Select one frame every 100:
  17095. @example
  17096. select='not(mod(n\,100))'
  17097. @end example
  17098. @item
  17099. Select only frames contained in the 10-20 time interval:
  17100. @example
  17101. select=between(t\,10\,20)
  17102. @end example
  17103. @item
  17104. Select only I-frames contained in the 10-20 time interval:
  17105. @example
  17106. select=between(t\,10\,20)*eq(pict_type\,I)
  17107. @end example
  17108. @item
  17109. Select frames with a minimum distance of 10 seconds:
  17110. @example
  17111. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  17112. @end example
  17113. @item
  17114. Use aselect to select only audio frames with samples number > 100:
  17115. @example
  17116. aselect='gt(samples_n\,100)'
  17117. @end example
  17118. @item
  17119. Create a mosaic of the first scenes:
  17120. @example
  17121. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  17122. @end example
  17123. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  17124. choice.
  17125. @item
  17126. Send even and odd frames to separate outputs, and compose them:
  17127. @example
  17128. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  17129. @end example
  17130. @item
  17131. Select useful frames from an ffconcat file which is using inpoints and
  17132. outpoints but where the source files are not intra frame only.
  17133. @example
  17134. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  17135. @end example
  17136. @end itemize
  17137. @section sendcmd, asendcmd
  17138. Send commands to filters in the filtergraph.
  17139. These filters read commands to be sent to other filters in the
  17140. filtergraph.
  17141. @code{sendcmd} must be inserted between two video filters,
  17142. @code{asendcmd} must be inserted between two audio filters, but apart
  17143. from that they act the same way.
  17144. The specification of commands can be provided in the filter arguments
  17145. with the @var{commands} option, or in a file specified by the
  17146. @var{filename} option.
  17147. These filters accept the following options:
  17148. @table @option
  17149. @item commands, c
  17150. Set the commands to be read and sent to the other filters.
  17151. @item filename, f
  17152. Set the filename of the commands to be read and sent to the other
  17153. filters.
  17154. @end table
  17155. @subsection Commands syntax
  17156. A commands description consists of a sequence of interval
  17157. specifications, comprising a list of commands to be executed when a
  17158. particular event related to that interval occurs. The occurring event
  17159. is typically the current frame time entering or leaving a given time
  17160. interval.
  17161. An interval is specified by the following syntax:
  17162. @example
  17163. @var{START}[-@var{END}] @var{COMMANDS};
  17164. @end example
  17165. The time interval is specified by the @var{START} and @var{END} times.
  17166. @var{END} is optional and defaults to the maximum time.
  17167. The current frame time is considered within the specified interval if
  17168. it is included in the interval [@var{START}, @var{END}), that is when
  17169. the time is greater or equal to @var{START} and is lesser than
  17170. @var{END}.
  17171. @var{COMMANDS} consists of a sequence of one or more command
  17172. specifications, separated by ",", relating to that interval. The
  17173. syntax of a command specification is given by:
  17174. @example
  17175. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  17176. @end example
  17177. @var{FLAGS} is optional and specifies the type of events relating to
  17178. the time interval which enable sending the specified command, and must
  17179. be a non-null sequence of identifier flags separated by "+" or "|" and
  17180. enclosed between "[" and "]".
  17181. The following flags are recognized:
  17182. @table @option
  17183. @item enter
  17184. The command is sent when the current frame timestamp enters the
  17185. specified interval. In other words, the command is sent when the
  17186. previous frame timestamp was not in the given interval, and the
  17187. current is.
  17188. @item leave
  17189. The command is sent when the current frame timestamp leaves the
  17190. specified interval. In other words, the command is sent when the
  17191. previous frame timestamp was in the given interval, and the
  17192. current is not.
  17193. @end table
  17194. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  17195. assumed.
  17196. @var{TARGET} specifies the target of the command, usually the name of
  17197. the filter class or a specific filter instance name.
  17198. @var{COMMAND} specifies the name of the command for the target filter.
  17199. @var{ARG} is optional and specifies the optional list of argument for
  17200. the given @var{COMMAND}.
  17201. Between one interval specification and another, whitespaces, or
  17202. sequences of characters starting with @code{#} until the end of line,
  17203. are ignored and can be used to annotate comments.
  17204. A simplified BNF description of the commands specification syntax
  17205. follows:
  17206. @example
  17207. @var{COMMAND_FLAG} ::= "enter" | "leave"
  17208. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  17209. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  17210. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  17211. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  17212. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  17213. @end example
  17214. @subsection Examples
  17215. @itemize
  17216. @item
  17217. Specify audio tempo change at second 4:
  17218. @example
  17219. asendcmd=c='4.0 atempo tempo 1.5',atempo
  17220. @end example
  17221. @item
  17222. Target a specific filter instance:
  17223. @example
  17224. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  17225. @end example
  17226. @item
  17227. Specify a list of drawtext and hue commands in a file.
  17228. @example
  17229. # show text in the interval 5-10
  17230. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  17231. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  17232. # desaturate the image in the interval 15-20
  17233. 15.0-20.0 [enter] hue s 0,
  17234. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  17235. [leave] hue s 1,
  17236. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  17237. # apply an exponential saturation fade-out effect, starting from time 25
  17238. 25 [enter] hue s exp(25-t)
  17239. @end example
  17240. A filtergraph allowing to read and process the above command list
  17241. stored in a file @file{test.cmd}, can be specified with:
  17242. @example
  17243. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  17244. @end example
  17245. @end itemize
  17246. @anchor{setpts}
  17247. @section setpts, asetpts
  17248. Change the PTS (presentation timestamp) of the input frames.
  17249. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  17250. This filter accepts the following options:
  17251. @table @option
  17252. @item expr
  17253. The expression which is evaluated for each frame to construct its timestamp.
  17254. @end table
  17255. The expression is evaluated through the eval API and can contain the following
  17256. constants:
  17257. @table @option
  17258. @item FRAME_RATE, FR
  17259. frame rate, only defined for constant frame-rate video
  17260. @item PTS
  17261. The presentation timestamp in input
  17262. @item N
  17263. The count of the input frame for video or the number of consumed samples,
  17264. not including the current frame for audio, starting from 0.
  17265. @item NB_CONSUMED_SAMPLES
  17266. The number of consumed samples, not including the current frame (only
  17267. audio)
  17268. @item NB_SAMPLES, S
  17269. The number of samples in the current frame (only audio)
  17270. @item SAMPLE_RATE, SR
  17271. The audio sample rate.
  17272. @item STARTPTS
  17273. The PTS of the first frame.
  17274. @item STARTT
  17275. the time in seconds of the first frame
  17276. @item INTERLACED
  17277. State whether the current frame is interlaced.
  17278. @item T
  17279. the time in seconds of the current frame
  17280. @item POS
  17281. original position in the file of the frame, or undefined if undefined
  17282. for the current frame
  17283. @item PREV_INPTS
  17284. The previous input PTS.
  17285. @item PREV_INT
  17286. previous input time in seconds
  17287. @item PREV_OUTPTS
  17288. The previous output PTS.
  17289. @item PREV_OUTT
  17290. previous output time in seconds
  17291. @item RTCTIME
  17292. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  17293. instead.
  17294. @item RTCSTART
  17295. The wallclock (RTC) time at the start of the movie in microseconds.
  17296. @item TB
  17297. The timebase of the input timestamps.
  17298. @end table
  17299. @subsection Examples
  17300. @itemize
  17301. @item
  17302. Start counting PTS from zero
  17303. @example
  17304. setpts=PTS-STARTPTS
  17305. @end example
  17306. @item
  17307. Apply fast motion effect:
  17308. @example
  17309. setpts=0.5*PTS
  17310. @end example
  17311. @item
  17312. Apply slow motion effect:
  17313. @example
  17314. setpts=2.0*PTS
  17315. @end example
  17316. @item
  17317. Set fixed rate of 25 frames per second:
  17318. @example
  17319. setpts=N/(25*TB)
  17320. @end example
  17321. @item
  17322. Set fixed rate 25 fps with some jitter:
  17323. @example
  17324. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  17325. @end example
  17326. @item
  17327. Apply an offset of 10 seconds to the input PTS:
  17328. @example
  17329. setpts=PTS+10/TB
  17330. @end example
  17331. @item
  17332. Generate timestamps from a "live source" and rebase onto the current timebase:
  17333. @example
  17334. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  17335. @end example
  17336. @item
  17337. Generate timestamps by counting samples:
  17338. @example
  17339. asetpts=N/SR/TB
  17340. @end example
  17341. @end itemize
  17342. @section setrange
  17343. Force color range for the output video frame.
  17344. The @code{setrange} filter marks the color range property for the
  17345. output frames. It does not change the input frame, but only sets the
  17346. corresponding property, which affects how the frame is treated by
  17347. following filters.
  17348. The filter accepts the following options:
  17349. @table @option
  17350. @item range
  17351. Available values are:
  17352. @table @samp
  17353. @item auto
  17354. Keep the same color range property.
  17355. @item unspecified, unknown
  17356. Set the color range as unspecified.
  17357. @item limited, tv, mpeg
  17358. Set the color range as limited.
  17359. @item full, pc, jpeg
  17360. Set the color range as full.
  17361. @end table
  17362. @end table
  17363. @section settb, asettb
  17364. Set the timebase to use for the output frames timestamps.
  17365. It is mainly useful for testing timebase configuration.
  17366. It accepts the following parameters:
  17367. @table @option
  17368. @item expr, tb
  17369. The expression which is evaluated into the output timebase.
  17370. @end table
  17371. The value for @option{tb} is an arithmetic expression representing a
  17372. rational. The expression can contain the constants "AVTB" (the default
  17373. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  17374. audio only). Default value is "intb".
  17375. @subsection Examples
  17376. @itemize
  17377. @item
  17378. Set the timebase to 1/25:
  17379. @example
  17380. settb=expr=1/25
  17381. @end example
  17382. @item
  17383. Set the timebase to 1/10:
  17384. @example
  17385. settb=expr=0.1
  17386. @end example
  17387. @item
  17388. Set the timebase to 1001/1000:
  17389. @example
  17390. settb=1+0.001
  17391. @end example
  17392. @item
  17393. Set the timebase to 2*intb:
  17394. @example
  17395. settb=2*intb
  17396. @end example
  17397. @item
  17398. Set the default timebase value:
  17399. @example
  17400. settb=AVTB
  17401. @end example
  17402. @end itemize
  17403. @section showcqt
  17404. Convert input audio to a video output representing frequency spectrum
  17405. logarithmically using Brown-Puckette constant Q transform algorithm with
  17406. direct frequency domain coefficient calculation (but the transform itself
  17407. is not really constant Q, instead the Q factor is actually variable/clamped),
  17408. with musical tone scale, from E0 to D#10.
  17409. The filter accepts the following options:
  17410. @table @option
  17411. @item size, s
  17412. Specify the video size for the output. It must be even. For the syntax of this option,
  17413. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17414. Default value is @code{1920x1080}.
  17415. @item fps, rate, r
  17416. Set the output frame rate. Default value is @code{25}.
  17417. @item bar_h
  17418. Set the bargraph height. It must be even. Default value is @code{-1} which
  17419. computes the bargraph height automatically.
  17420. @item axis_h
  17421. Set the axis height. It must be even. Default value is @code{-1} which computes
  17422. the axis height automatically.
  17423. @item sono_h
  17424. Set the sonogram height. It must be even. Default value is @code{-1} which
  17425. computes the sonogram height automatically.
  17426. @item fullhd
  17427. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  17428. instead. Default value is @code{1}.
  17429. @item sono_v, volume
  17430. Specify the sonogram volume expression. It can contain variables:
  17431. @table @option
  17432. @item bar_v
  17433. the @var{bar_v} evaluated expression
  17434. @item frequency, freq, f
  17435. the frequency where it is evaluated
  17436. @item timeclamp, tc
  17437. the value of @var{timeclamp} option
  17438. @end table
  17439. and functions:
  17440. @table @option
  17441. @item a_weighting(f)
  17442. A-weighting of equal loudness
  17443. @item b_weighting(f)
  17444. B-weighting of equal loudness
  17445. @item c_weighting(f)
  17446. C-weighting of equal loudness.
  17447. @end table
  17448. Default value is @code{16}.
  17449. @item bar_v, volume2
  17450. Specify the bargraph volume expression. It can contain variables:
  17451. @table @option
  17452. @item sono_v
  17453. the @var{sono_v} evaluated expression
  17454. @item frequency, freq, f
  17455. the frequency where it is evaluated
  17456. @item timeclamp, tc
  17457. the value of @var{timeclamp} option
  17458. @end table
  17459. and functions:
  17460. @table @option
  17461. @item a_weighting(f)
  17462. A-weighting of equal loudness
  17463. @item b_weighting(f)
  17464. B-weighting of equal loudness
  17465. @item c_weighting(f)
  17466. C-weighting of equal loudness.
  17467. @end table
  17468. Default value is @code{sono_v}.
  17469. @item sono_g, gamma
  17470. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  17471. higher gamma makes the spectrum having more range. Default value is @code{3}.
  17472. Acceptable range is @code{[1, 7]}.
  17473. @item bar_g, gamma2
  17474. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  17475. @code{[1, 7]}.
  17476. @item bar_t
  17477. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  17478. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  17479. @item timeclamp, tc
  17480. Specify the transform timeclamp. At low frequency, there is trade-off between
  17481. accuracy in time domain and frequency domain. If timeclamp is lower,
  17482. event in time domain is represented more accurately (such as fast bass drum),
  17483. otherwise event in frequency domain is represented more accurately
  17484. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  17485. @item attack
  17486. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  17487. limits future samples by applying asymmetric windowing in time domain, useful
  17488. when low latency is required. Accepted range is @code{[0, 1]}.
  17489. @item basefreq
  17490. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  17491. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  17492. @item endfreq
  17493. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  17494. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  17495. @item coeffclamp
  17496. This option is deprecated and ignored.
  17497. @item tlength
  17498. Specify the transform length in time domain. Use this option to control accuracy
  17499. trade-off between time domain and frequency domain at every frequency sample.
  17500. It can contain variables:
  17501. @table @option
  17502. @item frequency, freq, f
  17503. the frequency where it is evaluated
  17504. @item timeclamp, tc
  17505. the value of @var{timeclamp} option.
  17506. @end table
  17507. Default value is @code{384*tc/(384+tc*f)}.
  17508. @item count
  17509. Specify the transform count for every video frame. Default value is @code{6}.
  17510. Acceptable range is @code{[1, 30]}.
  17511. @item fcount
  17512. Specify the transform count for every single pixel. Default value is @code{0},
  17513. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  17514. @item fontfile
  17515. Specify font file for use with freetype to draw the axis. If not specified,
  17516. use embedded font. Note that drawing with font file or embedded font is not
  17517. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  17518. option instead.
  17519. @item font
  17520. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  17521. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  17522. escaping.
  17523. @item fontcolor
  17524. Specify font color expression. This is arithmetic expression that should return
  17525. integer value 0xRRGGBB. It can contain variables:
  17526. @table @option
  17527. @item frequency, freq, f
  17528. the frequency where it is evaluated
  17529. @item timeclamp, tc
  17530. the value of @var{timeclamp} option
  17531. @end table
  17532. and functions:
  17533. @table @option
  17534. @item midi(f)
  17535. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  17536. @item r(x), g(x), b(x)
  17537. red, green, and blue value of intensity x.
  17538. @end table
  17539. Default value is @code{st(0, (midi(f)-59.5)/12);
  17540. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  17541. r(1-ld(1)) + b(ld(1))}.
  17542. @item axisfile
  17543. Specify image file to draw the axis. This option override @var{fontfile} and
  17544. @var{fontcolor} option.
  17545. @item axis, text
  17546. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  17547. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  17548. Default value is @code{1}.
  17549. @item csp
  17550. Set colorspace. The accepted values are:
  17551. @table @samp
  17552. @item unspecified
  17553. Unspecified (default)
  17554. @item bt709
  17555. BT.709
  17556. @item fcc
  17557. FCC
  17558. @item bt470bg
  17559. BT.470BG or BT.601-6 625
  17560. @item smpte170m
  17561. SMPTE-170M or BT.601-6 525
  17562. @item smpte240m
  17563. SMPTE-240M
  17564. @item bt2020ncl
  17565. BT.2020 with non-constant luminance
  17566. @end table
  17567. @item cscheme
  17568. Set spectrogram color scheme. This is list of floating point values with format
  17569. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  17570. The default is @code{1|0.5|0|0|0.5|1}.
  17571. @end table
  17572. @subsection Examples
  17573. @itemize
  17574. @item
  17575. Playing audio while showing the spectrum:
  17576. @example
  17577. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  17578. @end example
  17579. @item
  17580. Same as above, but with frame rate 30 fps:
  17581. @example
  17582. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  17583. @end example
  17584. @item
  17585. Playing at 1280x720:
  17586. @example
  17587. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  17588. @end example
  17589. @item
  17590. Disable sonogram display:
  17591. @example
  17592. sono_h=0
  17593. @end example
  17594. @item
  17595. A1 and its harmonics: A1, A2, (near)E3, A3:
  17596. @example
  17597. 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),
  17598. asplit[a][out1]; [a] showcqt [out0]'
  17599. @end example
  17600. @item
  17601. Same as above, but with more accuracy in frequency domain:
  17602. @example
  17603. 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),
  17604. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  17605. @end example
  17606. @item
  17607. Custom volume:
  17608. @example
  17609. bar_v=10:sono_v=bar_v*a_weighting(f)
  17610. @end example
  17611. @item
  17612. Custom gamma, now spectrum is linear to the amplitude.
  17613. @example
  17614. bar_g=2:sono_g=2
  17615. @end example
  17616. @item
  17617. Custom tlength equation:
  17618. @example
  17619. 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)))'
  17620. @end example
  17621. @item
  17622. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  17623. @example
  17624. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  17625. @end example
  17626. @item
  17627. Custom font using fontconfig:
  17628. @example
  17629. font='Courier New,Monospace,mono|bold'
  17630. @end example
  17631. @item
  17632. Custom frequency range with custom axis using image file:
  17633. @example
  17634. axisfile=myaxis.png:basefreq=40:endfreq=10000
  17635. @end example
  17636. @end itemize
  17637. @section showfreqs
  17638. Convert input audio to video output representing the audio power spectrum.
  17639. Audio amplitude is on Y-axis while frequency is on X-axis.
  17640. The filter accepts the following options:
  17641. @table @option
  17642. @item size, s
  17643. Specify size of video. For the syntax of this option, check the
  17644. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17645. Default is @code{1024x512}.
  17646. @item mode
  17647. Set display mode.
  17648. This set how each frequency bin will be represented.
  17649. It accepts the following values:
  17650. @table @samp
  17651. @item line
  17652. @item bar
  17653. @item dot
  17654. @end table
  17655. Default is @code{bar}.
  17656. @item ascale
  17657. Set amplitude scale.
  17658. It accepts the following values:
  17659. @table @samp
  17660. @item lin
  17661. Linear scale.
  17662. @item sqrt
  17663. Square root scale.
  17664. @item cbrt
  17665. Cubic root scale.
  17666. @item log
  17667. Logarithmic scale.
  17668. @end table
  17669. Default is @code{log}.
  17670. @item fscale
  17671. Set frequency scale.
  17672. It accepts the following values:
  17673. @table @samp
  17674. @item lin
  17675. Linear scale.
  17676. @item log
  17677. Logarithmic scale.
  17678. @item rlog
  17679. Reverse logarithmic scale.
  17680. @end table
  17681. Default is @code{lin}.
  17682. @item win_size
  17683. Set window size. Allowed range is from 16 to 65536.
  17684. Default is @code{2048}
  17685. @item win_func
  17686. Set windowing function.
  17687. It accepts the following values:
  17688. @table @samp
  17689. @item rect
  17690. @item bartlett
  17691. @item hanning
  17692. @item hamming
  17693. @item blackman
  17694. @item welch
  17695. @item flattop
  17696. @item bharris
  17697. @item bnuttall
  17698. @item bhann
  17699. @item sine
  17700. @item nuttall
  17701. @item lanczos
  17702. @item gauss
  17703. @item tukey
  17704. @item dolph
  17705. @item cauchy
  17706. @item parzen
  17707. @item poisson
  17708. @item bohman
  17709. @end table
  17710. Default is @code{hanning}.
  17711. @item overlap
  17712. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17713. which means optimal overlap for selected window function will be picked.
  17714. @item averaging
  17715. Set time averaging. Setting this to 0 will display current maximal peaks.
  17716. Default is @code{1}, which means time averaging is disabled.
  17717. @item colors
  17718. Specify list of colors separated by space or by '|' which will be used to
  17719. draw channel frequencies. Unrecognized or missing colors will be replaced
  17720. by white color.
  17721. @item cmode
  17722. Set channel display mode.
  17723. It accepts the following values:
  17724. @table @samp
  17725. @item combined
  17726. @item separate
  17727. @end table
  17728. Default is @code{combined}.
  17729. @item minamp
  17730. Set minimum amplitude used in @code{log} amplitude scaler.
  17731. @end table
  17732. @section showspatial
  17733. Convert stereo input audio to a video output, representing the spatial relationship
  17734. between two channels.
  17735. The filter accepts the following options:
  17736. @table @option
  17737. @item size, s
  17738. Specify the video size for the output. For the syntax of this option, check the
  17739. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17740. Default value is @code{512x512}.
  17741. @item win_size
  17742. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  17743. @item win_func
  17744. Set window function.
  17745. It accepts the following values:
  17746. @table @samp
  17747. @item rect
  17748. @item bartlett
  17749. @item hann
  17750. @item hanning
  17751. @item hamming
  17752. @item blackman
  17753. @item welch
  17754. @item flattop
  17755. @item bharris
  17756. @item bnuttall
  17757. @item bhann
  17758. @item sine
  17759. @item nuttall
  17760. @item lanczos
  17761. @item gauss
  17762. @item tukey
  17763. @item dolph
  17764. @item cauchy
  17765. @item parzen
  17766. @item poisson
  17767. @item bohman
  17768. @end table
  17769. Default value is @code{hann}.
  17770. @item overlap
  17771. Set ratio of overlap window. Default value is @code{0.5}.
  17772. When value is @code{1} overlap is set to recommended size for specific
  17773. window function currently used.
  17774. @end table
  17775. @anchor{showspectrum}
  17776. @section showspectrum
  17777. Convert input audio to a video output, representing the audio frequency
  17778. spectrum.
  17779. The filter accepts the following options:
  17780. @table @option
  17781. @item size, s
  17782. Specify the video size for the output. For the syntax of this option, check the
  17783. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17784. Default value is @code{640x512}.
  17785. @item slide
  17786. Specify how the spectrum should slide along the window.
  17787. It accepts the following values:
  17788. @table @samp
  17789. @item replace
  17790. the samples start again on the left when they reach the right
  17791. @item scroll
  17792. the samples scroll from right to left
  17793. @item fullframe
  17794. frames are only produced when the samples reach the right
  17795. @item rscroll
  17796. the samples scroll from left to right
  17797. @end table
  17798. Default value is @code{replace}.
  17799. @item mode
  17800. Specify display mode.
  17801. It accepts the following values:
  17802. @table @samp
  17803. @item combined
  17804. all channels are displayed in the same row
  17805. @item separate
  17806. all channels are displayed in separate rows
  17807. @end table
  17808. Default value is @samp{combined}.
  17809. @item color
  17810. Specify display color mode.
  17811. It accepts the following values:
  17812. @table @samp
  17813. @item channel
  17814. each channel is displayed in a separate color
  17815. @item intensity
  17816. each channel is displayed using the same color scheme
  17817. @item rainbow
  17818. each channel is displayed using the rainbow color scheme
  17819. @item moreland
  17820. each channel is displayed using the moreland color scheme
  17821. @item nebulae
  17822. each channel is displayed using the nebulae color scheme
  17823. @item fire
  17824. each channel is displayed using the fire color scheme
  17825. @item fiery
  17826. each channel is displayed using the fiery color scheme
  17827. @item fruit
  17828. each channel is displayed using the fruit color scheme
  17829. @item cool
  17830. each channel is displayed using the cool color scheme
  17831. @item magma
  17832. each channel is displayed using the magma color scheme
  17833. @item green
  17834. each channel is displayed using the green color scheme
  17835. @item viridis
  17836. each channel is displayed using the viridis color scheme
  17837. @item plasma
  17838. each channel is displayed using the plasma color scheme
  17839. @item cividis
  17840. each channel is displayed using the cividis color scheme
  17841. @item terrain
  17842. each channel is displayed using the terrain color scheme
  17843. @end table
  17844. Default value is @samp{channel}.
  17845. @item scale
  17846. Specify scale used for calculating intensity color values.
  17847. It accepts the following values:
  17848. @table @samp
  17849. @item lin
  17850. linear
  17851. @item sqrt
  17852. square root, default
  17853. @item cbrt
  17854. cubic root
  17855. @item log
  17856. logarithmic
  17857. @item 4thrt
  17858. 4th root
  17859. @item 5thrt
  17860. 5th root
  17861. @end table
  17862. Default value is @samp{sqrt}.
  17863. @item fscale
  17864. Specify frequency scale.
  17865. It accepts the following values:
  17866. @table @samp
  17867. @item lin
  17868. linear
  17869. @item log
  17870. logarithmic
  17871. @end table
  17872. Default value is @samp{lin}.
  17873. @item saturation
  17874. Set saturation modifier for displayed colors. Negative values provide
  17875. alternative color scheme. @code{0} is no saturation at all.
  17876. Saturation must be in [-10.0, 10.0] range.
  17877. Default value is @code{1}.
  17878. @item win_func
  17879. Set window function.
  17880. It accepts the following values:
  17881. @table @samp
  17882. @item rect
  17883. @item bartlett
  17884. @item hann
  17885. @item hanning
  17886. @item hamming
  17887. @item blackman
  17888. @item welch
  17889. @item flattop
  17890. @item bharris
  17891. @item bnuttall
  17892. @item bhann
  17893. @item sine
  17894. @item nuttall
  17895. @item lanczos
  17896. @item gauss
  17897. @item tukey
  17898. @item dolph
  17899. @item cauchy
  17900. @item parzen
  17901. @item poisson
  17902. @item bohman
  17903. @end table
  17904. Default value is @code{hann}.
  17905. @item orientation
  17906. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17907. @code{horizontal}. Default is @code{vertical}.
  17908. @item overlap
  17909. Set ratio of overlap window. Default value is @code{0}.
  17910. When value is @code{1} overlap is set to recommended size for specific
  17911. window function currently used.
  17912. @item gain
  17913. Set scale gain for calculating intensity color values.
  17914. Default value is @code{1}.
  17915. @item data
  17916. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  17917. @item rotation
  17918. Set color rotation, must be in [-1.0, 1.0] range.
  17919. Default value is @code{0}.
  17920. @item start
  17921. Set start frequency from which to display spectrogram. Default is @code{0}.
  17922. @item stop
  17923. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17924. @item fps
  17925. Set upper frame rate limit. Default is @code{auto}, unlimited.
  17926. @item legend
  17927. Draw time and frequency axes and legends. Default is disabled.
  17928. @end table
  17929. The usage is very similar to the showwaves filter; see the examples in that
  17930. section.
  17931. @subsection Examples
  17932. @itemize
  17933. @item
  17934. Large window with logarithmic color scaling:
  17935. @example
  17936. showspectrum=s=1280x480:scale=log
  17937. @end example
  17938. @item
  17939. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  17940. @example
  17941. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17942. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  17943. @end example
  17944. @end itemize
  17945. @section showspectrumpic
  17946. Convert input audio to a single video frame, representing the audio frequency
  17947. spectrum.
  17948. The filter accepts the following options:
  17949. @table @option
  17950. @item size, s
  17951. Specify the video size for the output. For the syntax of this option, check the
  17952. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17953. Default value is @code{4096x2048}.
  17954. @item mode
  17955. Specify display mode.
  17956. It accepts the following values:
  17957. @table @samp
  17958. @item combined
  17959. all channels are displayed in the same row
  17960. @item separate
  17961. all channels are displayed in separate rows
  17962. @end table
  17963. Default value is @samp{combined}.
  17964. @item color
  17965. Specify display color mode.
  17966. It accepts the following values:
  17967. @table @samp
  17968. @item channel
  17969. each channel is displayed in a separate color
  17970. @item intensity
  17971. each channel is displayed using the same color scheme
  17972. @item rainbow
  17973. each channel is displayed using the rainbow color scheme
  17974. @item moreland
  17975. each channel is displayed using the moreland color scheme
  17976. @item nebulae
  17977. each channel is displayed using the nebulae color scheme
  17978. @item fire
  17979. each channel is displayed using the fire color scheme
  17980. @item fiery
  17981. each channel is displayed using the fiery color scheme
  17982. @item fruit
  17983. each channel is displayed using the fruit color scheme
  17984. @item cool
  17985. each channel is displayed using the cool color scheme
  17986. @item magma
  17987. each channel is displayed using the magma color scheme
  17988. @item green
  17989. each channel is displayed using the green color scheme
  17990. @item viridis
  17991. each channel is displayed using the viridis color scheme
  17992. @item plasma
  17993. each channel is displayed using the plasma color scheme
  17994. @item cividis
  17995. each channel is displayed using the cividis color scheme
  17996. @item terrain
  17997. each channel is displayed using the terrain color scheme
  17998. @end table
  17999. Default value is @samp{intensity}.
  18000. @item scale
  18001. Specify scale used for calculating intensity color values.
  18002. It accepts the following values:
  18003. @table @samp
  18004. @item lin
  18005. linear
  18006. @item sqrt
  18007. square root, default
  18008. @item cbrt
  18009. cubic root
  18010. @item log
  18011. logarithmic
  18012. @item 4thrt
  18013. 4th root
  18014. @item 5thrt
  18015. 5th root
  18016. @end table
  18017. Default value is @samp{log}.
  18018. @item fscale
  18019. Specify frequency scale.
  18020. It accepts the following values:
  18021. @table @samp
  18022. @item lin
  18023. linear
  18024. @item log
  18025. logarithmic
  18026. @end table
  18027. Default value is @samp{lin}.
  18028. @item saturation
  18029. Set saturation modifier for displayed colors. Negative values provide
  18030. alternative color scheme. @code{0} is no saturation at all.
  18031. Saturation must be in [-10.0, 10.0] range.
  18032. Default value is @code{1}.
  18033. @item win_func
  18034. Set window function.
  18035. It accepts the following values:
  18036. @table @samp
  18037. @item rect
  18038. @item bartlett
  18039. @item hann
  18040. @item hanning
  18041. @item hamming
  18042. @item blackman
  18043. @item welch
  18044. @item flattop
  18045. @item bharris
  18046. @item bnuttall
  18047. @item bhann
  18048. @item sine
  18049. @item nuttall
  18050. @item lanczos
  18051. @item gauss
  18052. @item tukey
  18053. @item dolph
  18054. @item cauchy
  18055. @item parzen
  18056. @item poisson
  18057. @item bohman
  18058. @end table
  18059. Default value is @code{hann}.
  18060. @item orientation
  18061. Set orientation of time vs frequency axis. Can be @code{vertical} or
  18062. @code{horizontal}. Default is @code{vertical}.
  18063. @item gain
  18064. Set scale gain for calculating intensity color values.
  18065. Default value is @code{1}.
  18066. @item legend
  18067. Draw time and frequency axes and legends. Default is enabled.
  18068. @item rotation
  18069. Set color rotation, must be in [-1.0, 1.0] range.
  18070. Default value is @code{0}.
  18071. @item start
  18072. Set start frequency from which to display spectrogram. Default is @code{0}.
  18073. @item stop
  18074. Set stop frequency to which to display spectrogram. Default is @code{0}.
  18075. @end table
  18076. @subsection Examples
  18077. @itemize
  18078. @item
  18079. Extract an audio spectrogram of a whole audio track
  18080. in a 1024x1024 picture using @command{ffmpeg}:
  18081. @example
  18082. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  18083. @end example
  18084. @end itemize
  18085. @section showvolume
  18086. Convert input audio volume to a video output.
  18087. The filter accepts the following options:
  18088. @table @option
  18089. @item rate, r
  18090. Set video rate.
  18091. @item b
  18092. Set border width, allowed range is [0, 5]. Default is 1.
  18093. @item w
  18094. Set channel width, allowed range is [80, 8192]. Default is 400.
  18095. @item h
  18096. Set channel height, allowed range is [1, 900]. Default is 20.
  18097. @item f
  18098. Set fade, allowed range is [0, 1]. Default is 0.95.
  18099. @item c
  18100. Set volume color expression.
  18101. The expression can use the following variables:
  18102. @table @option
  18103. @item VOLUME
  18104. Current max volume of channel in dB.
  18105. @item PEAK
  18106. Current peak.
  18107. @item CHANNEL
  18108. Current channel number, starting from 0.
  18109. @end table
  18110. @item t
  18111. If set, displays channel names. Default is enabled.
  18112. @item v
  18113. If set, displays volume values. Default is enabled.
  18114. @item o
  18115. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  18116. default is @code{h}.
  18117. @item s
  18118. Set step size, allowed range is [0, 5]. Default is 0, which means
  18119. step is disabled.
  18120. @item p
  18121. Set background opacity, allowed range is [0, 1]. Default is 0.
  18122. @item m
  18123. Set metering mode, can be peak: @code{p} or rms: @code{r},
  18124. default is @code{p}.
  18125. @item ds
  18126. Set display scale, can be linear: @code{lin} or log: @code{log},
  18127. default is @code{lin}.
  18128. @item dm
  18129. In second.
  18130. If set to > 0., display a line for the max level
  18131. in the previous seconds.
  18132. default is disabled: @code{0.}
  18133. @item dmc
  18134. The color of the max line. Use when @code{dm} option is set to > 0.
  18135. default is: @code{orange}
  18136. @end table
  18137. @section showwaves
  18138. Convert input audio to a video output, representing the samples waves.
  18139. The filter accepts the following options:
  18140. @table @option
  18141. @item size, s
  18142. Specify the video size for the output. For the syntax of this option, check the
  18143. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18144. Default value is @code{600x240}.
  18145. @item mode
  18146. Set display mode.
  18147. Available values are:
  18148. @table @samp
  18149. @item point
  18150. Draw a point for each sample.
  18151. @item line
  18152. Draw a vertical line for each sample.
  18153. @item p2p
  18154. Draw a point for each sample and a line between them.
  18155. @item cline
  18156. Draw a centered vertical line for each sample.
  18157. @end table
  18158. Default value is @code{point}.
  18159. @item n
  18160. Set the number of samples which are printed on the same column. A
  18161. larger value will decrease the frame rate. Must be a positive
  18162. integer. This option can be set only if the value for @var{rate}
  18163. is not explicitly specified.
  18164. @item rate, r
  18165. Set the (approximate) output frame rate. This is done by setting the
  18166. option @var{n}. Default value is "25".
  18167. @item split_channels
  18168. Set if channels should be drawn separately or overlap. Default value is 0.
  18169. @item colors
  18170. Set colors separated by '|' which are going to be used for drawing of each channel.
  18171. @item scale
  18172. Set amplitude scale.
  18173. Available values are:
  18174. @table @samp
  18175. @item lin
  18176. Linear.
  18177. @item log
  18178. Logarithmic.
  18179. @item sqrt
  18180. Square root.
  18181. @item cbrt
  18182. Cubic root.
  18183. @end table
  18184. Default is linear.
  18185. @item draw
  18186. Set the draw mode. This is mostly useful to set for high @var{n}.
  18187. Available values are:
  18188. @table @samp
  18189. @item scale
  18190. Scale pixel values for each drawn sample.
  18191. @item full
  18192. Draw every sample directly.
  18193. @end table
  18194. Default value is @code{scale}.
  18195. @end table
  18196. @subsection Examples
  18197. @itemize
  18198. @item
  18199. Output the input file audio and the corresponding video representation
  18200. at the same time:
  18201. @example
  18202. amovie=a.mp3,asplit[out0],showwaves[out1]
  18203. @end example
  18204. @item
  18205. Create a synthetic signal and show it with showwaves, forcing a
  18206. frame rate of 30 frames per second:
  18207. @example
  18208. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  18209. @end example
  18210. @end itemize
  18211. @section showwavespic
  18212. Convert input audio to a single video frame, representing the samples waves.
  18213. The filter accepts the following options:
  18214. @table @option
  18215. @item size, s
  18216. Specify the video size for the output. For the syntax of this option, check the
  18217. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18218. Default value is @code{600x240}.
  18219. @item split_channels
  18220. Set if channels should be drawn separately or overlap. Default value is 0.
  18221. @item colors
  18222. Set colors separated by '|' which are going to be used for drawing of each channel.
  18223. @item scale
  18224. Set amplitude scale.
  18225. Available values are:
  18226. @table @samp
  18227. @item lin
  18228. Linear.
  18229. @item log
  18230. Logarithmic.
  18231. @item sqrt
  18232. Square root.
  18233. @item cbrt
  18234. Cubic root.
  18235. @end table
  18236. Default is linear.
  18237. @item draw
  18238. Set the draw mode.
  18239. Available values are:
  18240. @table @samp
  18241. @item scale
  18242. Scale pixel values for each drawn sample.
  18243. @item full
  18244. Draw every sample directly.
  18245. @end table
  18246. Default value is @code{scale}.
  18247. @end table
  18248. @subsection Examples
  18249. @itemize
  18250. @item
  18251. Extract a channel split representation of the wave form of a whole audio track
  18252. in a 1024x800 picture using @command{ffmpeg}:
  18253. @example
  18254. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  18255. @end example
  18256. @end itemize
  18257. @section sidedata, asidedata
  18258. Delete frame side data, or select frames based on it.
  18259. This filter accepts the following options:
  18260. @table @option
  18261. @item mode
  18262. Set mode of operation of the filter.
  18263. Can be one of the following:
  18264. @table @samp
  18265. @item select
  18266. Select every frame with side data of @code{type}.
  18267. @item delete
  18268. Delete side data of @code{type}. If @code{type} is not set, delete all side
  18269. data in the frame.
  18270. @end table
  18271. @item type
  18272. Set side data type used with all modes. Must be set for @code{select} mode. For
  18273. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  18274. in @file{libavutil/frame.h}. For example, to choose
  18275. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  18276. @end table
  18277. @section spectrumsynth
  18278. Synthesize audio from 2 input video spectrums, first input stream represents
  18279. magnitude across time and second represents phase across time.
  18280. The filter will transform from frequency domain as displayed in videos back
  18281. to time domain as presented in audio output.
  18282. This filter is primarily created for reversing processed @ref{showspectrum}
  18283. filter outputs, but can synthesize sound from other spectrograms too.
  18284. But in such case results are going to be poor if the phase data is not
  18285. available, because in such cases phase data need to be recreated, usually
  18286. it's just recreated from random noise.
  18287. For best results use gray only output (@code{channel} color mode in
  18288. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  18289. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  18290. @code{data} option. Inputs videos should generally use @code{fullframe}
  18291. slide mode as that saves resources needed for decoding video.
  18292. The filter accepts the following options:
  18293. @table @option
  18294. @item sample_rate
  18295. Specify sample rate of output audio, the sample rate of audio from which
  18296. spectrum was generated may differ.
  18297. @item channels
  18298. Set number of channels represented in input video spectrums.
  18299. @item scale
  18300. Set scale which was used when generating magnitude input spectrum.
  18301. Can be @code{lin} or @code{log}. Default is @code{log}.
  18302. @item slide
  18303. Set slide which was used when generating inputs spectrums.
  18304. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  18305. Default is @code{fullframe}.
  18306. @item win_func
  18307. Set window function used for resynthesis.
  18308. @item overlap
  18309. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18310. which means optimal overlap for selected window function will be picked.
  18311. @item orientation
  18312. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  18313. Default is @code{vertical}.
  18314. @end table
  18315. @subsection Examples
  18316. @itemize
  18317. @item
  18318. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  18319. then resynthesize videos back to audio with spectrumsynth:
  18320. @example
  18321. 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
  18322. 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
  18323. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  18324. @end example
  18325. @end itemize
  18326. @section split, asplit
  18327. Split input into several identical outputs.
  18328. @code{asplit} works with audio input, @code{split} with video.
  18329. The filter accepts a single parameter which specifies the number of outputs. If
  18330. unspecified, it defaults to 2.
  18331. @subsection Examples
  18332. @itemize
  18333. @item
  18334. Create two separate outputs from the same input:
  18335. @example
  18336. [in] split [out0][out1]
  18337. @end example
  18338. @item
  18339. To create 3 or more outputs, you need to specify the number of
  18340. outputs, like in:
  18341. @example
  18342. [in] asplit=3 [out0][out1][out2]
  18343. @end example
  18344. @item
  18345. Create two separate outputs from the same input, one cropped and
  18346. one padded:
  18347. @example
  18348. [in] split [splitout1][splitout2];
  18349. [splitout1] crop=100:100:0:0 [cropout];
  18350. [splitout2] pad=200:200:100:100 [padout];
  18351. @end example
  18352. @item
  18353. Create 5 copies of the input audio with @command{ffmpeg}:
  18354. @example
  18355. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  18356. @end example
  18357. @end itemize
  18358. @section zmq, azmq
  18359. Receive commands sent through a libzmq client, and forward them to
  18360. filters in the filtergraph.
  18361. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  18362. must be inserted between two video filters, @code{azmq} between two
  18363. audio filters. Both are capable to send messages to any filter type.
  18364. To enable these filters you need to install the libzmq library and
  18365. headers and configure FFmpeg with @code{--enable-libzmq}.
  18366. For more information about libzmq see:
  18367. @url{http://www.zeromq.org/}
  18368. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  18369. receives messages sent through a network interface defined by the
  18370. @option{bind_address} (or the abbreviation "@option{b}") option.
  18371. Default value of this option is @file{tcp://localhost:5555}. You may
  18372. want to alter this value to your needs, but do not forget to escape any
  18373. ':' signs (see @ref{filtergraph escaping}).
  18374. The received message must be in the form:
  18375. @example
  18376. @var{TARGET} @var{COMMAND} [@var{ARG}]
  18377. @end example
  18378. @var{TARGET} specifies the target of the command, usually the name of
  18379. the filter class or a specific filter instance name. The default
  18380. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  18381. but you can override this by using the @samp{filter_name@@id} syntax
  18382. (see @ref{Filtergraph syntax}).
  18383. @var{COMMAND} specifies the name of the command for the target filter.
  18384. @var{ARG} is optional and specifies the optional argument list for the
  18385. given @var{COMMAND}.
  18386. Upon reception, the message is processed and the corresponding command
  18387. is injected into the filtergraph. Depending on the result, the filter
  18388. will send a reply to the client, adopting the format:
  18389. @example
  18390. @var{ERROR_CODE} @var{ERROR_REASON}
  18391. @var{MESSAGE}
  18392. @end example
  18393. @var{MESSAGE} is optional.
  18394. @subsection Examples
  18395. Look at @file{tools/zmqsend} for an example of a zmq client which can
  18396. be used to send commands processed by these filters.
  18397. Consider the following filtergraph generated by @command{ffplay}.
  18398. In this example the last overlay filter has an instance name. All other
  18399. filters will have default instance names.
  18400. @example
  18401. ffplay -dumpgraph 1 -f lavfi "
  18402. color=s=100x100:c=red [l];
  18403. color=s=100x100:c=blue [r];
  18404. nullsrc=s=200x100, zmq [bg];
  18405. [bg][l] overlay [bg+l];
  18406. [bg+l][r] overlay@@my=x=100 "
  18407. @end example
  18408. To change the color of the left side of the video, the following
  18409. command can be used:
  18410. @example
  18411. echo Parsed_color_0 c yellow | tools/zmqsend
  18412. @end example
  18413. To change the right side:
  18414. @example
  18415. echo Parsed_color_1 c pink | tools/zmqsend
  18416. @end example
  18417. To change the position of the right side:
  18418. @example
  18419. echo overlay@@my x 150 | tools/zmqsend
  18420. @end example
  18421. @c man end MULTIMEDIA FILTERS
  18422. @chapter Multimedia Sources
  18423. @c man begin MULTIMEDIA SOURCES
  18424. Below is a description of the currently available multimedia sources.
  18425. @section amovie
  18426. This is the same as @ref{movie} source, except it selects an audio
  18427. stream by default.
  18428. @anchor{movie}
  18429. @section movie
  18430. Read audio and/or video stream(s) from a movie container.
  18431. It accepts the following parameters:
  18432. @table @option
  18433. @item filename
  18434. The name of the resource to read (not necessarily a file; it can also be a
  18435. device or a stream accessed through some protocol).
  18436. @item format_name, f
  18437. Specifies the format assumed for the movie to read, and can be either
  18438. the name of a container or an input device. If not specified, the
  18439. format is guessed from @var{movie_name} or by probing.
  18440. @item seek_point, sp
  18441. Specifies the seek point in seconds. The frames will be output
  18442. starting from this seek point. The parameter is evaluated with
  18443. @code{av_strtod}, so the numerical value may be suffixed by an IS
  18444. postfix. The default value is "0".
  18445. @item streams, s
  18446. Specifies the streams to read. Several streams can be specified,
  18447. separated by "+". The source will then have as many outputs, in the
  18448. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  18449. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  18450. respectively the default (best suited) video and audio stream. Default
  18451. is "dv", or "da" if the filter is called as "amovie".
  18452. @item stream_index, si
  18453. Specifies the index of the video stream to read. If the value is -1,
  18454. the most suitable video stream will be automatically selected. The default
  18455. value is "-1". Deprecated. If the filter is called "amovie", it will select
  18456. audio instead of video.
  18457. @item loop
  18458. Specifies how many times to read the stream in sequence.
  18459. If the value is 0, the stream will be looped infinitely.
  18460. Default value is "1".
  18461. Note that when the movie is looped the source timestamps are not
  18462. changed, so it will generate non monotonically increasing timestamps.
  18463. @item discontinuity
  18464. Specifies the time difference between frames above which the point is
  18465. considered a timestamp discontinuity which is removed by adjusting the later
  18466. timestamps.
  18467. @end table
  18468. It allows overlaying a second video on top of the main input of
  18469. a filtergraph, as shown in this graph:
  18470. @example
  18471. input -----------> deltapts0 --> overlay --> output
  18472. ^
  18473. |
  18474. movie --> scale--> deltapts1 -------+
  18475. @end example
  18476. @subsection Examples
  18477. @itemize
  18478. @item
  18479. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  18480. on top of the input labelled "in":
  18481. @example
  18482. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18483. [in] setpts=PTS-STARTPTS [main];
  18484. [main][over] overlay=16:16 [out]
  18485. @end example
  18486. @item
  18487. Read from a video4linux2 device, and overlay it on top of the input
  18488. labelled "in":
  18489. @example
  18490. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18491. [in] setpts=PTS-STARTPTS [main];
  18492. [main][over] overlay=16:16 [out]
  18493. @end example
  18494. @item
  18495. Read the first video stream and the audio stream with id 0x81 from
  18496. dvd.vob; the video is connected to the pad named "video" and the audio is
  18497. connected to the pad named "audio":
  18498. @example
  18499. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  18500. @end example
  18501. @end itemize
  18502. @subsection Commands
  18503. Both movie and amovie support the following commands:
  18504. @table @option
  18505. @item seek
  18506. Perform seek using "av_seek_frame".
  18507. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  18508. @itemize
  18509. @item
  18510. @var{stream_index}: If stream_index is -1, a default
  18511. stream is selected, and @var{timestamp} is automatically converted
  18512. from AV_TIME_BASE units to the stream specific time_base.
  18513. @item
  18514. @var{timestamp}: Timestamp in AVStream.time_base units
  18515. or, if no stream is specified, in AV_TIME_BASE units.
  18516. @item
  18517. @var{flags}: Flags which select direction and seeking mode.
  18518. @end itemize
  18519. @item get_duration
  18520. Get movie duration in AV_TIME_BASE units.
  18521. @end table
  18522. @c man end MULTIMEDIA SOURCES