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.

25947 lines
689KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{commands}
  252. @chapter Changing options at runtime with a command
  253. Some options can be changed during the operation of the filter using
  254. a command. These options are marked 'T' on the output of
  255. @command{ffmpeg} @option{-h filter=<name of filter>}.
  256. The name of the command is the name of the option and the argument is
  257. the new value.
  258. @anchor{framesync}
  259. @chapter Options for filters with several inputs (framesync)
  260. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  261. Some filters with several inputs support a common set of options.
  262. These options can only be set by name, not with the short notation.
  263. @table @option
  264. @item eof_action
  265. The action to take when EOF is encountered on the secondary input; it accepts
  266. one of the following values:
  267. @table @option
  268. @item repeat
  269. Repeat the last frame (the default).
  270. @item endall
  271. End both streams.
  272. @item pass
  273. Pass the main input through.
  274. @end table
  275. @item shortest
  276. If set to 1, force the output to terminate when the shortest input
  277. terminates. Default value is 0.
  278. @item repeatlast
  279. If set to 1, force the filter to extend the last frame of secondary streams
  280. until the end of the primary stream. A value of 0 disables this behavior.
  281. Default value is 1.
  282. @end table
  283. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  284. @chapter Audio Filters
  285. @c man begin AUDIO FILTERS
  286. When you configure your FFmpeg build, you can disable any of the
  287. existing filters using @code{--disable-filters}.
  288. The configure output will show the audio filters included in your
  289. build.
  290. Below is a description of the currently available audio filters.
  291. @section acompressor
  292. A compressor is mainly used to reduce the dynamic range of a signal.
  293. Especially modern music is mostly compressed at a high ratio to
  294. improve the overall loudness. It's done to get the highest attention
  295. of a listener, "fatten" the sound and bring more "power" to the track.
  296. If a signal is compressed too much it may sound dull or "dead"
  297. afterwards or it may start to "pump" (which could be a powerful effect
  298. but can also destroy a track completely).
  299. The right compression is the key to reach a professional sound and is
  300. the high art of mixing and mastering. Because of its complex settings
  301. it may take a long time to get the right feeling for this kind of effect.
  302. Compression is done by detecting the volume above a chosen level
  303. @code{threshold} and dividing it by the factor set with @code{ratio}.
  304. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  305. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  306. the signal would cause distortion of the waveform the reduction can be
  307. levelled over the time. This is done by setting "Attack" and "Release".
  308. @code{attack} determines how long the signal has to rise above the threshold
  309. before any reduction will occur and @code{release} sets the time the signal
  310. has to fall below the threshold to reduce the reduction again. Shorter signals
  311. than the chosen attack time will be left untouched.
  312. The overall reduction of the signal can be made up afterwards with the
  313. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  314. raising the makeup to this level results in a signal twice as loud than the
  315. source. To gain a softer entry in the compression the @code{knee} flattens the
  316. hard edge at the threshold in the range of the chosen decibels.
  317. The filter accepts the following options:
  318. @table @option
  319. @item level_in
  320. Set input gain. Default is 1. Range is between 0.015625 and 64.
  321. @item mode
  322. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  323. Default is @code{downward}.
  324. @item threshold
  325. If a signal of stream rises above this level it will affect the gain
  326. reduction.
  327. By default it is 0.125. Range is between 0.00097563 and 1.
  328. @item ratio
  329. Set a ratio by which the signal is reduced. 1:2 means that if the level
  330. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  331. Default is 2. Range is between 1 and 20.
  332. @item attack
  333. Amount of milliseconds the signal has to rise above the threshold before gain
  334. reduction starts. Default is 20. Range is between 0.01 and 2000.
  335. @item release
  336. Amount of milliseconds the signal has to fall below the threshold before
  337. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  338. @item makeup
  339. Set the amount by how much signal will be amplified after processing.
  340. Default is 1. Range is from 1 to 64.
  341. @item knee
  342. Curve the sharp knee around the threshold to enter gain reduction more softly.
  343. Default is 2.82843. Range is between 1 and 8.
  344. @item link
  345. Choose if the @code{average} level between all channels of input stream
  346. or the louder(@code{maximum}) channel of input stream affects the
  347. reduction. Default is @code{average}.
  348. @item detection
  349. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  350. of @code{rms}. Default is @code{rms} which is mostly smoother.
  351. @item mix
  352. How much to use compressed signal in output. Default is 1.
  353. Range is between 0 and 1.
  354. @end table
  355. @subsection Commands
  356. This filter supports the all above options as @ref{commands}.
  357. @section acontrast
  358. Simple audio dynamic range compression/expansion filter.
  359. The filter accepts the following options:
  360. @table @option
  361. @item contrast
  362. Set contrast. Default is 33. Allowed range is between 0 and 100.
  363. @end table
  364. @section acopy
  365. Copy the input audio source unchanged to the output. This is mainly useful for
  366. testing purposes.
  367. @section acrossfade
  368. Apply cross fade from one input audio stream to another input audio stream.
  369. The cross fade is applied for specified duration near the end of first stream.
  370. The filter accepts the following options:
  371. @table @option
  372. @item nb_samples, ns
  373. Specify the number of samples for which the cross fade effect has to last.
  374. At the end of the cross fade effect the first input audio will be completely
  375. silent. Default is 44100.
  376. @item duration, d
  377. Specify the duration of the cross fade effect. See
  378. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  379. for the accepted syntax.
  380. By default the duration is determined by @var{nb_samples}.
  381. If set this option is used instead of @var{nb_samples}.
  382. @item overlap, o
  383. Should first stream end overlap with second stream start. Default is enabled.
  384. @item curve1
  385. Set curve for cross fade transition for first stream.
  386. @item curve2
  387. Set curve for cross fade transition for second stream.
  388. For description of available curve types see @ref{afade} filter description.
  389. @end table
  390. @subsection Examples
  391. @itemize
  392. @item
  393. Cross fade from one input to another:
  394. @example
  395. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  396. @end example
  397. @item
  398. Cross fade from one input to another but without overlapping:
  399. @example
  400. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  401. @end example
  402. @end itemize
  403. @section acrossover
  404. Split audio stream into several bands.
  405. This filter splits audio stream into two or more frequency ranges.
  406. Summing all streams back will give flat output.
  407. The filter accepts the following options:
  408. @table @option
  409. @item split
  410. Set split frequencies. Those must be positive and increasing.
  411. @item order
  412. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  413. Default is @var{4th}.
  414. @end table
  415. @section acrusher
  416. Reduce audio bit resolution.
  417. This filter is bit crusher with enhanced functionality. A bit crusher
  418. is used to audibly reduce number of bits an audio signal is sampled
  419. with. This doesn't change the bit depth at all, it just produces the
  420. effect. Material reduced in bit depth sounds more harsh and "digital".
  421. This filter is able to even round to continuous values instead of discrete
  422. bit depths.
  423. Additionally it has a D/C offset which results in different crushing of
  424. the lower and the upper half of the signal.
  425. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  426. Another feature of this filter is the logarithmic mode.
  427. This setting switches from linear distances between bits to logarithmic ones.
  428. The result is a much more "natural" sounding crusher which doesn't gate low
  429. signals for example. The human ear has a logarithmic perception,
  430. so this kind of crushing is much more pleasant.
  431. Logarithmic crushing is also able to get anti-aliased.
  432. The filter accepts the following options:
  433. @table @option
  434. @item level_in
  435. Set level in.
  436. @item level_out
  437. Set level out.
  438. @item bits
  439. Set bit reduction.
  440. @item mix
  441. Set mixing amount.
  442. @item mode
  443. Can be linear: @code{lin} or logarithmic: @code{log}.
  444. @item dc
  445. Set DC.
  446. @item aa
  447. Set anti-aliasing.
  448. @item samples
  449. Set sample reduction.
  450. @item lfo
  451. Enable LFO. By default disabled.
  452. @item lforange
  453. Set LFO range.
  454. @item lforate
  455. Set LFO rate.
  456. @end table
  457. @section acue
  458. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  459. filter.
  460. @section adeclick
  461. Remove impulsive noise from input audio.
  462. Samples detected as impulsive noise are replaced by interpolated samples using
  463. autoregressive modelling.
  464. @table @option
  465. @item w
  466. Set window size, in milliseconds. Allowed range is from @code{10} to
  467. @code{100}. Default value is @code{55} milliseconds.
  468. This sets size of window which will be processed at once.
  469. @item o
  470. Set window overlap, in percentage of window size. Allowed range is from
  471. @code{50} to @code{95}. Default value is @code{75} percent.
  472. Setting this to a very high value increases impulsive noise removal but makes
  473. whole process much slower.
  474. @item a
  475. Set autoregression order, in percentage of window size. Allowed range is from
  476. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  477. controls quality of interpolated samples using neighbour good samples.
  478. @item t
  479. Set threshold value. Allowed range is from @code{1} to @code{100}.
  480. Default value is @code{2}.
  481. This controls the strength of impulsive noise which is going to be removed.
  482. The lower value, the more samples will be detected as impulsive noise.
  483. @item b
  484. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  485. @code{10}. Default value is @code{2}.
  486. If any two samples detected as noise are spaced less than this value then any
  487. sample between those two samples will be also detected as noise.
  488. @item m
  489. Set overlap method.
  490. It accepts the following values:
  491. @table @option
  492. @item a
  493. Select overlap-add method. Even not interpolated samples are slightly
  494. changed with this method.
  495. @item s
  496. Select overlap-save method. Not interpolated samples remain unchanged.
  497. @end table
  498. Default value is @code{a}.
  499. @end table
  500. @section adeclip
  501. Remove clipped samples from input audio.
  502. Samples detected as clipped are replaced by interpolated samples using
  503. autoregressive modelling.
  504. @table @option
  505. @item w
  506. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  507. Default value is @code{55} milliseconds.
  508. This sets size of window which will be processed at once.
  509. @item o
  510. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  511. to @code{95}. Default value is @code{75} percent.
  512. @item a
  513. Set autoregression order, in percentage of window size. Allowed range is from
  514. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  515. quality of interpolated samples using neighbour good samples.
  516. @item t
  517. Set threshold value. Allowed range is from @code{1} to @code{100}.
  518. Default value is @code{10}. Higher values make clip detection less aggressive.
  519. @item n
  520. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  521. Default value is @code{1000}. Higher values make clip detection less aggressive.
  522. @item m
  523. Set overlap method.
  524. It accepts the following values:
  525. @table @option
  526. @item a
  527. Select overlap-add method. Even not interpolated samples are slightly changed
  528. with this method.
  529. @item s
  530. Select overlap-save method. Not interpolated samples remain unchanged.
  531. @end table
  532. Default value is @code{a}.
  533. @end table
  534. @section adelay
  535. Delay one or more audio channels.
  536. Samples in delayed channel are filled with silence.
  537. The filter accepts the following option:
  538. @table @option
  539. @item delays
  540. Set list of delays in milliseconds for each channel separated by '|'.
  541. Unused delays will be silently ignored. If number of given delays is
  542. smaller than number of channels all remaining channels will not be delayed.
  543. If you want to delay exact number of samples, append 'S' to number.
  544. If you want instead to delay in seconds, append 's' to number.
  545. @item all
  546. Use last set delay for all remaining channels. By default is disabled.
  547. This option if enabled changes how option @code{delays} is interpreted.
  548. @end table
  549. @subsection Examples
  550. @itemize
  551. @item
  552. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  553. the second channel (and any other channels that may be present) unchanged.
  554. @example
  555. adelay=1500|0|500
  556. @end example
  557. @item
  558. Delay second channel by 500 samples, the third channel by 700 samples and leave
  559. the first channel (and any other channels that may be present) unchanged.
  560. @example
  561. adelay=0|500S|700S
  562. @end example
  563. @item
  564. Delay all channels by same number of samples:
  565. @example
  566. adelay=delays=64S:all=1
  567. @end example
  568. @end itemize
  569. @section aderivative, aintegral
  570. Compute derivative/integral of audio stream.
  571. Applying both filters one after another produces original audio.
  572. @section aecho
  573. Apply echoing to the input audio.
  574. Echoes are reflected sound and can occur naturally amongst mountains
  575. (and sometimes large buildings) when talking or shouting; digital echo
  576. effects emulate this behaviour and are often used to help fill out the
  577. sound of a single instrument or vocal. The time difference between the
  578. original signal and the reflection is the @code{delay}, and the
  579. loudness of the reflected signal is the @code{decay}.
  580. Multiple echoes can have different delays and decays.
  581. A description of the accepted parameters follows.
  582. @table @option
  583. @item in_gain
  584. Set input gain of reflected signal. Default is @code{0.6}.
  585. @item out_gain
  586. Set output gain of reflected signal. Default is @code{0.3}.
  587. @item delays
  588. Set list of time intervals in milliseconds between original signal and reflections
  589. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  590. Default is @code{1000}.
  591. @item decays
  592. Set list of loudness of reflected signals separated by '|'.
  593. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  594. Default is @code{0.5}.
  595. @end table
  596. @subsection Examples
  597. @itemize
  598. @item
  599. Make it sound as if there are twice as many instruments as are actually playing:
  600. @example
  601. aecho=0.8:0.88:60:0.4
  602. @end example
  603. @item
  604. If delay is very short, then it sounds like a (metallic) robot playing music:
  605. @example
  606. aecho=0.8:0.88:6:0.4
  607. @end example
  608. @item
  609. A longer delay will sound like an open air concert in the mountains:
  610. @example
  611. aecho=0.8:0.9:1000:0.3
  612. @end example
  613. @item
  614. Same as above but with one more mountain:
  615. @example
  616. aecho=0.8:0.9:1000|1800:0.3|0.25
  617. @end example
  618. @end itemize
  619. @section aemphasis
  620. Audio emphasis filter creates or restores material directly taken from LPs or
  621. emphased CDs with different filter curves. E.g. to store music on vinyl the
  622. signal has to be altered by a filter first to even out the disadvantages of
  623. this recording medium.
  624. Once the material is played back the inverse filter has to be applied to
  625. restore the distortion of the frequency response.
  626. The filter accepts the following options:
  627. @table @option
  628. @item level_in
  629. Set input gain.
  630. @item level_out
  631. Set output gain.
  632. @item mode
  633. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  634. use @code{production} mode. Default is @code{reproduction} mode.
  635. @item type
  636. Set filter type. Selects medium. Can be one of the following:
  637. @table @option
  638. @item col
  639. select Columbia.
  640. @item emi
  641. select EMI.
  642. @item bsi
  643. select BSI (78RPM).
  644. @item riaa
  645. select RIAA.
  646. @item cd
  647. select Compact Disc (CD).
  648. @item 50fm
  649. select 50µs (FM).
  650. @item 75fm
  651. select 75µs (FM).
  652. @item 50kf
  653. select 50µs (FM-KF).
  654. @item 75kf
  655. select 75µs (FM-KF).
  656. @end table
  657. @end table
  658. @section aeval
  659. Modify an audio signal according to the specified expressions.
  660. This filter accepts one or more expressions (one for each channel),
  661. which are evaluated and used to modify a corresponding audio signal.
  662. It accepts the following parameters:
  663. @table @option
  664. @item exprs
  665. Set the '|'-separated expressions list for each separate channel. If
  666. the number of input channels is greater than the number of
  667. expressions, the last specified expression is used for the remaining
  668. output channels.
  669. @item channel_layout, c
  670. Set output channel layout. If not specified, the channel layout is
  671. specified by the number of expressions. If set to @samp{same}, it will
  672. use by default the same input channel layout.
  673. @end table
  674. Each expression in @var{exprs} can contain the following constants and functions:
  675. @table @option
  676. @item ch
  677. channel number of the current expression
  678. @item n
  679. number of the evaluated sample, starting from 0
  680. @item s
  681. sample rate
  682. @item t
  683. time of the evaluated sample expressed in seconds
  684. @item nb_in_channels
  685. @item nb_out_channels
  686. input and output number of channels
  687. @item val(CH)
  688. the value of input channel with number @var{CH}
  689. @end table
  690. Note: this filter is slow. For faster processing you should use a
  691. dedicated filter.
  692. @subsection Examples
  693. @itemize
  694. @item
  695. Half volume:
  696. @example
  697. aeval=val(ch)/2:c=same
  698. @end example
  699. @item
  700. Invert phase of the second channel:
  701. @example
  702. aeval=val(0)|-val(1)
  703. @end example
  704. @end itemize
  705. @anchor{afade}
  706. @section afade
  707. Apply fade-in/out effect to input audio.
  708. A description of the accepted parameters follows.
  709. @table @option
  710. @item type, t
  711. Specify the effect type, can be either @code{in} for fade-in, or
  712. @code{out} for a fade-out effect. Default is @code{in}.
  713. @item start_sample, ss
  714. Specify the number of the start sample for starting to apply the fade
  715. effect. Default is 0.
  716. @item nb_samples, ns
  717. Specify the number of samples for which the fade effect has to last. At
  718. the end of the fade-in effect the output audio will have the same
  719. volume as the input audio, at the end of the fade-out transition
  720. the output audio will be silence. Default is 44100.
  721. @item start_time, st
  722. Specify the start time of the fade effect. Default is 0.
  723. The value must be specified as a time duration; see
  724. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  725. for the accepted syntax.
  726. If set this option is used instead of @var{start_sample}.
  727. @item duration, d
  728. Specify the duration of the fade effect. See
  729. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  730. for the accepted syntax.
  731. At the end of the fade-in effect the output audio will have the same
  732. volume as the input audio, at the end of the fade-out transition
  733. the output audio will be silence.
  734. By default the duration is determined by @var{nb_samples}.
  735. If set this option is used instead of @var{nb_samples}.
  736. @item curve
  737. Set curve for fade transition.
  738. It accepts the following values:
  739. @table @option
  740. @item tri
  741. select triangular, linear slope (default)
  742. @item qsin
  743. select quarter of sine wave
  744. @item hsin
  745. select half of sine wave
  746. @item esin
  747. select exponential sine wave
  748. @item log
  749. select logarithmic
  750. @item ipar
  751. select inverted parabola
  752. @item qua
  753. select quadratic
  754. @item cub
  755. select cubic
  756. @item squ
  757. select square root
  758. @item cbr
  759. select cubic root
  760. @item par
  761. select parabola
  762. @item exp
  763. select exponential
  764. @item iqsin
  765. select inverted quarter of sine wave
  766. @item ihsin
  767. select inverted half of sine wave
  768. @item dese
  769. select double-exponential seat
  770. @item desi
  771. select double-exponential sigmoid
  772. @item losi
  773. select logistic sigmoid
  774. @item nofade
  775. no fade applied
  776. @end table
  777. @end table
  778. @subsection Examples
  779. @itemize
  780. @item
  781. Fade in first 15 seconds of audio:
  782. @example
  783. afade=t=in:ss=0:d=15
  784. @end example
  785. @item
  786. Fade out last 25 seconds of a 900 seconds audio:
  787. @example
  788. afade=t=out:st=875:d=25
  789. @end example
  790. @end itemize
  791. @section afftdn
  792. Denoise audio samples with FFT.
  793. A description of the accepted parameters follows.
  794. @table @option
  795. @item nr
  796. Set the noise reduction in dB, allowed range is 0.01 to 97.
  797. Default value is 12 dB.
  798. @item nf
  799. Set the noise floor in dB, allowed range is -80 to -20.
  800. Default value is -50 dB.
  801. @item nt
  802. Set the noise type.
  803. It accepts the following values:
  804. @table @option
  805. @item w
  806. Select white noise.
  807. @item v
  808. Select vinyl noise.
  809. @item s
  810. Select shellac noise.
  811. @item c
  812. Select custom noise, defined in @code{bn} option.
  813. Default value is white noise.
  814. @end table
  815. @item bn
  816. Set custom band noise for every one of 15 bands.
  817. Bands are separated by ' ' or '|'.
  818. @item rf
  819. Set the residual floor in dB, allowed range is -80 to -20.
  820. Default value is -38 dB.
  821. @item tn
  822. Enable noise tracking. By default is disabled.
  823. With this enabled, noise floor is automatically adjusted.
  824. @item tr
  825. Enable residual tracking. By default is disabled.
  826. @item om
  827. Set the output mode.
  828. It accepts the following values:
  829. @table @option
  830. @item i
  831. Pass input unchanged.
  832. @item o
  833. Pass noise filtered out.
  834. @item n
  835. Pass only noise.
  836. Default value is @var{o}.
  837. @end table
  838. @end table
  839. @subsection Commands
  840. This filter supports the following commands:
  841. @table @option
  842. @item sample_noise, sn
  843. Start or stop measuring noise profile.
  844. Syntax for the command is : "start" or "stop" string.
  845. After measuring noise profile is stopped it will be
  846. automatically applied in filtering.
  847. @item noise_reduction, nr
  848. Change noise reduction. Argument is single float number.
  849. Syntax for the command is : "@var{noise_reduction}"
  850. @item noise_floor, nf
  851. Change noise floor. Argument is single float number.
  852. Syntax for the command is : "@var{noise_floor}"
  853. @item output_mode, om
  854. Change output mode operation.
  855. Syntax for the command is : "i", "o" or "n" string.
  856. @end table
  857. @section afftfilt
  858. Apply arbitrary expressions to samples in frequency domain.
  859. @table @option
  860. @item real
  861. Set frequency domain real expression for each separate channel separated
  862. by '|'. Default is "re".
  863. If the number of input channels is greater than the number of
  864. expressions, the last specified expression is used for the remaining
  865. output channels.
  866. @item imag
  867. Set frequency domain imaginary expression for each separate channel
  868. separated by '|'. Default is "im".
  869. Each expression in @var{real} and @var{imag} can contain the following
  870. constants and functions:
  871. @table @option
  872. @item sr
  873. sample rate
  874. @item b
  875. current frequency bin number
  876. @item nb
  877. number of available bins
  878. @item ch
  879. channel number of the current expression
  880. @item chs
  881. number of channels
  882. @item pts
  883. current frame pts
  884. @item re
  885. current real part of frequency bin of current channel
  886. @item im
  887. current imaginary part of frequency bin of current channel
  888. @item real(b, ch)
  889. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  890. @item imag(b, ch)
  891. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  892. @end table
  893. @item win_size
  894. Set window size. Allowed range is from 16 to 131072.
  895. Default is @code{4096}
  896. @item win_func
  897. Set window function. Default is @code{hann}.
  898. @item overlap
  899. Set window overlap. If set to 1, the recommended overlap for selected
  900. window function will be picked. Default is @code{0.75}.
  901. @end table
  902. @subsection Examples
  903. @itemize
  904. @item
  905. Leave almost only low frequencies in audio:
  906. @example
  907. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  908. @end example
  909. @item
  910. Apply robotize effect:
  911. @example
  912. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  913. @end example
  914. @item
  915. Apply whisper effect:
  916. @example
  917. afftfilt="real='hypot(re,im)*cos((random(0)*2-1)*2*3.14)':imag='hypot(re,im)*sin((random(1)*2-1)*2*3.14)':win_size=128:overlap=0.8"
  918. @end example
  919. @end itemize
  920. @anchor{afir}
  921. @section afir
  922. Apply an arbitrary Finite Impulse Response filter.
  923. This filter is designed for applying long FIR filters,
  924. up to 60 seconds long.
  925. It can be used as component for digital crossover filters,
  926. room equalization, cross talk cancellation, wavefield synthesis,
  927. auralization, ambiophonics, ambisonics and spatialization.
  928. This filter uses the streams higher than first one as FIR coefficients.
  929. If the non-first stream holds a single channel, it will be used
  930. for all input channels in the first stream, otherwise
  931. the number of channels in the non-first stream must be same as
  932. the number of channels in the first stream.
  933. It accepts the following parameters:
  934. @table @option
  935. @item dry
  936. Set dry gain. This sets input gain.
  937. @item wet
  938. Set wet gain. This sets final output gain.
  939. @item length
  940. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  941. @item gtype
  942. Enable applying gain measured from power of IR.
  943. Set which approach to use for auto gain measurement.
  944. @table @option
  945. @item none
  946. Do not apply any gain.
  947. @item peak
  948. select peak gain, very conservative approach. This is default value.
  949. @item dc
  950. select DC gain, limited application.
  951. @item gn
  952. select gain to noise approach, this is most popular one.
  953. @end table
  954. @item irgain
  955. Set gain to be applied to IR coefficients before filtering.
  956. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  957. @item irfmt
  958. Set format of IR stream. Can be @code{mono} or @code{input}.
  959. Default is @code{input}.
  960. @item maxir
  961. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  962. Allowed range is 0.1 to 60 seconds.
  963. @item response
  964. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  965. By default it is disabled.
  966. @item channel
  967. Set for which IR channel to display frequency response. By default is first channel
  968. displayed. This option is used only when @var{response} is enabled.
  969. @item size
  970. Set video stream size. This option is used only when @var{response} is enabled.
  971. @item rate
  972. Set video stream frame rate. This option is used only when @var{response} is enabled.
  973. @item minp
  974. Set minimal partition size used for convolution. Default is @var{8192}.
  975. Allowed range is from @var{1} to @var{32768}.
  976. Lower values decreases latency at cost of higher CPU usage.
  977. @item maxp
  978. Set maximal partition size used for convolution. Default is @var{8192}.
  979. Allowed range is from @var{8} to @var{32768}.
  980. Lower values may increase CPU usage.
  981. @item nbirs
  982. Set number of input impulse responses streams which will be switchable at runtime.
  983. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  984. @item ir
  985. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  986. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  987. This option can be changed at runtime via @ref{commands}.
  988. @end table
  989. @subsection Examples
  990. @itemize
  991. @item
  992. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  993. @example
  994. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  995. @end example
  996. @end itemize
  997. @anchor{aformat}
  998. @section aformat
  999. Set output format constraints for the input audio. The framework will
  1000. negotiate the most appropriate format to minimize conversions.
  1001. It accepts the following parameters:
  1002. @table @option
  1003. @item sample_fmts, f
  1004. A '|'-separated list of requested sample formats.
  1005. @item sample_rates, r
  1006. A '|'-separated list of requested sample rates.
  1007. @item channel_layouts, cl
  1008. A '|'-separated list of requested channel layouts.
  1009. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1010. for the required syntax.
  1011. @end table
  1012. If a parameter is omitted, all values are allowed.
  1013. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1014. @example
  1015. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1016. @end example
  1017. @section agate
  1018. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1019. processing reduces disturbing noise between useful signals.
  1020. Gating is done by detecting the volume below a chosen level @var{threshold}
  1021. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1022. floor is set via @var{range}. Because an exact manipulation of the signal
  1023. would cause distortion of the waveform the reduction can be levelled over
  1024. time. This is done by setting @var{attack} and @var{release}.
  1025. @var{attack} determines how long the signal has to fall below the threshold
  1026. before any reduction will occur and @var{release} sets the time the signal
  1027. has to rise above the threshold to reduce the reduction again.
  1028. Shorter signals than the chosen attack time will be left untouched.
  1029. @table @option
  1030. @item level_in
  1031. Set input level before filtering.
  1032. Default is 1. Allowed range is from 0.015625 to 64.
  1033. @item mode
  1034. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1035. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1036. will be amplified, expanding dynamic range in upward direction.
  1037. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1038. @item range
  1039. Set the level of gain reduction when the signal is below the threshold.
  1040. Default is 0.06125. Allowed range is from 0 to 1.
  1041. Setting this to 0 disables reduction and then filter behaves like expander.
  1042. @item threshold
  1043. If a signal rises above this level the gain reduction is released.
  1044. Default is 0.125. Allowed range is from 0 to 1.
  1045. @item ratio
  1046. Set a ratio by which the signal is reduced.
  1047. Default is 2. Allowed range is from 1 to 9000.
  1048. @item attack
  1049. Amount of milliseconds the signal has to rise above the threshold before gain
  1050. reduction stops.
  1051. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1052. @item release
  1053. Amount of milliseconds the signal has to fall below the threshold before the
  1054. reduction is increased again. Default is 250 milliseconds.
  1055. Allowed range is from 0.01 to 9000.
  1056. @item makeup
  1057. Set amount of amplification of signal after processing.
  1058. Default is 1. Allowed range is from 1 to 64.
  1059. @item knee
  1060. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1061. Default is 2.828427125. Allowed range is from 1 to 8.
  1062. @item detection
  1063. Choose if exact signal should be taken for detection or an RMS like one.
  1064. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1065. @item link
  1066. Choose if the average level between all channels or the louder channel affects
  1067. the reduction.
  1068. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1069. @end table
  1070. @section aiir
  1071. Apply an arbitrary Infinite Impulse Response filter.
  1072. It accepts the following parameters:
  1073. @table @option
  1074. @item zeros, z
  1075. Set numerator/zeros coefficients.
  1076. @item poles, p
  1077. Set denominator/poles coefficients.
  1078. @item gains, k
  1079. Set channels gains.
  1080. @item dry_gain
  1081. Set input gain.
  1082. @item wet_gain
  1083. Set output gain.
  1084. @item format, f
  1085. Set coefficients format.
  1086. @table @samp
  1087. @item tf
  1088. digital transfer function
  1089. @item zp
  1090. Z-plane zeros/poles, cartesian (default)
  1091. @item pr
  1092. Z-plane zeros/poles, polar radians
  1093. @item pd
  1094. Z-plane zeros/poles, polar degrees
  1095. @item sp
  1096. S-plane zeros/poles
  1097. @end table
  1098. @item process, r
  1099. Set kind of processing.
  1100. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1101. @item precision, e
  1102. Set filtering precision.
  1103. @table @samp
  1104. @item dbl
  1105. double-precision floating-point (default)
  1106. @item flt
  1107. single-precision floating-point
  1108. @item i32
  1109. 32-bit integers
  1110. @item i16
  1111. 16-bit integers
  1112. @end table
  1113. @item normalize, n
  1114. Normalize filter coefficients, by default is enabled.
  1115. Enabling it will normalize magnitude response at DC to 0dB.
  1116. @item mix
  1117. How much to use filtered signal in output. Default is 1.
  1118. Range is between 0 and 1.
  1119. @item response
  1120. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1121. By default it is disabled.
  1122. @item channel
  1123. Set for which IR channel to display frequency response. By default is first channel
  1124. displayed. This option is used only when @var{response} is enabled.
  1125. @item size
  1126. Set video stream size. This option is used only when @var{response} is enabled.
  1127. @end table
  1128. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1129. order.
  1130. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1131. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1132. imaginary unit.
  1133. Different coefficients and gains can be provided for every channel, in such case
  1134. use '|' to separate coefficients or gains. Last provided coefficients will be
  1135. used for all remaining channels.
  1136. @subsection Examples
  1137. @itemize
  1138. @item
  1139. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1140. @example
  1141. 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
  1142. @end example
  1143. @item
  1144. Same as above but in @code{zp} format:
  1145. @example
  1146. 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
  1147. @end example
  1148. @end itemize
  1149. @section alimiter
  1150. The limiter prevents an input signal from rising over a desired threshold.
  1151. This limiter uses lookahead technology to prevent your signal from distorting.
  1152. It means that there is a small delay after the signal is processed. Keep in mind
  1153. that the delay it produces is the attack time you set.
  1154. The filter accepts the following options:
  1155. @table @option
  1156. @item level_in
  1157. Set input gain. Default is 1.
  1158. @item level_out
  1159. Set output gain. Default is 1.
  1160. @item limit
  1161. Don't let signals above this level pass the limiter. Default is 1.
  1162. @item attack
  1163. The limiter will reach its attenuation level in this amount of time in
  1164. milliseconds. Default is 5 milliseconds.
  1165. @item release
  1166. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1167. Default is 50 milliseconds.
  1168. @item asc
  1169. When gain reduction is always needed ASC takes care of releasing to an
  1170. average reduction level rather than reaching a reduction of 0 in the release
  1171. time.
  1172. @item asc_level
  1173. Select how much the release time is affected by ASC, 0 means nearly no changes
  1174. in release time while 1 produces higher release times.
  1175. @item level
  1176. Auto level output signal. Default is enabled.
  1177. This normalizes audio back to 0dB if enabled.
  1178. @end table
  1179. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1180. with @ref{aresample} before applying this filter.
  1181. @section allpass
  1182. Apply a two-pole all-pass filter with central frequency (in Hz)
  1183. @var{frequency}, and filter-width @var{width}.
  1184. An all-pass filter changes the audio's frequency to phase relationship
  1185. without changing its frequency to amplitude relationship.
  1186. The filter accepts the following options:
  1187. @table @option
  1188. @item frequency, f
  1189. Set frequency in Hz.
  1190. @item width_type, t
  1191. Set method to specify band-width of filter.
  1192. @table @option
  1193. @item h
  1194. Hz
  1195. @item q
  1196. Q-Factor
  1197. @item o
  1198. octave
  1199. @item s
  1200. slope
  1201. @item k
  1202. kHz
  1203. @end table
  1204. @item width, w
  1205. Specify the band-width of a filter in width_type units.
  1206. @item mix, m
  1207. How much to use filtered signal in output. Default is 1.
  1208. Range is between 0 and 1.
  1209. @item channels, c
  1210. Specify which channels to filter, by default all available are filtered.
  1211. @item normalize, n
  1212. Normalize biquad coefficients, by default is disabled.
  1213. Enabling it will normalize magnitude response at DC to 0dB.
  1214. @item order, o
  1215. Set the filter order, can be 1 or 2. Default is 2.
  1216. @item transform, a
  1217. Set transform type of IIR filter.
  1218. @table @option
  1219. @item di
  1220. @item dii
  1221. @item tdii
  1222. @end table
  1223. @end table
  1224. @subsection Commands
  1225. This filter supports the following commands:
  1226. @table @option
  1227. @item frequency, f
  1228. Change allpass frequency.
  1229. Syntax for the command is : "@var{frequency}"
  1230. @item width_type, t
  1231. Change allpass width_type.
  1232. Syntax for the command is : "@var{width_type}"
  1233. @item width, w
  1234. Change allpass width.
  1235. Syntax for the command is : "@var{width}"
  1236. @item mix, m
  1237. Change allpass mix.
  1238. Syntax for the command is : "@var{mix}"
  1239. @end table
  1240. @section aloop
  1241. Loop audio samples.
  1242. The filter accepts the following options:
  1243. @table @option
  1244. @item loop
  1245. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1246. Default is 0.
  1247. @item size
  1248. Set maximal number of samples. Default is 0.
  1249. @item start
  1250. Set first sample of loop. Default is 0.
  1251. @end table
  1252. @anchor{amerge}
  1253. @section amerge
  1254. Merge two or more audio streams into a single multi-channel stream.
  1255. The filter accepts the following options:
  1256. @table @option
  1257. @item inputs
  1258. Set the number of inputs. Default is 2.
  1259. @end table
  1260. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1261. the channel layout of the output will be set accordingly and the channels
  1262. will be reordered as necessary. If the channel layouts of the inputs are not
  1263. disjoint, the output will have all the channels of the first input then all
  1264. the channels of the second input, in that order, and the channel layout of
  1265. the output will be the default value corresponding to the total number of
  1266. channels.
  1267. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1268. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1269. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1270. first input, b1 is the first channel of the second input).
  1271. On the other hand, if both input are in stereo, the output channels will be
  1272. in the default order: a1, a2, b1, b2, and the channel layout will be
  1273. arbitrarily set to 4.0, which may or may not be the expected value.
  1274. All inputs must have the same sample rate, and format.
  1275. If inputs do not have the same duration, the output will stop with the
  1276. shortest.
  1277. @subsection Examples
  1278. @itemize
  1279. @item
  1280. Merge two mono files into a stereo stream:
  1281. @example
  1282. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1283. @end example
  1284. @item
  1285. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1286. @example
  1287. 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
  1288. @end example
  1289. @end itemize
  1290. @section amix
  1291. Mixes multiple audio inputs into a single output.
  1292. Note that this filter only supports float samples (the @var{amerge}
  1293. and @var{pan} audio filters support many formats). If the @var{amix}
  1294. input has integer samples then @ref{aresample} will be automatically
  1295. inserted to perform the conversion to float samples.
  1296. For example
  1297. @example
  1298. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1299. @end example
  1300. will mix 3 input audio streams to a single output with the same duration as the
  1301. first input and a dropout transition time of 3 seconds.
  1302. It accepts the following parameters:
  1303. @table @option
  1304. @item inputs
  1305. The number of inputs. If unspecified, it defaults to 2.
  1306. @item duration
  1307. How to determine the end-of-stream.
  1308. @table @option
  1309. @item longest
  1310. The duration of the longest input. (default)
  1311. @item shortest
  1312. The duration of the shortest input.
  1313. @item first
  1314. The duration of the first input.
  1315. @end table
  1316. @item dropout_transition
  1317. The transition time, in seconds, for volume renormalization when an input
  1318. stream ends. The default value is 2 seconds.
  1319. @item weights
  1320. Specify weight of each input audio stream as sequence.
  1321. Each weight is separated by space. By default all inputs have same weight.
  1322. @end table
  1323. @subsection Commands
  1324. This filter supports the following commands:
  1325. @table @option
  1326. @item weights
  1327. Syntax is same as option with same name.
  1328. @end table
  1329. @section amultiply
  1330. Multiply first audio stream with second audio stream and store result
  1331. in output audio stream. Multiplication is done by multiplying each
  1332. sample from first stream with sample at same position from second stream.
  1333. With this element-wise multiplication one can create amplitude fades and
  1334. amplitude modulations.
  1335. @section anequalizer
  1336. High-order parametric multiband equalizer for each channel.
  1337. It accepts the following parameters:
  1338. @table @option
  1339. @item params
  1340. This option string is in format:
  1341. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1342. Each equalizer band is separated by '|'.
  1343. @table @option
  1344. @item chn
  1345. Set channel number to which equalization will be applied.
  1346. If input doesn't have that channel the entry is ignored.
  1347. @item f
  1348. Set central frequency for band.
  1349. If input doesn't have that frequency the entry is ignored.
  1350. @item w
  1351. Set band width in hertz.
  1352. @item g
  1353. Set band gain in dB.
  1354. @item t
  1355. Set filter type for band, optional, can be:
  1356. @table @samp
  1357. @item 0
  1358. Butterworth, this is default.
  1359. @item 1
  1360. Chebyshev type 1.
  1361. @item 2
  1362. Chebyshev type 2.
  1363. @end table
  1364. @end table
  1365. @item curves
  1366. With this option activated frequency response of anequalizer is displayed
  1367. in video stream.
  1368. @item size
  1369. Set video stream size. Only useful if curves option is activated.
  1370. @item mgain
  1371. Set max gain that will be displayed. Only useful if curves option is activated.
  1372. Setting this to a reasonable value makes it possible to display gain which is derived from
  1373. neighbour bands which are too close to each other and thus produce higher gain
  1374. when both are activated.
  1375. @item fscale
  1376. Set frequency scale used to draw frequency response in video output.
  1377. Can be linear or logarithmic. Default is logarithmic.
  1378. @item colors
  1379. Set color for each channel curve which is going to be displayed in video stream.
  1380. This is list of color names separated by space or by '|'.
  1381. Unrecognised or missing colors will be replaced by white color.
  1382. @end table
  1383. @subsection Examples
  1384. @itemize
  1385. @item
  1386. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1387. for first 2 channels using Chebyshev type 1 filter:
  1388. @example
  1389. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1390. @end example
  1391. @end itemize
  1392. @subsection Commands
  1393. This filter supports the following commands:
  1394. @table @option
  1395. @item change
  1396. Alter existing filter parameters.
  1397. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1398. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1399. error is returned.
  1400. @var{freq} set new frequency parameter.
  1401. @var{width} set new width parameter in herz.
  1402. @var{gain} set new gain parameter in dB.
  1403. Full filter invocation with asendcmd may look like this:
  1404. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1405. @end table
  1406. @section anlmdn
  1407. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1408. Each sample is adjusted by looking for other samples with similar contexts. This
  1409. context similarity is defined by comparing their surrounding patches of size
  1410. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1411. The filter accepts the following options:
  1412. @table @option
  1413. @item s
  1414. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1415. @item p
  1416. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1417. Default value is 2 milliseconds.
  1418. @item r
  1419. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1420. Default value is 6 milliseconds.
  1421. @item o
  1422. Set the output mode.
  1423. It accepts the following values:
  1424. @table @option
  1425. @item i
  1426. Pass input unchanged.
  1427. @item o
  1428. Pass noise filtered out.
  1429. @item n
  1430. Pass only noise.
  1431. Default value is @var{o}.
  1432. @end table
  1433. @item m
  1434. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1435. @end table
  1436. @subsection Commands
  1437. This filter supports the following commands:
  1438. @table @option
  1439. @item s
  1440. Change denoise strength. Argument is single float number.
  1441. Syntax for the command is : "@var{s}"
  1442. @item o
  1443. Change output mode.
  1444. Syntax for the command is : "i", "o" or "n" string.
  1445. @end table
  1446. @section anlms
  1447. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1448. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1449. relate to producing the least mean square of the error signal (difference between the desired,
  1450. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1451. A description of the accepted options follows.
  1452. @table @option
  1453. @item order
  1454. Set filter order.
  1455. @item mu
  1456. Set filter mu.
  1457. @item eps
  1458. Set the filter eps.
  1459. @item leakage
  1460. Set the filter leakage.
  1461. @item out_mode
  1462. It accepts the following values:
  1463. @table @option
  1464. @item i
  1465. Pass the 1st input.
  1466. @item d
  1467. Pass the 2nd input.
  1468. @item o
  1469. Pass filtered samples.
  1470. @item n
  1471. Pass difference between desired and filtered samples.
  1472. Default value is @var{o}.
  1473. @end table
  1474. @end table
  1475. @subsection Examples
  1476. @itemize
  1477. @item
  1478. One of many usages of this filter is noise reduction, input audio is filtered
  1479. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1480. @example
  1481. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1482. @end example
  1483. @end itemize
  1484. @subsection Commands
  1485. This filter supports the same commands as options, excluding option @code{order}.
  1486. @section anull
  1487. Pass the audio source unchanged to the output.
  1488. @section apad
  1489. Pad the end of an audio stream with silence.
  1490. This can be used together with @command{ffmpeg} @option{-shortest} to
  1491. extend audio streams to the same length as the video stream.
  1492. A description of the accepted options follows.
  1493. @table @option
  1494. @item packet_size
  1495. Set silence packet size. Default value is 4096.
  1496. @item pad_len
  1497. Set the number of samples of silence to add to the end. After the
  1498. value is reached, the stream is terminated. This option is mutually
  1499. exclusive with @option{whole_len}.
  1500. @item whole_len
  1501. Set the minimum total number of samples in the output audio stream. If
  1502. the value is longer than the input audio length, silence is added to
  1503. the end, until the value is reached. This option is mutually exclusive
  1504. with @option{pad_len}.
  1505. @item pad_dur
  1506. Specify the duration of samples of silence to add. See
  1507. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1508. for the accepted syntax. Used only if set to non-zero value.
  1509. @item whole_dur
  1510. Specify the minimum total duration in the output audio stream. See
  1511. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1512. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1513. the input audio length, silence is added to the end, until the value is reached.
  1514. This option is mutually exclusive with @option{pad_dur}
  1515. @end table
  1516. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1517. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1518. the input stream indefinitely.
  1519. @subsection Examples
  1520. @itemize
  1521. @item
  1522. Add 1024 samples of silence to the end of the input:
  1523. @example
  1524. apad=pad_len=1024
  1525. @end example
  1526. @item
  1527. Make sure the audio output will contain at least 10000 samples, pad
  1528. the input with silence if required:
  1529. @example
  1530. apad=whole_len=10000
  1531. @end example
  1532. @item
  1533. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1534. video stream will always result the shortest and will be converted
  1535. until the end in the output file when using the @option{shortest}
  1536. option:
  1537. @example
  1538. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1539. @end example
  1540. @end itemize
  1541. @section aphaser
  1542. Add a phasing effect to the input audio.
  1543. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1544. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1545. A description of the accepted parameters follows.
  1546. @table @option
  1547. @item in_gain
  1548. Set input gain. Default is 0.4.
  1549. @item out_gain
  1550. Set output gain. Default is 0.74
  1551. @item delay
  1552. Set delay in milliseconds. Default is 3.0.
  1553. @item decay
  1554. Set decay. Default is 0.4.
  1555. @item speed
  1556. Set modulation speed in Hz. Default is 0.5.
  1557. @item type
  1558. Set modulation type. Default is triangular.
  1559. It accepts the following values:
  1560. @table @samp
  1561. @item triangular, t
  1562. @item sinusoidal, s
  1563. @end table
  1564. @end table
  1565. @section apulsator
  1566. Audio pulsator is something between an autopanner and a tremolo.
  1567. But it can produce funny stereo effects as well. Pulsator changes the volume
  1568. of the left and right channel based on a LFO (low frequency oscillator) with
  1569. different waveforms and shifted phases.
  1570. This filter have the ability to define an offset between left and right
  1571. channel. An offset of 0 means that both LFO shapes match each other.
  1572. The left and right channel are altered equally - a conventional tremolo.
  1573. An offset of 50% means that the shape of the right channel is exactly shifted
  1574. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1575. an autopanner. At 1 both curves match again. Every setting in between moves the
  1576. phase shift gapless between all stages and produces some "bypassing" sounds with
  1577. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1578. the 0.5) the faster the signal passes from the left to the right speaker.
  1579. The filter accepts the following options:
  1580. @table @option
  1581. @item level_in
  1582. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1583. @item level_out
  1584. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1585. @item mode
  1586. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1587. sawup or sawdown. Default is sine.
  1588. @item amount
  1589. Set modulation. Define how much of original signal is affected by the LFO.
  1590. @item offset_l
  1591. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1592. @item offset_r
  1593. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1594. @item width
  1595. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1596. @item timing
  1597. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1598. @item bpm
  1599. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1600. is set to bpm.
  1601. @item ms
  1602. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1603. is set to ms.
  1604. @item hz
  1605. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1606. if timing is set to hz.
  1607. @end table
  1608. @anchor{aresample}
  1609. @section aresample
  1610. Resample the input audio to the specified parameters, using the
  1611. libswresample library. If none are specified then the filter will
  1612. automatically convert between its input and output.
  1613. This filter is also able to stretch/squeeze the audio data to make it match
  1614. the timestamps or to inject silence / cut out audio to make it match the
  1615. timestamps, do a combination of both or do neither.
  1616. The filter accepts the syntax
  1617. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1618. expresses a sample rate and @var{resampler_options} is a list of
  1619. @var{key}=@var{value} pairs, separated by ":". See the
  1620. @ref{Resampler Options,,"Resampler Options" section in the
  1621. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1622. for the complete list of supported options.
  1623. @subsection Examples
  1624. @itemize
  1625. @item
  1626. Resample the input audio to 44100Hz:
  1627. @example
  1628. aresample=44100
  1629. @end example
  1630. @item
  1631. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1632. samples per second compensation:
  1633. @example
  1634. aresample=async=1000
  1635. @end example
  1636. @end itemize
  1637. @section areverse
  1638. Reverse an audio clip.
  1639. Warning: This filter requires memory to buffer the entire clip, so trimming
  1640. is suggested.
  1641. @subsection Examples
  1642. @itemize
  1643. @item
  1644. Take the first 5 seconds of a clip, and reverse it.
  1645. @example
  1646. atrim=end=5,areverse
  1647. @end example
  1648. @end itemize
  1649. @section arnndn
  1650. Reduce noise from speech using Recurrent Neural Networks.
  1651. This filter accepts the following options:
  1652. @table @option
  1653. @item model, m
  1654. Set train model file to load. This option is always required.
  1655. @end table
  1656. @section asetnsamples
  1657. Set the number of samples per each output audio frame.
  1658. The last output packet may contain a different number of samples, as
  1659. the filter will flush all the remaining samples when the input audio
  1660. signals its end.
  1661. The filter accepts the following options:
  1662. @table @option
  1663. @item nb_out_samples, n
  1664. Set the number of frames per each output audio frame. The number is
  1665. intended as the number of samples @emph{per each channel}.
  1666. Default value is 1024.
  1667. @item pad, p
  1668. If set to 1, the filter will pad the last audio frame with zeroes, so
  1669. that the last frame will contain the same number of samples as the
  1670. previous ones. Default value is 1.
  1671. @end table
  1672. For example, to set the number of per-frame samples to 1234 and
  1673. disable padding for the last frame, use:
  1674. @example
  1675. asetnsamples=n=1234:p=0
  1676. @end example
  1677. @section asetrate
  1678. Set the sample rate without altering the PCM data.
  1679. This will result in a change of speed and pitch.
  1680. The filter accepts the following options:
  1681. @table @option
  1682. @item sample_rate, r
  1683. Set the output sample rate. Default is 44100 Hz.
  1684. @end table
  1685. @section ashowinfo
  1686. Show a line containing various information for each input audio frame.
  1687. The input audio is not modified.
  1688. The shown line contains a sequence of key/value pairs of the form
  1689. @var{key}:@var{value}.
  1690. The following values are shown in the output:
  1691. @table @option
  1692. @item n
  1693. The (sequential) number of the input frame, starting from 0.
  1694. @item pts
  1695. The presentation timestamp of the input frame, in time base units; the time base
  1696. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1697. @item pts_time
  1698. The presentation timestamp of the input frame in seconds.
  1699. @item pos
  1700. position of the frame in the input stream, -1 if this information in
  1701. unavailable and/or meaningless (for example in case of synthetic audio)
  1702. @item fmt
  1703. The sample format.
  1704. @item chlayout
  1705. The channel layout.
  1706. @item rate
  1707. The sample rate for the audio frame.
  1708. @item nb_samples
  1709. The number of samples (per channel) in the frame.
  1710. @item checksum
  1711. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1712. audio, the data is treated as if all the planes were concatenated.
  1713. @item plane_checksums
  1714. A list of Adler-32 checksums for each data plane.
  1715. @end table
  1716. @section asoftclip
  1717. Apply audio soft clipping.
  1718. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1719. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1720. This filter accepts the following options:
  1721. @table @option
  1722. @item type
  1723. Set type of soft-clipping.
  1724. It accepts the following values:
  1725. @table @option
  1726. @item tanh
  1727. @item atan
  1728. @item cubic
  1729. @item exp
  1730. @item alg
  1731. @item quintic
  1732. @item sin
  1733. @end table
  1734. @item param
  1735. Set additional parameter which controls sigmoid function.
  1736. @end table
  1737. @subsection Commands
  1738. This filter supports the all above options as @ref{commands}.
  1739. @section asr
  1740. Automatic Speech Recognition
  1741. This filter uses PocketSphinx for speech recognition. To enable
  1742. compilation of this filter, you need to configure FFmpeg with
  1743. @code{--enable-pocketsphinx}.
  1744. It accepts the following options:
  1745. @table @option
  1746. @item rate
  1747. Set sampling rate of input audio. Defaults is @code{16000}.
  1748. This need to match speech models, otherwise one will get poor results.
  1749. @item hmm
  1750. Set dictionary containing acoustic model files.
  1751. @item dict
  1752. Set pronunciation dictionary.
  1753. @item lm
  1754. Set language model file.
  1755. @item lmctl
  1756. Set language model set.
  1757. @item lmname
  1758. Set which language model to use.
  1759. @item logfn
  1760. Set output for log messages.
  1761. @end table
  1762. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1763. @anchor{astats}
  1764. @section astats
  1765. Display time domain statistical information about the audio channels.
  1766. Statistics are calculated and displayed for each audio channel and,
  1767. where applicable, an overall figure is also given.
  1768. It accepts the following option:
  1769. @table @option
  1770. @item length
  1771. Short window length in seconds, used for peak and trough RMS measurement.
  1772. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1773. @item metadata
  1774. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1775. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1776. disabled.
  1777. Available keys for each channel are:
  1778. DC_offset
  1779. Min_level
  1780. Max_level
  1781. Min_difference
  1782. Max_difference
  1783. Mean_difference
  1784. RMS_difference
  1785. Peak_level
  1786. RMS_peak
  1787. RMS_trough
  1788. Crest_factor
  1789. Flat_factor
  1790. Peak_count
  1791. Noise_floor
  1792. Noise_floor_count
  1793. Bit_depth
  1794. Dynamic_range
  1795. Zero_crossings
  1796. Zero_crossings_rate
  1797. Number_of_NaNs
  1798. Number_of_Infs
  1799. Number_of_denormals
  1800. and for Overall:
  1801. DC_offset
  1802. Min_level
  1803. Max_level
  1804. Min_difference
  1805. Max_difference
  1806. Mean_difference
  1807. RMS_difference
  1808. Peak_level
  1809. RMS_level
  1810. RMS_peak
  1811. RMS_trough
  1812. Flat_factor
  1813. Peak_count
  1814. Noise_floor
  1815. Noise_floor_count
  1816. Bit_depth
  1817. Number_of_samples
  1818. Number_of_NaNs
  1819. Number_of_Infs
  1820. Number_of_denormals
  1821. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1822. this @code{lavfi.astats.Overall.Peak_count}.
  1823. For description what each key means read below.
  1824. @item reset
  1825. Set number of frame after which stats are going to be recalculated.
  1826. Default is disabled.
  1827. @item measure_perchannel
  1828. Select the entries which need to be measured per channel. The metadata keys can
  1829. be used as flags, default is @option{all} which measures everything.
  1830. @option{none} disables all per channel measurement.
  1831. @item measure_overall
  1832. Select the entries which need to be measured overall. The metadata keys can
  1833. be used as flags, default is @option{all} which measures everything.
  1834. @option{none} disables all overall measurement.
  1835. @end table
  1836. A description of each shown parameter follows:
  1837. @table @option
  1838. @item DC offset
  1839. Mean amplitude displacement from zero.
  1840. @item Min level
  1841. Minimal sample level.
  1842. @item Max level
  1843. Maximal sample level.
  1844. @item Min difference
  1845. Minimal difference between two consecutive samples.
  1846. @item Max difference
  1847. Maximal difference between two consecutive samples.
  1848. @item Mean difference
  1849. Mean difference between two consecutive samples.
  1850. The average of each difference between two consecutive samples.
  1851. @item RMS difference
  1852. Root Mean Square difference between two consecutive samples.
  1853. @item Peak level dB
  1854. @item RMS level dB
  1855. Standard peak and RMS level measured in dBFS.
  1856. @item RMS peak dB
  1857. @item RMS trough dB
  1858. Peak and trough values for RMS level measured over a short window.
  1859. @item Crest factor
  1860. Standard ratio of peak to RMS level (note: not in dB).
  1861. @item Flat factor
  1862. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1863. (i.e. either @var{Min level} or @var{Max level}).
  1864. @item Peak count
  1865. Number of occasions (not the number of samples) that the signal attained either
  1866. @var{Min level} or @var{Max level}.
  1867. @item Noise floor dB
  1868. Minimum local peak measured in dBFS over a short window.
  1869. @item Noise floor count
  1870. Number of occasions (not the number of samples) that the signal attained
  1871. @var{Noise floor}.
  1872. @item Bit depth
  1873. Overall bit depth of audio. Number of bits used for each sample.
  1874. @item Dynamic range
  1875. Measured dynamic range of audio in dB.
  1876. @item Zero crossings
  1877. Number of points where the waveform crosses the zero level axis.
  1878. @item Zero crossings rate
  1879. Rate of Zero crossings and number of audio samples.
  1880. @end table
  1881. @section asubboost
  1882. Boost subwoofer frequencies.
  1883. The filter accepts the following options:
  1884. @table @option
  1885. @item dry
  1886. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  1887. Default value is 0.5.
  1888. @item wet
  1889. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  1890. Default value is 0.8.
  1891. @item decay
  1892. Set delay line decay gain value. Allowed range is from 0 to 1.
  1893. Default value is 0.7.
  1894. @item feedback
  1895. Set delay line feedback gain value. Allowed range is from 0 to 1.
  1896. Default value is 0.5.
  1897. @item cutoff
  1898. Set cutoff frequency in herz. Allowed range is 50 to 900.
  1899. Default value is 100.
  1900. @item slope
  1901. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  1902. Default value is 0.5.
  1903. @item delay
  1904. Set delay. Allowed range is from 1 to 100.
  1905. Default value is 20.
  1906. @end table
  1907. @subsection Commands
  1908. This filter supports the all above options as @ref{commands}.
  1909. @section atempo
  1910. Adjust audio tempo.
  1911. The filter accepts exactly one parameter, the audio tempo. If not
  1912. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1913. be in the [0.5, 100.0] range.
  1914. Note that tempo greater than 2 will skip some samples rather than
  1915. blend them in. If for any reason this is a concern it is always
  1916. possible to daisy-chain several instances of atempo to achieve the
  1917. desired product tempo.
  1918. @subsection Examples
  1919. @itemize
  1920. @item
  1921. Slow down audio to 80% tempo:
  1922. @example
  1923. atempo=0.8
  1924. @end example
  1925. @item
  1926. To speed up audio to 300% tempo:
  1927. @example
  1928. atempo=3
  1929. @end example
  1930. @item
  1931. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1932. @example
  1933. atempo=sqrt(3),atempo=sqrt(3)
  1934. @end example
  1935. @end itemize
  1936. @subsection Commands
  1937. This filter supports the following commands:
  1938. @table @option
  1939. @item tempo
  1940. Change filter tempo scale factor.
  1941. Syntax for the command is : "@var{tempo}"
  1942. @end table
  1943. @section atrim
  1944. Trim the input so that the output contains one continuous subpart of the input.
  1945. It accepts the following parameters:
  1946. @table @option
  1947. @item start
  1948. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1949. sample with the timestamp @var{start} will be the first sample in the output.
  1950. @item end
  1951. Specify time of the first audio sample that will be dropped, i.e. the
  1952. audio sample immediately preceding the one with the timestamp @var{end} will be
  1953. the last sample in the output.
  1954. @item start_pts
  1955. Same as @var{start}, except this option sets the start timestamp in samples
  1956. instead of seconds.
  1957. @item end_pts
  1958. Same as @var{end}, except this option sets the end timestamp in samples instead
  1959. of seconds.
  1960. @item duration
  1961. The maximum duration of the output in seconds.
  1962. @item start_sample
  1963. The number of the first sample that should be output.
  1964. @item end_sample
  1965. The number of the first sample that should be dropped.
  1966. @end table
  1967. @option{start}, @option{end}, and @option{duration} are expressed as time
  1968. duration specifications; see
  1969. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1970. Note that the first two sets of the start/end options and the @option{duration}
  1971. option look at the frame timestamp, while the _sample options simply count the
  1972. samples that pass through the filter. So start/end_pts and start/end_sample will
  1973. give different results when the timestamps are wrong, inexact or do not start at
  1974. zero. Also note that this filter does not modify the timestamps. If you wish
  1975. to have the output timestamps start at zero, insert the asetpts filter after the
  1976. atrim filter.
  1977. If multiple start or end options are set, this filter tries to be greedy and
  1978. keep all samples that match at least one of the specified constraints. To keep
  1979. only the part that matches all the constraints at once, chain multiple atrim
  1980. filters.
  1981. The defaults are such that all the input is kept. So it is possible to set e.g.
  1982. just the end values to keep everything before the specified time.
  1983. Examples:
  1984. @itemize
  1985. @item
  1986. Drop everything except the second minute of input:
  1987. @example
  1988. ffmpeg -i INPUT -af atrim=60:120
  1989. @end example
  1990. @item
  1991. Keep only the first 1000 samples:
  1992. @example
  1993. ffmpeg -i INPUT -af atrim=end_sample=1000
  1994. @end example
  1995. @end itemize
  1996. @section axcorrelate
  1997. Calculate normalized cross-correlation between two input audio streams.
  1998. Resulted samples are always between -1 and 1 inclusive.
  1999. If result is 1 it means two input samples are highly correlated in that selected segment.
  2000. Result 0 means they are not correlated at all.
  2001. If result is -1 it means two input samples are out of phase, which means they cancel each
  2002. other.
  2003. The filter accepts the following options:
  2004. @table @option
  2005. @item size
  2006. Set size of segment over which cross-correlation is calculated.
  2007. Default is 256. Allowed range is from 2 to 131072.
  2008. @item algo
  2009. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2010. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2011. are always zero and thus need much less calculations to make.
  2012. This is generally not true, but is valid for typical audio streams.
  2013. @end table
  2014. @subsection Examples
  2015. @itemize
  2016. @item
  2017. Calculate correlation between channels in stereo audio stream:
  2018. @example
  2019. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2020. @end example
  2021. @end itemize
  2022. @section bandpass
  2023. Apply a two-pole Butterworth band-pass filter with central
  2024. frequency @var{frequency}, and (3dB-point) band-width width.
  2025. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2026. instead of the default: constant 0dB peak gain.
  2027. The filter roll off at 6dB per octave (20dB per decade).
  2028. The filter accepts the following options:
  2029. @table @option
  2030. @item frequency, f
  2031. Set the filter's central frequency. Default is @code{3000}.
  2032. @item csg
  2033. Constant skirt gain if set to 1. Defaults to 0.
  2034. @item width_type, t
  2035. Set method to specify band-width of filter.
  2036. @table @option
  2037. @item h
  2038. Hz
  2039. @item q
  2040. Q-Factor
  2041. @item o
  2042. octave
  2043. @item s
  2044. slope
  2045. @item k
  2046. kHz
  2047. @end table
  2048. @item width, w
  2049. Specify the band-width of a filter in width_type units.
  2050. @item mix, m
  2051. How much to use filtered signal in output. Default is 1.
  2052. Range is between 0 and 1.
  2053. @item channels, c
  2054. Specify which channels to filter, by default all available are filtered.
  2055. @item normalize, n
  2056. Normalize biquad coefficients, by default is disabled.
  2057. Enabling it will normalize magnitude response at DC to 0dB.
  2058. @item transform, a
  2059. Set transform type of IIR filter.
  2060. @table @option
  2061. @item di
  2062. @item dii
  2063. @item tdii
  2064. @end table
  2065. @end table
  2066. @subsection Commands
  2067. This filter supports the following commands:
  2068. @table @option
  2069. @item frequency, f
  2070. Change bandpass frequency.
  2071. Syntax for the command is : "@var{frequency}"
  2072. @item width_type, t
  2073. Change bandpass width_type.
  2074. Syntax for the command is : "@var{width_type}"
  2075. @item width, w
  2076. Change bandpass width.
  2077. Syntax for the command is : "@var{width}"
  2078. @item mix, m
  2079. Change bandpass mix.
  2080. Syntax for the command is : "@var{mix}"
  2081. @end table
  2082. @section bandreject
  2083. Apply a two-pole Butterworth band-reject filter with central
  2084. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2085. The filter roll off at 6dB per octave (20dB per decade).
  2086. The filter accepts the following options:
  2087. @table @option
  2088. @item frequency, f
  2089. Set the filter's central frequency. Default is @code{3000}.
  2090. @item width_type, t
  2091. Set method to specify band-width of filter.
  2092. @table @option
  2093. @item h
  2094. Hz
  2095. @item q
  2096. Q-Factor
  2097. @item o
  2098. octave
  2099. @item s
  2100. slope
  2101. @item k
  2102. kHz
  2103. @end table
  2104. @item width, w
  2105. Specify the band-width of a filter in width_type units.
  2106. @item mix, m
  2107. How much to use filtered signal in output. Default is 1.
  2108. Range is between 0 and 1.
  2109. @item channels, c
  2110. Specify which channels to filter, by default all available are filtered.
  2111. @item normalize, n
  2112. Normalize biquad coefficients, by default is disabled.
  2113. Enabling it will normalize magnitude response at DC to 0dB.
  2114. @item transform, a
  2115. Set transform type of IIR filter.
  2116. @table @option
  2117. @item di
  2118. @item dii
  2119. @item tdii
  2120. @end table
  2121. @end table
  2122. @subsection Commands
  2123. This filter supports the following commands:
  2124. @table @option
  2125. @item frequency, f
  2126. Change bandreject frequency.
  2127. Syntax for the command is : "@var{frequency}"
  2128. @item width_type, t
  2129. Change bandreject width_type.
  2130. Syntax for the command is : "@var{width_type}"
  2131. @item width, w
  2132. Change bandreject width.
  2133. Syntax for the command is : "@var{width}"
  2134. @item mix, m
  2135. Change bandreject mix.
  2136. Syntax for the command is : "@var{mix}"
  2137. @end table
  2138. @section bass, lowshelf
  2139. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2140. shelving filter with a response similar to that of a standard
  2141. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2142. The filter accepts the following options:
  2143. @table @option
  2144. @item gain, g
  2145. Give the gain at 0 Hz. Its useful range is about -20
  2146. (for a large cut) to +20 (for a large boost).
  2147. Beware of clipping when using a positive gain.
  2148. @item frequency, f
  2149. Set the filter's central frequency and so can be used
  2150. to extend or reduce the frequency range to be boosted or cut.
  2151. The default value is @code{100} Hz.
  2152. @item width_type, t
  2153. Set method to specify band-width of filter.
  2154. @table @option
  2155. @item h
  2156. Hz
  2157. @item q
  2158. Q-Factor
  2159. @item o
  2160. octave
  2161. @item s
  2162. slope
  2163. @item k
  2164. kHz
  2165. @end table
  2166. @item width, w
  2167. Determine how steep is the filter's shelf transition.
  2168. @item mix, m
  2169. How much to use filtered signal in output. Default is 1.
  2170. Range is between 0 and 1.
  2171. @item channels, c
  2172. Specify which channels to filter, by default all available are filtered.
  2173. @item normalize, n
  2174. Normalize biquad coefficients, by default is disabled.
  2175. Enabling it will normalize magnitude response at DC to 0dB.
  2176. @item transform, a
  2177. Set transform type of IIR filter.
  2178. @table @option
  2179. @item di
  2180. @item dii
  2181. @item tdii
  2182. @end table
  2183. @end table
  2184. @subsection Commands
  2185. This filter supports the following commands:
  2186. @table @option
  2187. @item frequency, f
  2188. Change bass frequency.
  2189. Syntax for the command is : "@var{frequency}"
  2190. @item width_type, t
  2191. Change bass width_type.
  2192. Syntax for the command is : "@var{width_type}"
  2193. @item width, w
  2194. Change bass width.
  2195. Syntax for the command is : "@var{width}"
  2196. @item gain, g
  2197. Change bass gain.
  2198. Syntax for the command is : "@var{gain}"
  2199. @item mix, m
  2200. Change bass mix.
  2201. Syntax for the command is : "@var{mix}"
  2202. @end table
  2203. @section biquad
  2204. Apply a biquad IIR filter with the given coefficients.
  2205. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2206. are the numerator and denominator coefficients respectively.
  2207. and @var{channels}, @var{c} specify which channels to filter, by default all
  2208. available are filtered.
  2209. @subsection Commands
  2210. This filter supports the following commands:
  2211. @table @option
  2212. @item a0
  2213. @item a1
  2214. @item a2
  2215. @item b0
  2216. @item b1
  2217. @item b2
  2218. Change biquad parameter.
  2219. Syntax for the command is : "@var{value}"
  2220. @item mix, m
  2221. How much to use filtered signal in output. Default is 1.
  2222. Range is between 0 and 1.
  2223. @item channels, c
  2224. Specify which channels to filter, by default all available are filtered.
  2225. @item normalize, n
  2226. Normalize biquad coefficients, by default is disabled.
  2227. Enabling it will normalize magnitude response at DC to 0dB.
  2228. @item transform, a
  2229. Set transform type of IIR filter.
  2230. @table @option
  2231. @item di
  2232. @item dii
  2233. @item tdii
  2234. @end table
  2235. @end table
  2236. @section bs2b
  2237. Bauer stereo to binaural transformation, which improves headphone listening of
  2238. stereo audio records.
  2239. To enable compilation of this filter you need to configure FFmpeg with
  2240. @code{--enable-libbs2b}.
  2241. It accepts the following parameters:
  2242. @table @option
  2243. @item profile
  2244. Pre-defined crossfeed level.
  2245. @table @option
  2246. @item default
  2247. Default level (fcut=700, feed=50).
  2248. @item cmoy
  2249. Chu Moy circuit (fcut=700, feed=60).
  2250. @item jmeier
  2251. Jan Meier circuit (fcut=650, feed=95).
  2252. @end table
  2253. @item fcut
  2254. Cut frequency (in Hz).
  2255. @item feed
  2256. Feed level (in Hz).
  2257. @end table
  2258. @section channelmap
  2259. Remap input channels to new locations.
  2260. It accepts the following parameters:
  2261. @table @option
  2262. @item map
  2263. Map channels from input to output. The argument is a '|'-separated list of
  2264. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2265. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2266. channel (e.g. FL for front left) or its index in the input channel layout.
  2267. @var{out_channel} is the name of the output channel or its index in the output
  2268. channel layout. If @var{out_channel} is not given then it is implicitly an
  2269. index, starting with zero and increasing by one for each mapping.
  2270. @item channel_layout
  2271. The channel layout of the output stream.
  2272. @end table
  2273. If no mapping is present, the filter will implicitly map input channels to
  2274. output channels, preserving indices.
  2275. @subsection Examples
  2276. @itemize
  2277. @item
  2278. For example, assuming a 5.1+downmix input MOV file,
  2279. @example
  2280. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2281. @end example
  2282. will create an output WAV file tagged as stereo from the downmix channels of
  2283. the input.
  2284. @item
  2285. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2286. @example
  2287. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2288. @end example
  2289. @end itemize
  2290. @section channelsplit
  2291. Split each channel from an input audio stream into a separate output stream.
  2292. It accepts the following parameters:
  2293. @table @option
  2294. @item channel_layout
  2295. The channel layout of the input stream. The default is "stereo".
  2296. @item channels
  2297. A channel layout describing the channels to be extracted as separate output streams
  2298. or "all" to extract each input channel as a separate stream. The default is "all".
  2299. Choosing channels not present in channel layout in the input will result in an error.
  2300. @end table
  2301. @subsection Examples
  2302. @itemize
  2303. @item
  2304. For example, assuming a stereo input MP3 file,
  2305. @example
  2306. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2307. @end example
  2308. will create an output Matroska file with two audio streams, one containing only
  2309. the left channel and the other the right channel.
  2310. @item
  2311. Split a 5.1 WAV file into per-channel files:
  2312. @example
  2313. ffmpeg -i in.wav -filter_complex
  2314. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2315. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2316. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2317. side_right.wav
  2318. @end example
  2319. @item
  2320. Extract only LFE from a 5.1 WAV file:
  2321. @example
  2322. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2323. -map '[LFE]' lfe.wav
  2324. @end example
  2325. @end itemize
  2326. @section chorus
  2327. Add a chorus effect to the audio.
  2328. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2329. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2330. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2331. The modulation depth defines the range the modulated delay is played before or after
  2332. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2333. sound tuned around the original one, like in a chorus where some vocals are slightly
  2334. off key.
  2335. It accepts the following parameters:
  2336. @table @option
  2337. @item in_gain
  2338. Set input gain. Default is 0.4.
  2339. @item out_gain
  2340. Set output gain. Default is 0.4.
  2341. @item delays
  2342. Set delays. A typical delay is around 40ms to 60ms.
  2343. @item decays
  2344. Set decays.
  2345. @item speeds
  2346. Set speeds.
  2347. @item depths
  2348. Set depths.
  2349. @end table
  2350. @subsection Examples
  2351. @itemize
  2352. @item
  2353. A single delay:
  2354. @example
  2355. chorus=0.7:0.9:55:0.4:0.25:2
  2356. @end example
  2357. @item
  2358. Two delays:
  2359. @example
  2360. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2361. @end example
  2362. @item
  2363. Fuller sounding chorus with three delays:
  2364. @example
  2365. 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
  2366. @end example
  2367. @end itemize
  2368. @section compand
  2369. Compress or expand the audio's dynamic range.
  2370. It accepts the following parameters:
  2371. @table @option
  2372. @item attacks
  2373. @item decays
  2374. A list of times in seconds for each channel over which the instantaneous level
  2375. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2376. increase of volume and @var{decays} refers to decrease of volume. For most
  2377. situations, the attack time (response to the audio getting louder) should be
  2378. shorter than the decay time, because the human ear is more sensitive to sudden
  2379. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2380. a typical value for decay is 0.8 seconds.
  2381. If specified number of attacks & decays is lower than number of channels, the last
  2382. set attack/decay will be used for all remaining channels.
  2383. @item points
  2384. A list of points for the transfer function, specified in dB relative to the
  2385. maximum possible signal amplitude. Each key points list must be defined using
  2386. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2387. @code{x0/y0 x1/y1 x2/y2 ....}
  2388. The input values must be in strictly increasing order but the transfer function
  2389. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2390. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2391. function are @code{-70/-70|-60/-20|1/0}.
  2392. @item soft-knee
  2393. Set the curve radius in dB for all joints. It defaults to 0.01.
  2394. @item gain
  2395. Set the additional gain in dB to be applied at all points on the transfer
  2396. function. This allows for easy adjustment of the overall gain.
  2397. It defaults to 0.
  2398. @item volume
  2399. Set an initial volume, in dB, to be assumed for each channel when filtering
  2400. starts. This permits the user to supply a nominal level initially, so that, for
  2401. example, a very large gain is not applied to initial signal levels before the
  2402. companding has begun to operate. A typical value for audio which is initially
  2403. quiet is -90 dB. It defaults to 0.
  2404. @item delay
  2405. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2406. delayed before being fed to the volume adjuster. Specifying a delay
  2407. approximately equal to the attack/decay times allows the filter to effectively
  2408. operate in predictive rather than reactive mode. It defaults to 0.
  2409. @end table
  2410. @subsection Examples
  2411. @itemize
  2412. @item
  2413. Make music with both quiet and loud passages suitable for listening to in a
  2414. noisy environment:
  2415. @example
  2416. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2417. @end example
  2418. Another example for audio with whisper and explosion parts:
  2419. @example
  2420. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2421. @end example
  2422. @item
  2423. A noise gate for when the noise is at a lower level than the signal:
  2424. @example
  2425. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2426. @end example
  2427. @item
  2428. Here is another noise gate, this time for when the noise is at a higher level
  2429. than the signal (making it, in some ways, similar to squelch):
  2430. @example
  2431. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2432. @end example
  2433. @item
  2434. 2:1 compression starting at -6dB:
  2435. @example
  2436. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2437. @end example
  2438. @item
  2439. 2:1 compression starting at -9dB:
  2440. @example
  2441. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2442. @end example
  2443. @item
  2444. 2:1 compression starting at -12dB:
  2445. @example
  2446. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2447. @end example
  2448. @item
  2449. 2:1 compression starting at -18dB:
  2450. @example
  2451. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2452. @end example
  2453. @item
  2454. 3:1 compression starting at -15dB:
  2455. @example
  2456. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2457. @end example
  2458. @item
  2459. Compressor/Gate:
  2460. @example
  2461. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2462. @end example
  2463. @item
  2464. Expander:
  2465. @example
  2466. 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
  2467. @end example
  2468. @item
  2469. Hard limiter at -6dB:
  2470. @example
  2471. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2472. @end example
  2473. @item
  2474. Hard limiter at -12dB:
  2475. @example
  2476. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2477. @end example
  2478. @item
  2479. Hard noise gate at -35 dB:
  2480. @example
  2481. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2482. @end example
  2483. @item
  2484. Soft limiter:
  2485. @example
  2486. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2487. @end example
  2488. @end itemize
  2489. @section compensationdelay
  2490. Compensation Delay Line is a metric based delay to compensate differing
  2491. positions of microphones or speakers.
  2492. For example, you have recorded guitar with two microphones placed in
  2493. different locations. Because the front of sound wave has fixed speed in
  2494. normal conditions, the phasing of microphones can vary and depends on
  2495. their location and interposition. The best sound mix can be achieved when
  2496. these microphones are in phase (synchronized). Note that a distance of
  2497. ~30 cm between microphones makes one microphone capture the signal in
  2498. antiphase to the other microphone. That makes the final mix sound moody.
  2499. This filter helps to solve phasing problems by adding different delays
  2500. to each microphone track and make them synchronized.
  2501. The best result can be reached when you take one track as base and
  2502. synchronize other tracks one by one with it.
  2503. Remember that synchronization/delay tolerance depends on sample rate, too.
  2504. Higher sample rates will give more tolerance.
  2505. The filter accepts the following parameters:
  2506. @table @option
  2507. @item mm
  2508. Set millimeters distance. This is compensation distance for fine tuning.
  2509. Default is 0.
  2510. @item cm
  2511. Set cm distance. This is compensation distance for tightening distance setup.
  2512. Default is 0.
  2513. @item m
  2514. Set meters distance. This is compensation distance for hard distance setup.
  2515. Default is 0.
  2516. @item dry
  2517. Set dry amount. Amount of unprocessed (dry) signal.
  2518. Default is 0.
  2519. @item wet
  2520. Set wet amount. Amount of processed (wet) signal.
  2521. Default is 1.
  2522. @item temp
  2523. Set temperature in degrees Celsius. This is the temperature of the environment.
  2524. Default is 20.
  2525. @end table
  2526. @section crossfeed
  2527. Apply headphone crossfeed filter.
  2528. Crossfeed is the process of blending the left and right channels of stereo
  2529. audio recording.
  2530. It is mainly used to reduce extreme stereo separation of low frequencies.
  2531. The intent is to produce more speaker like sound to the listener.
  2532. The filter accepts the following options:
  2533. @table @option
  2534. @item strength
  2535. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2536. This sets gain of low shelf filter for side part of stereo image.
  2537. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2538. @item range
  2539. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2540. This sets cut off frequency of low shelf filter. Default is cut off near
  2541. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2542. @item slope
  2543. Set curve slope of low shelf filter. Default is 0.5.
  2544. Allowed range is from 0.01 to 1.
  2545. @item level_in
  2546. Set input gain. Default is 0.9.
  2547. @item level_out
  2548. Set output gain. Default is 1.
  2549. @end table
  2550. @subsection Commands
  2551. This filter supports the all above options as @ref{commands}.
  2552. @section crystalizer
  2553. Simple algorithm to expand audio dynamic range.
  2554. The filter accepts the following options:
  2555. @table @option
  2556. @item i
  2557. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2558. (unchanged sound) to 10.0 (maximum effect).
  2559. @item c
  2560. Enable clipping. By default is enabled.
  2561. @end table
  2562. @subsection Commands
  2563. This filter supports the all above options as @ref{commands}.
  2564. @section dcshift
  2565. Apply a DC shift to the audio.
  2566. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2567. in the recording chain) from the audio. The effect of a DC offset is reduced
  2568. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2569. a signal has a DC offset.
  2570. @table @option
  2571. @item shift
  2572. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2573. the audio.
  2574. @item limitergain
  2575. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2576. used to prevent clipping.
  2577. @end table
  2578. @section deesser
  2579. Apply de-essing to the audio samples.
  2580. @table @option
  2581. @item i
  2582. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2583. Default is 0.
  2584. @item m
  2585. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2586. Default is 0.5.
  2587. @item f
  2588. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2589. Default is 0.5.
  2590. @item s
  2591. Set the output mode.
  2592. It accepts the following values:
  2593. @table @option
  2594. @item i
  2595. Pass input unchanged.
  2596. @item o
  2597. Pass ess filtered out.
  2598. @item e
  2599. Pass only ess.
  2600. Default value is @var{o}.
  2601. @end table
  2602. @end table
  2603. @section drmeter
  2604. Measure audio dynamic range.
  2605. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2606. is found in transition material. And anything less that 8 have very poor dynamics
  2607. and is very compressed.
  2608. The filter accepts the following options:
  2609. @table @option
  2610. @item length
  2611. Set window length in seconds used to split audio into segments of equal length.
  2612. Default is 3 seconds.
  2613. @end table
  2614. @section dynaudnorm
  2615. Dynamic Audio Normalizer.
  2616. This filter applies a certain amount of gain to the input audio in order
  2617. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2618. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2619. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2620. This allows for applying extra gain to the "quiet" sections of the audio
  2621. while avoiding distortions or clipping the "loud" sections. In other words:
  2622. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2623. sections, in the sense that the volume of each section is brought to the
  2624. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2625. this goal *without* applying "dynamic range compressing". It will retain 100%
  2626. of the dynamic range *within* each section of the audio file.
  2627. @table @option
  2628. @item framelen, f
  2629. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2630. Default is 500 milliseconds.
  2631. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2632. referred to as frames. This is required, because a peak magnitude has no
  2633. meaning for just a single sample value. Instead, we need to determine the
  2634. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2635. normalizer would simply use the peak magnitude of the complete file, the
  2636. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2637. frame. The length of a frame is specified in milliseconds. By default, the
  2638. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2639. been found to give good results with most files.
  2640. Note that the exact frame length, in number of samples, will be determined
  2641. automatically, based on the sampling rate of the individual input audio file.
  2642. @item gausssize, g
  2643. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2644. number. Default is 31.
  2645. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2646. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2647. is specified in frames, centered around the current frame. For the sake of
  2648. simplicity, this must be an odd number. Consequently, the default value of 31
  2649. takes into account the current frame, as well as the 15 preceding frames and
  2650. the 15 subsequent frames. Using a larger window results in a stronger
  2651. smoothing effect and thus in less gain variation, i.e. slower gain
  2652. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2653. effect and thus in more gain variation, i.e. faster gain adaptation.
  2654. In other words, the more you increase this value, the more the Dynamic Audio
  2655. Normalizer will behave like a "traditional" normalization filter. On the
  2656. contrary, the more you decrease this value, the more the Dynamic Audio
  2657. Normalizer will behave like a dynamic range compressor.
  2658. @item peak, p
  2659. Set the target peak value. This specifies the highest permissible magnitude
  2660. level for the normalized audio input. This filter will try to approach the
  2661. target peak magnitude as closely as possible, but at the same time it also
  2662. makes sure that the normalized signal will never exceed the peak magnitude.
  2663. A frame's maximum local gain factor is imposed directly by the target peak
  2664. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2665. It is not recommended to go above this value.
  2666. @item maxgain, m
  2667. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2668. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2669. factor for each input frame, i.e. the maximum gain factor that does not
  2670. result in clipping or distortion. The maximum gain factor is determined by
  2671. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2672. additionally bounds the frame's maximum gain factor by a predetermined
  2673. (global) maximum gain factor. This is done in order to avoid excessive gain
  2674. factors in "silent" or almost silent frames. By default, the maximum gain
  2675. factor is 10.0, For most inputs the default value should be sufficient and
  2676. it usually is not recommended to increase this value. Though, for input
  2677. with an extremely low overall volume level, it may be necessary to allow even
  2678. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2679. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2680. Instead, a "sigmoid" threshold function will be applied. This way, the
  2681. gain factors will smoothly approach the threshold value, but never exceed that
  2682. value.
  2683. @item targetrms, r
  2684. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2685. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2686. This means that the maximum local gain factor for each frame is defined
  2687. (only) by the frame's highest magnitude sample. This way, the samples can
  2688. be amplified as much as possible without exceeding the maximum signal
  2689. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2690. Normalizer can also take into account the frame's root mean square,
  2691. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2692. determine the power of a time-varying signal. It is therefore considered
  2693. that the RMS is a better approximation of the "perceived loudness" than
  2694. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2695. frames to a constant RMS value, a uniform "perceived loudness" can be
  2696. established. If a target RMS value has been specified, a frame's local gain
  2697. factor is defined as the factor that would result in exactly that RMS value.
  2698. Note, however, that the maximum local gain factor is still restricted by the
  2699. frame's highest magnitude sample, in order to prevent clipping.
  2700. @item coupling, n
  2701. Enable channels coupling. By default is enabled.
  2702. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2703. amount. This means the same gain factor will be applied to all channels, i.e.
  2704. the maximum possible gain factor is determined by the "loudest" channel.
  2705. However, in some recordings, it may happen that the volume of the different
  2706. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2707. In this case, this option can be used to disable the channel coupling. This way,
  2708. the gain factor will be determined independently for each channel, depending
  2709. only on the individual channel's highest magnitude sample. This allows for
  2710. harmonizing the volume of the different channels.
  2711. @item correctdc, c
  2712. Enable DC bias correction. By default is disabled.
  2713. An audio signal (in the time domain) is a sequence of sample values.
  2714. In the Dynamic Audio Normalizer these sample values are represented in the
  2715. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2716. audio signal, or "waveform", should be centered around the zero point.
  2717. That means if we calculate the mean value of all samples in a file, or in a
  2718. single frame, then the result should be 0.0 or at least very close to that
  2719. value. If, however, there is a significant deviation of the mean value from
  2720. 0.0, in either positive or negative direction, this is referred to as a
  2721. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2722. Audio Normalizer provides optional DC bias correction.
  2723. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2724. the mean value, or "DC correction" offset, of each input frame and subtract
  2725. that value from all of the frame's sample values which ensures those samples
  2726. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2727. boundaries, the DC correction offset values will be interpolated smoothly
  2728. between neighbouring frames.
  2729. @item altboundary, b
  2730. Enable alternative boundary mode. By default is disabled.
  2731. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2732. around each frame. This includes the preceding frames as well as the
  2733. subsequent frames. However, for the "boundary" frames, located at the very
  2734. beginning and at the very end of the audio file, not all neighbouring
  2735. frames are available. In particular, for the first few frames in the audio
  2736. file, the preceding frames are not known. And, similarly, for the last few
  2737. frames in the audio file, the subsequent frames are not known. Thus, the
  2738. question arises which gain factors should be assumed for the missing frames
  2739. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2740. to deal with this situation. The default boundary mode assumes a gain factor
  2741. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2742. "fade out" at the beginning and at the end of the input, respectively.
  2743. @item compress, s
  2744. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2745. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2746. compression. This means that signal peaks will not be pruned and thus the
  2747. full dynamic range will be retained within each local neighbourhood. However,
  2748. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2749. normalization algorithm with a more "traditional" compression.
  2750. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2751. (thresholding) function. If (and only if) the compression feature is enabled,
  2752. all input frames will be processed by a soft knee thresholding function prior
  2753. to the actual normalization process. Put simply, the thresholding function is
  2754. going to prune all samples whose magnitude exceeds a certain threshold value.
  2755. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2756. value. Instead, the threshold value will be adjusted for each individual
  2757. frame.
  2758. In general, smaller parameters result in stronger compression, and vice versa.
  2759. Values below 3.0 are not recommended, because audible distortion may appear.
  2760. @item threshold, t
  2761. Set the target threshold value. This specifies the lowest permissible
  2762. magnitude level for the audio input which will be normalized.
  2763. If input frame volume is above this value frame will be normalized.
  2764. Otherwise frame may not be normalized at all. The default value is set
  2765. to 0, which means all input frames will be normalized.
  2766. This option is mostly useful if digital noise is not wanted to be amplified.
  2767. @end table
  2768. @subsection Commands
  2769. This filter supports the all above options as @ref{commands}.
  2770. @section earwax
  2771. Make audio easier to listen to on headphones.
  2772. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2773. so that when listened to on headphones the stereo image is moved from
  2774. inside your head (standard for headphones) to outside and in front of
  2775. the listener (standard for speakers).
  2776. Ported from SoX.
  2777. @section equalizer
  2778. Apply a two-pole peaking equalisation (EQ) filter. With this
  2779. filter, the signal-level at and around a selected frequency can
  2780. be increased or decreased, whilst (unlike bandpass and bandreject
  2781. filters) that at all other frequencies is unchanged.
  2782. In order to produce complex equalisation curves, this filter can
  2783. be given several times, each with a different central frequency.
  2784. The filter accepts the following options:
  2785. @table @option
  2786. @item frequency, f
  2787. Set the filter's central frequency in Hz.
  2788. @item width_type, t
  2789. Set method to specify band-width of filter.
  2790. @table @option
  2791. @item h
  2792. Hz
  2793. @item q
  2794. Q-Factor
  2795. @item o
  2796. octave
  2797. @item s
  2798. slope
  2799. @item k
  2800. kHz
  2801. @end table
  2802. @item width, w
  2803. Specify the band-width of a filter in width_type units.
  2804. @item gain, g
  2805. Set the required gain or attenuation in dB.
  2806. Beware of clipping when using a positive gain.
  2807. @item mix, m
  2808. How much to use filtered signal in output. Default is 1.
  2809. Range is between 0 and 1.
  2810. @item channels, c
  2811. Specify which channels to filter, by default all available are filtered.
  2812. @item normalize, n
  2813. Normalize biquad coefficients, by default is disabled.
  2814. Enabling it will normalize magnitude response at DC to 0dB.
  2815. @item transform, a
  2816. Set transform type of IIR filter.
  2817. @table @option
  2818. @item di
  2819. @item dii
  2820. @item tdii
  2821. @end table
  2822. @end table
  2823. @subsection Examples
  2824. @itemize
  2825. @item
  2826. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2827. @example
  2828. equalizer=f=1000:t=h:width=200:g=-10
  2829. @end example
  2830. @item
  2831. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2832. @example
  2833. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2834. @end example
  2835. @end itemize
  2836. @subsection Commands
  2837. This filter supports the following commands:
  2838. @table @option
  2839. @item frequency, f
  2840. Change equalizer frequency.
  2841. Syntax for the command is : "@var{frequency}"
  2842. @item width_type, t
  2843. Change equalizer width_type.
  2844. Syntax for the command is : "@var{width_type}"
  2845. @item width, w
  2846. Change equalizer width.
  2847. Syntax for the command is : "@var{width}"
  2848. @item gain, g
  2849. Change equalizer gain.
  2850. Syntax for the command is : "@var{gain}"
  2851. @item mix, m
  2852. Change equalizer mix.
  2853. Syntax for the command is : "@var{mix}"
  2854. @end table
  2855. @section extrastereo
  2856. Linearly increases the difference between left and right channels which
  2857. adds some sort of "live" effect to playback.
  2858. The filter accepts the following options:
  2859. @table @option
  2860. @item m
  2861. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2862. (average of both channels), with 1.0 sound will be unchanged, with
  2863. -1.0 left and right channels will be swapped.
  2864. @item c
  2865. Enable clipping. By default is enabled.
  2866. @end table
  2867. @subsection Commands
  2868. This filter supports the all above options as @ref{commands}.
  2869. @section firequalizer
  2870. Apply FIR Equalization using arbitrary frequency response.
  2871. The filter accepts the following option:
  2872. @table @option
  2873. @item gain
  2874. Set gain curve equation (in dB). The expression can contain variables:
  2875. @table @option
  2876. @item f
  2877. the evaluated frequency
  2878. @item sr
  2879. sample rate
  2880. @item ch
  2881. channel number, set to 0 when multichannels evaluation is disabled
  2882. @item chid
  2883. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2884. multichannels evaluation is disabled
  2885. @item chs
  2886. number of channels
  2887. @item chlayout
  2888. channel_layout, see libavutil/channel_layout.h
  2889. @end table
  2890. and functions:
  2891. @table @option
  2892. @item gain_interpolate(f)
  2893. interpolate gain on frequency f based on gain_entry
  2894. @item cubic_interpolate(f)
  2895. same as gain_interpolate, but smoother
  2896. @end table
  2897. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2898. @item gain_entry
  2899. Set gain entry for gain_interpolate function. The expression can
  2900. contain functions:
  2901. @table @option
  2902. @item entry(f, g)
  2903. store gain entry at frequency f with value g
  2904. @end table
  2905. This option is also available as command.
  2906. @item delay
  2907. Set filter delay in seconds. Higher value means more accurate.
  2908. Default is @code{0.01}.
  2909. @item accuracy
  2910. Set filter accuracy in Hz. Lower value means more accurate.
  2911. Default is @code{5}.
  2912. @item wfunc
  2913. Set window function. Acceptable values are:
  2914. @table @option
  2915. @item rectangular
  2916. rectangular window, useful when gain curve is already smooth
  2917. @item hann
  2918. hann window (default)
  2919. @item hamming
  2920. hamming window
  2921. @item blackman
  2922. blackman window
  2923. @item nuttall3
  2924. 3-terms continuous 1st derivative nuttall window
  2925. @item mnuttall3
  2926. minimum 3-terms discontinuous nuttall window
  2927. @item nuttall
  2928. 4-terms continuous 1st derivative nuttall window
  2929. @item bnuttall
  2930. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2931. @item bharris
  2932. blackman-harris window
  2933. @item tukey
  2934. tukey window
  2935. @end table
  2936. @item fixed
  2937. If enabled, use fixed number of audio samples. This improves speed when
  2938. filtering with large delay. Default is disabled.
  2939. @item multi
  2940. Enable multichannels evaluation on gain. Default is disabled.
  2941. @item zero_phase
  2942. Enable zero phase mode by subtracting timestamp to compensate delay.
  2943. Default is disabled.
  2944. @item scale
  2945. Set scale used by gain. Acceptable values are:
  2946. @table @option
  2947. @item linlin
  2948. linear frequency, linear gain
  2949. @item linlog
  2950. linear frequency, logarithmic (in dB) gain (default)
  2951. @item loglin
  2952. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2953. @item loglog
  2954. logarithmic frequency, logarithmic gain
  2955. @end table
  2956. @item dumpfile
  2957. Set file for dumping, suitable for gnuplot.
  2958. @item dumpscale
  2959. Set scale for dumpfile. Acceptable values are same with scale option.
  2960. Default is linlog.
  2961. @item fft2
  2962. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2963. Default is disabled.
  2964. @item min_phase
  2965. Enable minimum phase impulse response. Default is disabled.
  2966. @end table
  2967. @subsection Examples
  2968. @itemize
  2969. @item
  2970. lowpass at 1000 Hz:
  2971. @example
  2972. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2973. @end example
  2974. @item
  2975. lowpass at 1000 Hz with gain_entry:
  2976. @example
  2977. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2978. @end example
  2979. @item
  2980. custom equalization:
  2981. @example
  2982. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2983. @end example
  2984. @item
  2985. higher delay with zero phase to compensate delay:
  2986. @example
  2987. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2988. @end example
  2989. @item
  2990. lowpass on left channel, highpass on right channel:
  2991. @example
  2992. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2993. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2994. @end example
  2995. @end itemize
  2996. @section flanger
  2997. Apply a flanging effect to the audio.
  2998. The filter accepts the following options:
  2999. @table @option
  3000. @item delay
  3001. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3002. @item depth
  3003. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3004. @item regen
  3005. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3006. Default value is 0.
  3007. @item width
  3008. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3009. Default value is 71.
  3010. @item speed
  3011. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3012. @item shape
  3013. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3014. Default value is @var{sinusoidal}.
  3015. @item phase
  3016. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3017. Default value is 25.
  3018. @item interp
  3019. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3020. Default is @var{linear}.
  3021. @end table
  3022. @section haas
  3023. Apply Haas effect to audio.
  3024. Note that this makes most sense to apply on mono signals.
  3025. With this filter applied to mono signals it give some directionality and
  3026. stretches its stereo image.
  3027. The filter accepts the following options:
  3028. @table @option
  3029. @item level_in
  3030. Set input level. By default is @var{1}, or 0dB
  3031. @item level_out
  3032. Set output level. By default is @var{1}, or 0dB.
  3033. @item side_gain
  3034. Set gain applied to side part of signal. By default is @var{1}.
  3035. @item middle_source
  3036. Set kind of middle source. Can be one of the following:
  3037. @table @samp
  3038. @item left
  3039. Pick left channel.
  3040. @item right
  3041. Pick right channel.
  3042. @item mid
  3043. Pick middle part signal of stereo image.
  3044. @item side
  3045. Pick side part signal of stereo image.
  3046. @end table
  3047. @item middle_phase
  3048. Change middle phase. By default is disabled.
  3049. @item left_delay
  3050. Set left channel delay. By default is @var{2.05} milliseconds.
  3051. @item left_balance
  3052. Set left channel balance. By default is @var{-1}.
  3053. @item left_gain
  3054. Set left channel gain. By default is @var{1}.
  3055. @item left_phase
  3056. Change left phase. By default is disabled.
  3057. @item right_delay
  3058. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3059. @item right_balance
  3060. Set right channel balance. By default is @var{1}.
  3061. @item right_gain
  3062. Set right channel gain. By default is @var{1}.
  3063. @item right_phase
  3064. Change right phase. By default is enabled.
  3065. @end table
  3066. @section hdcd
  3067. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3068. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3069. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3070. of HDCD, and detects the Transient Filter flag.
  3071. @example
  3072. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3073. @end example
  3074. When using the filter with wav, note the default encoding for wav is 16-bit,
  3075. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3076. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3077. @example
  3078. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3079. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3080. @end example
  3081. The filter accepts the following options:
  3082. @table @option
  3083. @item disable_autoconvert
  3084. Disable any automatic format conversion or resampling in the filter graph.
  3085. @item process_stereo
  3086. Process the stereo channels together. If target_gain does not match between
  3087. channels, consider it invalid and use the last valid target_gain.
  3088. @item cdt_ms
  3089. Set the code detect timer period in ms.
  3090. @item force_pe
  3091. Always extend peaks above -3dBFS even if PE isn't signaled.
  3092. @item analyze_mode
  3093. Replace audio with a solid tone and adjust the amplitude to signal some
  3094. specific aspect of the decoding process. The output file can be loaded in
  3095. an audio editor alongside the original to aid analysis.
  3096. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3097. Modes are:
  3098. @table @samp
  3099. @item 0, off
  3100. Disabled
  3101. @item 1, lle
  3102. Gain adjustment level at each sample
  3103. @item 2, pe
  3104. Samples where peak extend occurs
  3105. @item 3, cdt
  3106. Samples where the code detect timer is active
  3107. @item 4, tgm
  3108. Samples where the target gain does not match between channels
  3109. @end table
  3110. @end table
  3111. @section headphone
  3112. Apply head-related transfer functions (HRTFs) to create virtual
  3113. loudspeakers around the user for binaural listening via headphones.
  3114. The HRIRs are provided via additional streams, for each channel
  3115. one stereo input stream is needed.
  3116. The filter accepts the following options:
  3117. @table @option
  3118. @item map
  3119. Set mapping of input streams for convolution.
  3120. The argument is a '|'-separated list of channel names in order as they
  3121. are given as additional stream inputs for filter.
  3122. This also specify number of input streams. Number of input streams
  3123. must be not less than number of channels in first stream plus one.
  3124. @item gain
  3125. Set gain applied to audio. Value is in dB. Default is 0.
  3126. @item type
  3127. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3128. processing audio in time domain which is slow.
  3129. @var{freq} is processing audio in frequency domain which is fast.
  3130. Default is @var{freq}.
  3131. @item lfe
  3132. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3133. @item size
  3134. Set size of frame in number of samples which will be processed at once.
  3135. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3136. @item hrir
  3137. Set format of hrir stream.
  3138. Default value is @var{stereo}. Alternative value is @var{multich}.
  3139. If value is set to @var{stereo}, number of additional streams should
  3140. be greater or equal to number of input channels in first input stream.
  3141. Also each additional stream should have stereo number of channels.
  3142. If value is set to @var{multich}, number of additional streams should
  3143. be exactly one. Also number of input channels of additional stream
  3144. should be equal or greater than twice number of channels of first input
  3145. stream.
  3146. @end table
  3147. @subsection Examples
  3148. @itemize
  3149. @item
  3150. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3151. each amovie filter use stereo file with IR coefficients as input.
  3152. The files give coefficients for each position of virtual loudspeaker:
  3153. @example
  3154. ffmpeg -i input.wav
  3155. -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"
  3156. output.wav
  3157. @end example
  3158. @item
  3159. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3160. but now in @var{multich} @var{hrir} format.
  3161. @example
  3162. 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"
  3163. output.wav
  3164. @end example
  3165. @end itemize
  3166. @section highpass
  3167. Apply a high-pass filter with 3dB point frequency.
  3168. The filter can be either single-pole, or double-pole (the default).
  3169. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3170. The filter accepts the following options:
  3171. @table @option
  3172. @item frequency, f
  3173. Set frequency in Hz. Default is 3000.
  3174. @item poles, p
  3175. Set number of poles. Default is 2.
  3176. @item width_type, t
  3177. Set method to specify band-width of filter.
  3178. @table @option
  3179. @item h
  3180. Hz
  3181. @item q
  3182. Q-Factor
  3183. @item o
  3184. octave
  3185. @item s
  3186. slope
  3187. @item k
  3188. kHz
  3189. @end table
  3190. @item width, w
  3191. Specify the band-width of a filter in width_type units.
  3192. Applies only to double-pole filter.
  3193. The default is 0.707q and gives a Butterworth response.
  3194. @item mix, m
  3195. How much to use filtered signal in output. Default is 1.
  3196. Range is between 0 and 1.
  3197. @item channels, c
  3198. Specify which channels to filter, by default all available are filtered.
  3199. @item normalize, n
  3200. Normalize biquad coefficients, by default is disabled.
  3201. Enabling it will normalize magnitude response at DC to 0dB.
  3202. @item transform, a
  3203. Set transform type of IIR filter.
  3204. @table @option
  3205. @item di
  3206. @item dii
  3207. @item tdii
  3208. @end table
  3209. @end table
  3210. @subsection Commands
  3211. This filter supports the following commands:
  3212. @table @option
  3213. @item frequency, f
  3214. Change highpass frequency.
  3215. Syntax for the command is : "@var{frequency}"
  3216. @item width_type, t
  3217. Change highpass width_type.
  3218. Syntax for the command is : "@var{width_type}"
  3219. @item width, w
  3220. Change highpass width.
  3221. Syntax for the command is : "@var{width}"
  3222. @item mix, m
  3223. Change highpass mix.
  3224. Syntax for the command is : "@var{mix}"
  3225. @end table
  3226. @section join
  3227. Join multiple input streams into one multi-channel stream.
  3228. It accepts the following parameters:
  3229. @table @option
  3230. @item inputs
  3231. The number of input streams. It defaults to 2.
  3232. @item channel_layout
  3233. The desired output channel layout. It defaults to stereo.
  3234. @item map
  3235. Map channels from inputs to output. The argument is a '|'-separated list of
  3236. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3237. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3238. can be either the name of the input channel (e.g. FL for front left) or its
  3239. index in the specified input stream. @var{out_channel} is the name of the output
  3240. channel.
  3241. @end table
  3242. The filter will attempt to guess the mappings when they are not specified
  3243. explicitly. It does so by first trying to find an unused matching input channel
  3244. and if that fails it picks the first unused input channel.
  3245. Join 3 inputs (with properly set channel layouts):
  3246. @example
  3247. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3248. @end example
  3249. Build a 5.1 output from 6 single-channel streams:
  3250. @example
  3251. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3252. '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'
  3253. out
  3254. @end example
  3255. @section ladspa
  3256. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3257. To enable compilation of this filter you need to configure FFmpeg with
  3258. @code{--enable-ladspa}.
  3259. @table @option
  3260. @item file, f
  3261. Specifies the name of LADSPA plugin library to load. If the environment
  3262. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3263. each one of the directories specified by the colon separated list in
  3264. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3265. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3266. @file{/usr/lib/ladspa/}.
  3267. @item plugin, p
  3268. Specifies the plugin within the library. Some libraries contain only
  3269. one plugin, but others contain many of them. If this is not set filter
  3270. will list all available plugins within the specified library.
  3271. @item controls, c
  3272. Set the '|' separated list of controls which are zero or more floating point
  3273. values that determine the behavior of the loaded plugin (for example delay,
  3274. threshold or gain).
  3275. Controls need to be defined using the following syntax:
  3276. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3277. @var{valuei} is the value set on the @var{i}-th control.
  3278. Alternatively they can be also defined using the following syntax:
  3279. @var{value0}|@var{value1}|@var{value2}|..., where
  3280. @var{valuei} is the value set on the @var{i}-th control.
  3281. If @option{controls} is set to @code{help}, all available controls and
  3282. their valid ranges are printed.
  3283. @item sample_rate, s
  3284. Specify the sample rate, default to 44100. Only used if plugin have
  3285. zero inputs.
  3286. @item nb_samples, n
  3287. Set the number of samples per channel per each output frame, default
  3288. is 1024. Only used if plugin have zero inputs.
  3289. @item duration, d
  3290. Set the minimum duration of the sourced audio. See
  3291. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3292. for the accepted syntax.
  3293. Note that the resulting duration may be greater than the specified duration,
  3294. as the generated audio is always cut at the end of a complete frame.
  3295. If not specified, or the expressed duration is negative, the audio is
  3296. supposed to be generated forever.
  3297. Only used if plugin have zero inputs.
  3298. @item latency, l
  3299. Enable latency compensation, by default is disabled.
  3300. Only used if plugin have inputs.
  3301. @end table
  3302. @subsection Examples
  3303. @itemize
  3304. @item
  3305. List all available plugins within amp (LADSPA example plugin) library:
  3306. @example
  3307. ladspa=file=amp
  3308. @end example
  3309. @item
  3310. List all available controls and their valid ranges for @code{vcf_notch}
  3311. plugin from @code{VCF} library:
  3312. @example
  3313. ladspa=f=vcf:p=vcf_notch:c=help
  3314. @end example
  3315. @item
  3316. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3317. plugin library:
  3318. @example
  3319. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3320. @end example
  3321. @item
  3322. Add reverberation to the audio using TAP-plugins
  3323. (Tom's Audio Processing plugins):
  3324. @example
  3325. ladspa=file=tap_reverb:tap_reverb
  3326. @end example
  3327. @item
  3328. Generate white noise, with 0.2 amplitude:
  3329. @example
  3330. ladspa=file=cmt:noise_source_white:c=c0=.2
  3331. @end example
  3332. @item
  3333. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3334. @code{C* Audio Plugin Suite} (CAPS) library:
  3335. @example
  3336. ladspa=file=caps:Click:c=c1=20'
  3337. @end example
  3338. @item
  3339. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3340. @example
  3341. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3342. @end example
  3343. @item
  3344. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3345. @code{SWH Plugins} collection:
  3346. @example
  3347. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3348. @end example
  3349. @item
  3350. Attenuate low frequencies using Multiband EQ from Steve Harris
  3351. @code{SWH Plugins} collection:
  3352. @example
  3353. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3354. @end example
  3355. @item
  3356. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3357. (CAPS) library:
  3358. @example
  3359. ladspa=caps:Narrower
  3360. @end example
  3361. @item
  3362. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3363. @example
  3364. ladspa=caps:White:.2
  3365. @end example
  3366. @item
  3367. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3368. @example
  3369. ladspa=caps:Fractal:c=c1=1
  3370. @end example
  3371. @item
  3372. Dynamic volume normalization using @code{VLevel} plugin:
  3373. @example
  3374. ladspa=vlevel-ladspa:vlevel_mono
  3375. @end example
  3376. @end itemize
  3377. @subsection Commands
  3378. This filter supports the following commands:
  3379. @table @option
  3380. @item cN
  3381. Modify the @var{N}-th control value.
  3382. If the specified value is not valid, it is ignored and prior one is kept.
  3383. @end table
  3384. @section loudnorm
  3385. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3386. Support for both single pass (livestreams, files) and double pass (files) modes.
  3387. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  3388. detect true peaks, the audio stream will be upsampled to 192 kHz.
  3389. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3390. The filter accepts the following options:
  3391. @table @option
  3392. @item I, i
  3393. Set integrated loudness target.
  3394. Range is -70.0 - -5.0. Default value is -24.0.
  3395. @item LRA, lra
  3396. Set loudness range target.
  3397. Range is 1.0 - 20.0. Default value is 7.0.
  3398. @item TP, tp
  3399. Set maximum true peak.
  3400. Range is -9.0 - +0.0. Default value is -2.0.
  3401. @item measured_I, measured_i
  3402. Measured IL of input file.
  3403. Range is -99.0 - +0.0.
  3404. @item measured_LRA, measured_lra
  3405. Measured LRA of input file.
  3406. Range is 0.0 - 99.0.
  3407. @item measured_TP, measured_tp
  3408. Measured true peak of input file.
  3409. Range is -99.0 - +99.0.
  3410. @item measured_thresh
  3411. Measured threshold of input file.
  3412. Range is -99.0 - +0.0.
  3413. @item offset
  3414. Set offset gain. Gain is applied before the true-peak limiter.
  3415. Range is -99.0 - +99.0. Default is +0.0.
  3416. @item linear
  3417. Normalize by linearly scaling the source audio.
  3418. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  3419. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  3420. be lower than source LRA and the change in integrated loudness shouldn't
  3421. result in a true peak which exceeds the target TP. If any of these
  3422. conditions aren't met, normalization mode will revert to @var{dynamic}.
  3423. Options are @code{true} or @code{false}. Default is @code{true}.
  3424. @item dual_mono
  3425. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3426. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3427. If set to @code{true}, this option will compensate for this effect.
  3428. Multi-channel input files are not affected by this option.
  3429. Options are true or false. Default is false.
  3430. @item print_format
  3431. Set print format for stats. Options are summary, json, or none.
  3432. Default value is none.
  3433. @end table
  3434. @section lowpass
  3435. Apply a low-pass filter with 3dB point frequency.
  3436. The filter can be either single-pole or double-pole (the default).
  3437. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3438. The filter accepts the following options:
  3439. @table @option
  3440. @item frequency, f
  3441. Set frequency in Hz. Default is 500.
  3442. @item poles, p
  3443. Set number of poles. Default is 2.
  3444. @item width_type, t
  3445. Set method to specify band-width of filter.
  3446. @table @option
  3447. @item h
  3448. Hz
  3449. @item q
  3450. Q-Factor
  3451. @item o
  3452. octave
  3453. @item s
  3454. slope
  3455. @item k
  3456. kHz
  3457. @end table
  3458. @item width, w
  3459. Specify the band-width of a filter in width_type units.
  3460. Applies only to double-pole filter.
  3461. The default is 0.707q and gives a Butterworth response.
  3462. @item mix, m
  3463. How much to use filtered signal in output. Default is 1.
  3464. Range is between 0 and 1.
  3465. @item channels, c
  3466. Specify which channels to filter, by default all available are filtered.
  3467. @item normalize, n
  3468. Normalize biquad coefficients, by default is disabled.
  3469. Enabling it will normalize magnitude response at DC to 0dB.
  3470. @item transform, a
  3471. Set transform type of IIR filter.
  3472. @table @option
  3473. @item di
  3474. @item dii
  3475. @item tdii
  3476. @end table
  3477. @end table
  3478. @subsection Examples
  3479. @itemize
  3480. @item
  3481. Lowpass only LFE channel, it LFE is not present it does nothing:
  3482. @example
  3483. lowpass=c=LFE
  3484. @end example
  3485. @end itemize
  3486. @subsection Commands
  3487. This filter supports the following commands:
  3488. @table @option
  3489. @item frequency, f
  3490. Change lowpass frequency.
  3491. Syntax for the command is : "@var{frequency}"
  3492. @item width_type, t
  3493. Change lowpass width_type.
  3494. Syntax for the command is : "@var{width_type}"
  3495. @item width, w
  3496. Change lowpass width.
  3497. Syntax for the command is : "@var{width}"
  3498. @item mix, m
  3499. Change lowpass mix.
  3500. Syntax for the command is : "@var{mix}"
  3501. @end table
  3502. @section lv2
  3503. Load a LV2 (LADSPA Version 2) plugin.
  3504. To enable compilation of this filter you need to configure FFmpeg with
  3505. @code{--enable-lv2}.
  3506. @table @option
  3507. @item plugin, p
  3508. Specifies the plugin URI. You may need to escape ':'.
  3509. @item controls, c
  3510. Set the '|' separated list of controls which are zero or more floating point
  3511. values that determine the behavior of the loaded plugin (for example delay,
  3512. threshold or gain).
  3513. If @option{controls} is set to @code{help}, all available controls and
  3514. their valid ranges are printed.
  3515. @item sample_rate, s
  3516. Specify the sample rate, default to 44100. Only used if plugin have
  3517. zero inputs.
  3518. @item nb_samples, n
  3519. Set the number of samples per channel per each output frame, default
  3520. is 1024. Only used if plugin have zero inputs.
  3521. @item duration, d
  3522. Set the minimum duration of the sourced audio. See
  3523. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3524. for the accepted syntax.
  3525. Note that the resulting duration may be greater than the specified duration,
  3526. as the generated audio is always cut at the end of a complete frame.
  3527. If not specified, or the expressed duration is negative, the audio is
  3528. supposed to be generated forever.
  3529. Only used if plugin have zero inputs.
  3530. @end table
  3531. @subsection Examples
  3532. @itemize
  3533. @item
  3534. Apply bass enhancer plugin from Calf:
  3535. @example
  3536. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3537. @end example
  3538. @item
  3539. Apply vinyl plugin from Calf:
  3540. @example
  3541. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3542. @end example
  3543. @item
  3544. Apply bit crusher plugin from ArtyFX:
  3545. @example
  3546. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3547. @end example
  3548. @end itemize
  3549. @section mcompand
  3550. Multiband Compress or expand the audio's dynamic range.
  3551. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3552. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3553. response when absent compander action.
  3554. It accepts the following parameters:
  3555. @table @option
  3556. @item args
  3557. This option syntax is:
  3558. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3559. For explanation of each item refer to compand filter documentation.
  3560. @end table
  3561. @anchor{pan}
  3562. @section pan
  3563. Mix channels with specific gain levels. The filter accepts the output
  3564. channel layout followed by a set of channels definitions.
  3565. This filter is also designed to efficiently remap the channels of an audio
  3566. stream.
  3567. The filter accepts parameters of the form:
  3568. "@var{l}|@var{outdef}|@var{outdef}|..."
  3569. @table @option
  3570. @item l
  3571. output channel layout or number of channels
  3572. @item outdef
  3573. output channel specification, of the form:
  3574. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3575. @item out_name
  3576. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3577. number (c0, c1, etc.)
  3578. @item gain
  3579. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3580. @item in_name
  3581. input channel to use, see out_name for details; it is not possible to mix
  3582. named and numbered input channels
  3583. @end table
  3584. If the `=' in a channel specification is replaced by `<', then the gains for
  3585. that specification will be renormalized so that the total is 1, thus
  3586. avoiding clipping noise.
  3587. @subsection Mixing examples
  3588. For example, if you want to down-mix from stereo to mono, but with a bigger
  3589. factor for the left channel:
  3590. @example
  3591. pan=1c|c0=0.9*c0+0.1*c1
  3592. @end example
  3593. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3594. 7-channels surround:
  3595. @example
  3596. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3597. @end example
  3598. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3599. that should be preferred (see "-ac" option) unless you have very specific
  3600. needs.
  3601. @subsection Remapping examples
  3602. The channel remapping will be effective if, and only if:
  3603. @itemize
  3604. @item gain coefficients are zeroes or ones,
  3605. @item only one input per channel output,
  3606. @end itemize
  3607. If all these conditions are satisfied, the filter will notify the user ("Pure
  3608. channel mapping detected"), and use an optimized and lossless method to do the
  3609. remapping.
  3610. For example, if you have a 5.1 source and want a stereo audio stream by
  3611. dropping the extra channels:
  3612. @example
  3613. pan="stereo| c0=FL | c1=FR"
  3614. @end example
  3615. Given the same source, you can also switch front left and front right channels
  3616. and keep the input channel layout:
  3617. @example
  3618. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3619. @end example
  3620. If the input is a stereo audio stream, you can mute the front left channel (and
  3621. still keep the stereo channel layout) with:
  3622. @example
  3623. pan="stereo|c1=c1"
  3624. @end example
  3625. Still with a stereo audio stream input, you can copy the right channel in both
  3626. front left and right:
  3627. @example
  3628. pan="stereo| c0=FR | c1=FR"
  3629. @end example
  3630. @section replaygain
  3631. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3632. outputs it unchanged.
  3633. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3634. @section resample
  3635. Convert the audio sample format, sample rate and channel layout. It is
  3636. not meant to be used directly.
  3637. @section rubberband
  3638. Apply time-stretching and pitch-shifting with librubberband.
  3639. To enable compilation of this filter, you need to configure FFmpeg with
  3640. @code{--enable-librubberband}.
  3641. The filter accepts the following options:
  3642. @table @option
  3643. @item tempo
  3644. Set tempo scale factor.
  3645. @item pitch
  3646. Set pitch scale factor.
  3647. @item transients
  3648. Set transients detector.
  3649. Possible values are:
  3650. @table @var
  3651. @item crisp
  3652. @item mixed
  3653. @item smooth
  3654. @end table
  3655. @item detector
  3656. Set detector.
  3657. Possible values are:
  3658. @table @var
  3659. @item compound
  3660. @item percussive
  3661. @item soft
  3662. @end table
  3663. @item phase
  3664. Set phase.
  3665. Possible values are:
  3666. @table @var
  3667. @item laminar
  3668. @item independent
  3669. @end table
  3670. @item window
  3671. Set processing window size.
  3672. Possible values are:
  3673. @table @var
  3674. @item standard
  3675. @item short
  3676. @item long
  3677. @end table
  3678. @item smoothing
  3679. Set smoothing.
  3680. Possible values are:
  3681. @table @var
  3682. @item off
  3683. @item on
  3684. @end table
  3685. @item formant
  3686. Enable formant preservation when shift pitching.
  3687. Possible values are:
  3688. @table @var
  3689. @item shifted
  3690. @item preserved
  3691. @end table
  3692. @item pitchq
  3693. Set pitch quality.
  3694. Possible values are:
  3695. @table @var
  3696. @item quality
  3697. @item speed
  3698. @item consistency
  3699. @end table
  3700. @item channels
  3701. Set channels.
  3702. Possible values are:
  3703. @table @var
  3704. @item apart
  3705. @item together
  3706. @end table
  3707. @end table
  3708. @subsection Commands
  3709. This filter supports the following commands:
  3710. @table @option
  3711. @item tempo
  3712. Change filter tempo scale factor.
  3713. Syntax for the command is : "@var{tempo}"
  3714. @item pitch
  3715. Change filter pitch scale factor.
  3716. Syntax for the command is : "@var{pitch}"
  3717. @end table
  3718. @section sidechaincompress
  3719. This filter acts like normal compressor but has the ability to compress
  3720. detected signal using second input signal.
  3721. It needs two input streams and returns one output stream.
  3722. First input stream will be processed depending on second stream signal.
  3723. The filtered signal then can be filtered with other filters in later stages of
  3724. processing. See @ref{pan} and @ref{amerge} filter.
  3725. The filter accepts the following options:
  3726. @table @option
  3727. @item level_in
  3728. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3729. @item mode
  3730. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3731. Default is @code{downward}.
  3732. @item threshold
  3733. If a signal of second stream raises above this level it will affect the gain
  3734. reduction of first stream.
  3735. By default is 0.125. Range is between 0.00097563 and 1.
  3736. @item ratio
  3737. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3738. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3739. Default is 2. Range is between 1 and 20.
  3740. @item attack
  3741. Amount of milliseconds the signal has to rise above the threshold before gain
  3742. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3743. @item release
  3744. Amount of milliseconds the signal has to fall below the threshold before
  3745. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3746. @item makeup
  3747. Set the amount by how much signal will be amplified after processing.
  3748. Default is 1. Range is from 1 to 64.
  3749. @item knee
  3750. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3751. Default is 2.82843. Range is between 1 and 8.
  3752. @item link
  3753. Choose if the @code{average} level between all channels of side-chain stream
  3754. or the louder(@code{maximum}) channel of side-chain stream affects the
  3755. reduction. Default is @code{average}.
  3756. @item detection
  3757. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3758. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3759. @item level_sc
  3760. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3761. @item mix
  3762. How much to use compressed signal in output. Default is 1.
  3763. Range is between 0 and 1.
  3764. @end table
  3765. @subsection Commands
  3766. This filter supports the all above options as @ref{commands}.
  3767. @subsection Examples
  3768. @itemize
  3769. @item
  3770. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3771. depending on the signal of 2nd input and later compressed signal to be
  3772. merged with 2nd input:
  3773. @example
  3774. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3775. @end example
  3776. @end itemize
  3777. @section sidechaingate
  3778. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3779. filter the detected signal before sending it to the gain reduction stage.
  3780. Normally a gate uses the full range signal to detect a level above the
  3781. threshold.
  3782. For example: If you cut all lower frequencies from your sidechain signal
  3783. the gate will decrease the volume of your track only if not enough highs
  3784. appear. With this technique you are able to reduce the resonation of a
  3785. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3786. guitar.
  3787. It needs two input streams and returns one output stream.
  3788. First input stream will be processed depending on second stream signal.
  3789. The filter accepts the following options:
  3790. @table @option
  3791. @item level_in
  3792. Set input level before filtering.
  3793. Default is 1. Allowed range is from 0.015625 to 64.
  3794. @item mode
  3795. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3796. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3797. will be amplified, expanding dynamic range in upward direction.
  3798. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3799. @item range
  3800. Set the level of gain reduction when the signal is below the threshold.
  3801. Default is 0.06125. Allowed range is from 0 to 1.
  3802. Setting this to 0 disables reduction and then filter behaves like expander.
  3803. @item threshold
  3804. If a signal rises above this level the gain reduction is released.
  3805. Default is 0.125. Allowed range is from 0 to 1.
  3806. @item ratio
  3807. Set a ratio about which the signal is reduced.
  3808. Default is 2. Allowed range is from 1 to 9000.
  3809. @item attack
  3810. Amount of milliseconds the signal has to rise above the threshold before gain
  3811. reduction stops.
  3812. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3813. @item release
  3814. Amount of milliseconds the signal has to fall below the threshold before the
  3815. reduction is increased again. Default is 250 milliseconds.
  3816. Allowed range is from 0.01 to 9000.
  3817. @item makeup
  3818. Set amount of amplification of signal after processing.
  3819. Default is 1. Allowed range is from 1 to 64.
  3820. @item knee
  3821. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3822. Default is 2.828427125. Allowed range is from 1 to 8.
  3823. @item detection
  3824. Choose if exact signal should be taken for detection or an RMS like one.
  3825. Default is rms. Can be peak or rms.
  3826. @item link
  3827. Choose if the average level between all channels or the louder channel affects
  3828. the reduction.
  3829. Default is average. Can be average or maximum.
  3830. @item level_sc
  3831. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3832. @end table
  3833. @section silencedetect
  3834. Detect silence in an audio stream.
  3835. This filter logs a message when it detects that the input audio volume is less
  3836. or equal to a noise tolerance value for a duration greater or equal to the
  3837. minimum detected noise duration.
  3838. The printed times and duration are expressed in seconds. The
  3839. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  3840. is set on the first frame whose timestamp equals or exceeds the detection
  3841. duration and it contains the timestamp of the first frame of the silence.
  3842. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  3843. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  3844. keys are set on the first frame after the silence. If @option{mono} is
  3845. enabled, and each channel is evaluated separately, the @code{.X}
  3846. suffixed keys are used, and @code{X} corresponds to the channel number.
  3847. The filter accepts the following options:
  3848. @table @option
  3849. @item noise, n
  3850. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3851. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3852. @item duration, d
  3853. Set silence duration until notification (default is 2 seconds). See
  3854. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3855. for the accepted syntax.
  3856. @item mono, m
  3857. Process each channel separately, instead of combined. By default is disabled.
  3858. @end table
  3859. @subsection Examples
  3860. @itemize
  3861. @item
  3862. Detect 5 seconds of silence with -50dB noise tolerance:
  3863. @example
  3864. silencedetect=n=-50dB:d=5
  3865. @end example
  3866. @item
  3867. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3868. tolerance in @file{silence.mp3}:
  3869. @example
  3870. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3871. @end example
  3872. @end itemize
  3873. @section silenceremove
  3874. Remove silence from the beginning, middle or end of the audio.
  3875. The filter accepts the following options:
  3876. @table @option
  3877. @item start_periods
  3878. This value is used to indicate if audio should be trimmed at beginning of
  3879. the audio. A value of zero indicates no silence should be trimmed from the
  3880. beginning. When specifying a non-zero value, it trims audio up until it
  3881. finds non-silence. Normally, when trimming silence from beginning of audio
  3882. the @var{start_periods} will be @code{1} but it can be increased to higher
  3883. values to trim all audio up to specific count of non-silence periods.
  3884. Default value is @code{0}.
  3885. @item start_duration
  3886. Specify the amount of time that non-silence must be detected before it stops
  3887. trimming audio. By increasing the duration, bursts of noises can be treated
  3888. as silence and trimmed off. Default value is @code{0}.
  3889. @item start_threshold
  3890. This indicates what sample value should be treated as silence. For digital
  3891. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3892. you may wish to increase the value to account for background noise.
  3893. Can be specified in dB (in case "dB" is appended to the specified value)
  3894. or amplitude ratio. Default value is @code{0}.
  3895. @item start_silence
  3896. Specify max duration of silence at beginning that will be kept after
  3897. trimming. Default is 0, which is equal to trimming all samples detected
  3898. as silence.
  3899. @item start_mode
  3900. Specify mode of detection of silence end in start of multi-channel audio.
  3901. Can be @var{any} or @var{all}. Default is @var{any}.
  3902. With @var{any}, any sample that is detected as non-silence will cause
  3903. stopped trimming of silence.
  3904. With @var{all}, only if all channels are detected as non-silence will cause
  3905. stopped trimming of silence.
  3906. @item stop_periods
  3907. Set the count for trimming silence from the end of audio.
  3908. To remove silence from the middle of a file, specify a @var{stop_periods}
  3909. that is negative. This value is then treated as a positive value and is
  3910. used to indicate the effect should restart processing as specified by
  3911. @var{start_periods}, making it suitable for removing periods of silence
  3912. in the middle of the audio.
  3913. Default value is @code{0}.
  3914. @item stop_duration
  3915. Specify a duration of silence that must exist before audio is not copied any
  3916. more. By specifying a higher duration, silence that is wanted can be left in
  3917. the audio.
  3918. Default value is @code{0}.
  3919. @item stop_threshold
  3920. This is the same as @option{start_threshold} but for trimming silence from
  3921. the end of audio.
  3922. Can be specified in dB (in case "dB" is appended to the specified value)
  3923. or amplitude ratio. Default value is @code{0}.
  3924. @item stop_silence
  3925. Specify max duration of silence at end that will be kept after
  3926. trimming. Default is 0, which is equal to trimming all samples detected
  3927. as silence.
  3928. @item stop_mode
  3929. Specify mode of detection of silence start in end of multi-channel audio.
  3930. Can be @var{any} or @var{all}. Default is @var{any}.
  3931. With @var{any}, any sample that is detected as non-silence will cause
  3932. stopped trimming of silence.
  3933. With @var{all}, only if all channels are detected as non-silence will cause
  3934. stopped trimming of silence.
  3935. @item detection
  3936. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3937. and works better with digital silence which is exactly 0.
  3938. Default value is @code{rms}.
  3939. @item window
  3940. Set duration in number of seconds used to calculate size of window in number
  3941. of samples for detecting silence.
  3942. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3943. @end table
  3944. @subsection Examples
  3945. @itemize
  3946. @item
  3947. The following example shows how this filter can be used to start a recording
  3948. that does not contain the delay at the start which usually occurs between
  3949. pressing the record button and the start of the performance:
  3950. @example
  3951. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3952. @end example
  3953. @item
  3954. Trim all silence encountered from beginning to end where there is more than 1
  3955. second of silence in audio:
  3956. @example
  3957. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3958. @end example
  3959. @item
  3960. Trim all digital silence samples, using peak detection, from beginning to end
  3961. where there is more than 0 samples of digital silence in audio and digital
  3962. silence is detected in all channels at same positions in stream:
  3963. @example
  3964. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  3965. @end example
  3966. @end itemize
  3967. @section sofalizer
  3968. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3969. loudspeakers around the user for binaural listening via headphones (audio
  3970. formats up to 9 channels supported).
  3971. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3972. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3973. Austrian Academy of Sciences.
  3974. To enable compilation of this filter you need to configure FFmpeg with
  3975. @code{--enable-libmysofa}.
  3976. The filter accepts the following options:
  3977. @table @option
  3978. @item sofa
  3979. Set the SOFA file used for rendering.
  3980. @item gain
  3981. Set gain applied to audio. Value is in dB. Default is 0.
  3982. @item rotation
  3983. Set rotation of virtual loudspeakers in deg. Default is 0.
  3984. @item elevation
  3985. Set elevation of virtual speakers in deg. Default is 0.
  3986. @item radius
  3987. Set distance in meters between loudspeakers and the listener with near-field
  3988. HRTFs. Default is 1.
  3989. @item type
  3990. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3991. processing audio in time domain which is slow.
  3992. @var{freq} is processing audio in frequency domain which is fast.
  3993. Default is @var{freq}.
  3994. @item speakers
  3995. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3996. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3997. Each virtual loudspeaker is described with short channel name following with
  3998. azimuth and elevation in degrees.
  3999. Each virtual loudspeaker description is separated by '|'.
  4000. For example to override front left and front right channel positions use:
  4001. 'speakers=FL 45 15|FR 345 15'.
  4002. Descriptions with unrecognised channel names are ignored.
  4003. @item lfegain
  4004. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4005. @item framesize
  4006. Set custom frame size in number of samples. Default is 1024.
  4007. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4008. is set to @var{freq}.
  4009. @item normalize
  4010. Should all IRs be normalized upon importing SOFA file.
  4011. By default is enabled.
  4012. @item interpolate
  4013. Should nearest IRs be interpolated with neighbor IRs if exact position
  4014. does not match. By default is disabled.
  4015. @item minphase
  4016. Minphase all IRs upon loading of SOFA file. By default is disabled.
  4017. @item anglestep
  4018. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  4019. @item radstep
  4020. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  4021. @end table
  4022. @subsection Examples
  4023. @itemize
  4024. @item
  4025. Using ClubFritz6 sofa file:
  4026. @example
  4027. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  4028. @end example
  4029. @item
  4030. Using ClubFritz12 sofa file and bigger radius with small rotation:
  4031. @example
  4032. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  4033. @end example
  4034. @item
  4035. Similar as above but with custom speaker positions for front left, front right, back left and back right
  4036. and also with custom gain:
  4037. @example
  4038. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  4039. @end example
  4040. @end itemize
  4041. @section stereotools
  4042. This filter has some handy utilities to manage stereo signals, for converting
  4043. M/S stereo recordings to L/R signal while having control over the parameters
  4044. or spreading the stereo image of master track.
  4045. The filter accepts the following options:
  4046. @table @option
  4047. @item level_in
  4048. Set input level before filtering for both channels. Defaults is 1.
  4049. Allowed range is from 0.015625 to 64.
  4050. @item level_out
  4051. Set output level after filtering for both channels. Defaults is 1.
  4052. Allowed range is from 0.015625 to 64.
  4053. @item balance_in
  4054. Set input balance between both channels. Default is 0.
  4055. Allowed range is from -1 to 1.
  4056. @item balance_out
  4057. Set output balance between both channels. Default is 0.
  4058. Allowed range is from -1 to 1.
  4059. @item softclip
  4060. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  4061. clipping. Disabled by default.
  4062. @item mutel
  4063. Mute the left channel. Disabled by default.
  4064. @item muter
  4065. Mute the right channel. Disabled by default.
  4066. @item phasel
  4067. Change the phase of the left channel. Disabled by default.
  4068. @item phaser
  4069. Change the phase of the right channel. Disabled by default.
  4070. @item mode
  4071. Set stereo mode. Available values are:
  4072. @table @samp
  4073. @item lr>lr
  4074. Left/Right to Left/Right, this is default.
  4075. @item lr>ms
  4076. Left/Right to Mid/Side.
  4077. @item ms>lr
  4078. Mid/Side to Left/Right.
  4079. @item lr>ll
  4080. Left/Right to Left/Left.
  4081. @item lr>rr
  4082. Left/Right to Right/Right.
  4083. @item lr>l+r
  4084. Left/Right to Left + Right.
  4085. @item lr>rl
  4086. Left/Right to Right/Left.
  4087. @item ms>ll
  4088. Mid/Side to Left/Left.
  4089. @item ms>rr
  4090. Mid/Side to Right/Right.
  4091. @end table
  4092. @item slev
  4093. Set level of side signal. Default is 1.
  4094. Allowed range is from 0.015625 to 64.
  4095. @item sbal
  4096. Set balance of side signal. Default is 0.
  4097. Allowed range is from -1 to 1.
  4098. @item mlev
  4099. Set level of the middle signal. Default is 1.
  4100. Allowed range is from 0.015625 to 64.
  4101. @item mpan
  4102. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4103. @item base
  4104. Set stereo base between mono and inversed channels. Default is 0.
  4105. Allowed range is from -1 to 1.
  4106. @item delay
  4107. Set delay in milliseconds how much to delay left from right channel and
  4108. vice versa. Default is 0. Allowed range is from -20 to 20.
  4109. @item sclevel
  4110. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4111. @item phase
  4112. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4113. @item bmode_in, bmode_out
  4114. Set balance mode for balance_in/balance_out option.
  4115. Can be one of the following:
  4116. @table @samp
  4117. @item balance
  4118. Classic balance mode. Attenuate one channel at time.
  4119. Gain is raised up to 1.
  4120. @item amplitude
  4121. Similar as classic mode above but gain is raised up to 2.
  4122. @item power
  4123. Equal power distribution, from -6dB to +6dB range.
  4124. @end table
  4125. @end table
  4126. @subsection Examples
  4127. @itemize
  4128. @item
  4129. Apply karaoke like effect:
  4130. @example
  4131. stereotools=mlev=0.015625
  4132. @end example
  4133. @item
  4134. Convert M/S signal to L/R:
  4135. @example
  4136. "stereotools=mode=ms>lr"
  4137. @end example
  4138. @end itemize
  4139. @section stereowiden
  4140. This filter enhance the stereo effect by suppressing signal common to both
  4141. channels and by delaying the signal of left into right and vice versa,
  4142. thereby widening the stereo effect.
  4143. The filter accepts the following options:
  4144. @table @option
  4145. @item delay
  4146. Time in milliseconds of the delay of left signal into right and vice versa.
  4147. Default is 20 milliseconds.
  4148. @item feedback
  4149. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4150. effect of left signal in right output and vice versa which gives widening
  4151. effect. Default is 0.3.
  4152. @item crossfeed
  4153. Cross feed of left into right with inverted phase. This helps in suppressing
  4154. the mono. If the value is 1 it will cancel all the signal common to both
  4155. channels. Default is 0.3.
  4156. @item drymix
  4157. Set level of input signal of original channel. Default is 0.8.
  4158. @end table
  4159. @subsection Commands
  4160. This filter supports the all above options except @code{delay} as @ref{commands}.
  4161. @section superequalizer
  4162. Apply 18 band equalizer.
  4163. The filter accepts the following options:
  4164. @table @option
  4165. @item 1b
  4166. Set 65Hz band gain.
  4167. @item 2b
  4168. Set 92Hz band gain.
  4169. @item 3b
  4170. Set 131Hz band gain.
  4171. @item 4b
  4172. Set 185Hz band gain.
  4173. @item 5b
  4174. Set 262Hz band gain.
  4175. @item 6b
  4176. Set 370Hz band gain.
  4177. @item 7b
  4178. Set 523Hz band gain.
  4179. @item 8b
  4180. Set 740Hz band gain.
  4181. @item 9b
  4182. Set 1047Hz band gain.
  4183. @item 10b
  4184. Set 1480Hz band gain.
  4185. @item 11b
  4186. Set 2093Hz band gain.
  4187. @item 12b
  4188. Set 2960Hz band gain.
  4189. @item 13b
  4190. Set 4186Hz band gain.
  4191. @item 14b
  4192. Set 5920Hz band gain.
  4193. @item 15b
  4194. Set 8372Hz band gain.
  4195. @item 16b
  4196. Set 11840Hz band gain.
  4197. @item 17b
  4198. Set 16744Hz band gain.
  4199. @item 18b
  4200. Set 20000Hz band gain.
  4201. @end table
  4202. @section surround
  4203. Apply audio surround upmix filter.
  4204. This filter allows to produce multichannel output from audio stream.
  4205. The filter accepts the following options:
  4206. @table @option
  4207. @item chl_out
  4208. Set output channel layout. By default, this is @var{5.1}.
  4209. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4210. for the required syntax.
  4211. @item chl_in
  4212. Set input channel layout. By default, this is @var{stereo}.
  4213. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4214. for the required syntax.
  4215. @item level_in
  4216. Set input volume level. By default, this is @var{1}.
  4217. @item level_out
  4218. Set output volume level. By default, this is @var{1}.
  4219. @item lfe
  4220. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4221. @item lfe_low
  4222. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4223. @item lfe_high
  4224. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4225. @item lfe_mode
  4226. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4227. In @var{add} mode, LFE channel is created from input audio and added to output.
  4228. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4229. also all non-LFE output channels are subtracted with output LFE channel.
  4230. @item angle
  4231. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4232. Default is @var{90}.
  4233. @item fc_in
  4234. Set front center input volume. By default, this is @var{1}.
  4235. @item fc_out
  4236. Set front center output volume. By default, this is @var{1}.
  4237. @item fl_in
  4238. Set front left input volume. By default, this is @var{1}.
  4239. @item fl_out
  4240. Set front left output volume. By default, this is @var{1}.
  4241. @item fr_in
  4242. Set front right input volume. By default, this is @var{1}.
  4243. @item fr_out
  4244. Set front right output volume. By default, this is @var{1}.
  4245. @item sl_in
  4246. Set side left input volume. By default, this is @var{1}.
  4247. @item sl_out
  4248. Set side left output volume. By default, this is @var{1}.
  4249. @item sr_in
  4250. Set side right input volume. By default, this is @var{1}.
  4251. @item sr_out
  4252. Set side right output volume. By default, this is @var{1}.
  4253. @item bl_in
  4254. Set back left input volume. By default, this is @var{1}.
  4255. @item bl_out
  4256. Set back left output volume. By default, this is @var{1}.
  4257. @item br_in
  4258. Set back right input volume. By default, this is @var{1}.
  4259. @item br_out
  4260. Set back right output volume. By default, this is @var{1}.
  4261. @item bc_in
  4262. Set back center input volume. By default, this is @var{1}.
  4263. @item bc_out
  4264. Set back center output volume. By default, this is @var{1}.
  4265. @item lfe_in
  4266. Set LFE input volume. By default, this is @var{1}.
  4267. @item lfe_out
  4268. Set LFE output volume. By default, this is @var{1}.
  4269. @item allx
  4270. Set spread usage of stereo image across X axis for all channels.
  4271. @item ally
  4272. Set spread usage of stereo image across Y axis for all channels.
  4273. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4274. Set spread usage of stereo image across X axis for each channel.
  4275. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4276. Set spread usage of stereo image across Y axis for each channel.
  4277. @item win_size
  4278. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4279. @item win_func
  4280. Set window function.
  4281. It accepts the following values:
  4282. @table @samp
  4283. @item rect
  4284. @item bartlett
  4285. @item hann, hanning
  4286. @item hamming
  4287. @item blackman
  4288. @item welch
  4289. @item flattop
  4290. @item bharris
  4291. @item bnuttall
  4292. @item bhann
  4293. @item sine
  4294. @item nuttall
  4295. @item lanczos
  4296. @item gauss
  4297. @item tukey
  4298. @item dolph
  4299. @item cauchy
  4300. @item parzen
  4301. @item poisson
  4302. @item bohman
  4303. @end table
  4304. Default is @code{hann}.
  4305. @item overlap
  4306. Set window overlap. If set to 1, the recommended overlap for selected
  4307. window function will be picked. Default is @code{0.5}.
  4308. @end table
  4309. @section treble, highshelf
  4310. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4311. shelving filter with a response similar to that of a standard
  4312. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4313. The filter accepts the following options:
  4314. @table @option
  4315. @item gain, g
  4316. Give the gain at whichever is the lower of ~22 kHz and the
  4317. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4318. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4319. @item frequency, f
  4320. Set the filter's central frequency and so can be used
  4321. to extend or reduce the frequency range to be boosted or cut.
  4322. The default value is @code{3000} Hz.
  4323. @item width_type, t
  4324. Set method to specify band-width of filter.
  4325. @table @option
  4326. @item h
  4327. Hz
  4328. @item q
  4329. Q-Factor
  4330. @item o
  4331. octave
  4332. @item s
  4333. slope
  4334. @item k
  4335. kHz
  4336. @end table
  4337. @item width, w
  4338. Determine how steep is the filter's shelf transition.
  4339. @item mix, m
  4340. How much to use filtered signal in output. Default is 1.
  4341. Range is between 0 and 1.
  4342. @item channels, c
  4343. Specify which channels to filter, by default all available are filtered.
  4344. @item normalize, n
  4345. Normalize biquad coefficients, by default is disabled.
  4346. Enabling it will normalize magnitude response at DC to 0dB.
  4347. @item transform, a
  4348. Set transform type of IIR filter.
  4349. @table @option
  4350. @item di
  4351. @item dii
  4352. @item tdii
  4353. @end table
  4354. @end table
  4355. @subsection Commands
  4356. This filter supports the following commands:
  4357. @table @option
  4358. @item frequency, f
  4359. Change treble frequency.
  4360. Syntax for the command is : "@var{frequency}"
  4361. @item width_type, t
  4362. Change treble width_type.
  4363. Syntax for the command is : "@var{width_type}"
  4364. @item width, w
  4365. Change treble width.
  4366. Syntax for the command is : "@var{width}"
  4367. @item gain, g
  4368. Change treble gain.
  4369. Syntax for the command is : "@var{gain}"
  4370. @item mix, m
  4371. Change treble mix.
  4372. Syntax for the command is : "@var{mix}"
  4373. @end table
  4374. @section tremolo
  4375. Sinusoidal amplitude modulation.
  4376. The filter accepts the following options:
  4377. @table @option
  4378. @item f
  4379. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4380. (20 Hz or lower) will result in a tremolo effect.
  4381. This filter may also be used as a ring modulator by specifying
  4382. a modulation frequency higher than 20 Hz.
  4383. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4384. @item d
  4385. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4386. Default value is 0.5.
  4387. @end table
  4388. @section vibrato
  4389. Sinusoidal phase modulation.
  4390. The filter accepts the following options:
  4391. @table @option
  4392. @item f
  4393. Modulation frequency in Hertz.
  4394. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4395. @item d
  4396. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4397. Default value is 0.5.
  4398. @end table
  4399. @section volume
  4400. Adjust the input audio volume.
  4401. It accepts the following parameters:
  4402. @table @option
  4403. @item volume
  4404. Set audio volume expression.
  4405. Output values are clipped to the maximum value.
  4406. The output audio volume is given by the relation:
  4407. @example
  4408. @var{output_volume} = @var{volume} * @var{input_volume}
  4409. @end example
  4410. The default value for @var{volume} is "1.0".
  4411. @item precision
  4412. This parameter represents the mathematical precision.
  4413. It determines which input sample formats will be allowed, which affects the
  4414. precision of the volume scaling.
  4415. @table @option
  4416. @item fixed
  4417. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4418. @item float
  4419. 32-bit floating-point; this limits input sample format to FLT. (default)
  4420. @item double
  4421. 64-bit floating-point; this limits input sample format to DBL.
  4422. @end table
  4423. @item replaygain
  4424. Choose the behaviour on encountering ReplayGain side data in input frames.
  4425. @table @option
  4426. @item drop
  4427. Remove ReplayGain side data, ignoring its contents (the default).
  4428. @item ignore
  4429. Ignore ReplayGain side data, but leave it in the frame.
  4430. @item track
  4431. Prefer the track gain, if present.
  4432. @item album
  4433. Prefer the album gain, if present.
  4434. @end table
  4435. @item replaygain_preamp
  4436. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4437. Default value for @var{replaygain_preamp} is 0.0.
  4438. @item replaygain_noclip
  4439. Prevent clipping by limiting the gain applied.
  4440. Default value for @var{replaygain_noclip} is 1.
  4441. @item eval
  4442. Set when the volume expression is evaluated.
  4443. It accepts the following values:
  4444. @table @samp
  4445. @item once
  4446. only evaluate expression once during the filter initialization, or
  4447. when the @samp{volume} command is sent
  4448. @item frame
  4449. evaluate expression for each incoming frame
  4450. @end table
  4451. Default value is @samp{once}.
  4452. @end table
  4453. The volume expression can contain the following parameters.
  4454. @table @option
  4455. @item n
  4456. frame number (starting at zero)
  4457. @item nb_channels
  4458. number of channels
  4459. @item nb_consumed_samples
  4460. number of samples consumed by the filter
  4461. @item nb_samples
  4462. number of samples in the current frame
  4463. @item pos
  4464. original frame position in the file
  4465. @item pts
  4466. frame PTS
  4467. @item sample_rate
  4468. sample rate
  4469. @item startpts
  4470. PTS at start of stream
  4471. @item startt
  4472. time at start of stream
  4473. @item t
  4474. frame time
  4475. @item tb
  4476. timestamp timebase
  4477. @item volume
  4478. last set volume value
  4479. @end table
  4480. Note that when @option{eval} is set to @samp{once} only the
  4481. @var{sample_rate} and @var{tb} variables are available, all other
  4482. variables will evaluate to NAN.
  4483. @subsection Commands
  4484. This filter supports the following commands:
  4485. @table @option
  4486. @item volume
  4487. Modify the volume expression.
  4488. The command accepts the same syntax of the corresponding option.
  4489. If the specified expression is not valid, it is kept at its current
  4490. value.
  4491. @end table
  4492. @subsection Examples
  4493. @itemize
  4494. @item
  4495. Halve the input audio volume:
  4496. @example
  4497. volume=volume=0.5
  4498. volume=volume=1/2
  4499. volume=volume=-6.0206dB
  4500. @end example
  4501. In all the above example the named key for @option{volume} can be
  4502. omitted, for example like in:
  4503. @example
  4504. volume=0.5
  4505. @end example
  4506. @item
  4507. Increase input audio power by 6 decibels using fixed-point precision:
  4508. @example
  4509. volume=volume=6dB:precision=fixed
  4510. @end example
  4511. @item
  4512. Fade volume after time 10 with an annihilation period of 5 seconds:
  4513. @example
  4514. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4515. @end example
  4516. @end itemize
  4517. @section volumedetect
  4518. Detect the volume of the input video.
  4519. The filter has no parameters. The input is not modified. Statistics about
  4520. the volume will be printed in the log when the input stream end is reached.
  4521. In particular it will show the mean volume (root mean square), maximum
  4522. volume (on a per-sample basis), and the beginning of a histogram of the
  4523. registered volume values (from the maximum value to a cumulated 1/1000 of
  4524. the samples).
  4525. All volumes are in decibels relative to the maximum PCM value.
  4526. @subsection Examples
  4527. Here is an excerpt of the output:
  4528. @example
  4529. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4530. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4531. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4532. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4533. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4534. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4535. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4536. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4537. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4538. @end example
  4539. It means that:
  4540. @itemize
  4541. @item
  4542. The mean square energy is approximately -27 dB, or 10^-2.7.
  4543. @item
  4544. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4545. @item
  4546. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4547. @end itemize
  4548. In other words, raising the volume by +4 dB does not cause any clipping,
  4549. raising it by +5 dB causes clipping for 6 samples, etc.
  4550. @c man end AUDIO FILTERS
  4551. @chapter Audio Sources
  4552. @c man begin AUDIO SOURCES
  4553. Below is a description of the currently available audio sources.
  4554. @section abuffer
  4555. Buffer audio frames, and make them available to the filter chain.
  4556. This source is mainly intended for a programmatic use, in particular
  4557. through the interface defined in @file{libavfilter/buffersrc.h}.
  4558. It accepts the following parameters:
  4559. @table @option
  4560. @item time_base
  4561. The timebase which will be used for timestamps of submitted frames. It must be
  4562. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4563. @item sample_rate
  4564. The sample rate of the incoming audio buffers.
  4565. @item sample_fmt
  4566. The sample format of the incoming audio buffers.
  4567. Either a sample format name or its corresponding integer representation from
  4568. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4569. @item channel_layout
  4570. The channel layout of the incoming audio buffers.
  4571. Either a channel layout name from channel_layout_map in
  4572. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4573. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4574. @item channels
  4575. The number of channels of the incoming audio buffers.
  4576. If both @var{channels} and @var{channel_layout} are specified, then they
  4577. must be consistent.
  4578. @end table
  4579. @subsection Examples
  4580. @example
  4581. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4582. @end example
  4583. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4584. Since the sample format with name "s16p" corresponds to the number
  4585. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4586. equivalent to:
  4587. @example
  4588. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4589. @end example
  4590. @section aevalsrc
  4591. Generate an audio signal specified by an expression.
  4592. This source accepts in input one or more expressions (one for each
  4593. channel), which are evaluated and used to generate a corresponding
  4594. audio signal.
  4595. This source accepts the following options:
  4596. @table @option
  4597. @item exprs
  4598. Set the '|'-separated expressions list for each separate channel. In case the
  4599. @option{channel_layout} option is not specified, the selected channel layout
  4600. depends on the number of provided expressions. Otherwise the last
  4601. specified expression is applied to the remaining output channels.
  4602. @item channel_layout, c
  4603. Set the channel layout. The number of channels in the specified layout
  4604. must be equal to the number of specified expressions.
  4605. @item duration, d
  4606. Set the minimum duration of the sourced audio. See
  4607. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4608. for the accepted syntax.
  4609. Note that the resulting duration may be greater than the specified
  4610. duration, as the generated audio is always cut at the end of a
  4611. complete frame.
  4612. If not specified, or the expressed duration is negative, the audio is
  4613. supposed to be generated forever.
  4614. @item nb_samples, n
  4615. Set the number of samples per channel per each output frame,
  4616. default to 1024.
  4617. @item sample_rate, s
  4618. Specify the sample rate, default to 44100.
  4619. @end table
  4620. Each expression in @var{exprs} can contain the following constants:
  4621. @table @option
  4622. @item n
  4623. number of the evaluated sample, starting from 0
  4624. @item t
  4625. time of the evaluated sample expressed in seconds, starting from 0
  4626. @item s
  4627. sample rate
  4628. @end table
  4629. @subsection Examples
  4630. @itemize
  4631. @item
  4632. Generate silence:
  4633. @example
  4634. aevalsrc=0
  4635. @end example
  4636. @item
  4637. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4638. 8000 Hz:
  4639. @example
  4640. aevalsrc="sin(440*2*PI*t):s=8000"
  4641. @end example
  4642. @item
  4643. Generate a two channels signal, specify the channel layout (Front
  4644. Center + Back Center) explicitly:
  4645. @example
  4646. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4647. @end example
  4648. @item
  4649. Generate white noise:
  4650. @example
  4651. aevalsrc="-2+random(0)"
  4652. @end example
  4653. @item
  4654. Generate an amplitude modulated signal:
  4655. @example
  4656. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4657. @end example
  4658. @item
  4659. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4660. @example
  4661. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4662. @end example
  4663. @end itemize
  4664. @section afirsrc
  4665. Generate a FIR coefficients using frequency sampling method.
  4666. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4667. The filter accepts the following options:
  4668. @table @option
  4669. @item taps, t
  4670. Set number of filter coefficents in output audio stream.
  4671. Default value is 1025.
  4672. @item frequency, f
  4673. Set frequency points from where magnitude and phase are set.
  4674. This must be in non decreasing order, and first element must be 0, while last element
  4675. must be 1. Elements are separated by white spaces.
  4676. @item magnitude, m
  4677. Set magnitude value for every frequency point set by @option{frequency}.
  4678. Number of values must be same as number of frequency points.
  4679. Values are separated by white spaces.
  4680. @item phase, p
  4681. Set phase value for every frequency point set by @option{frequency}.
  4682. Number of values must be same as number of frequency points.
  4683. Values are separated by white spaces.
  4684. @item sample_rate, r
  4685. Set sample rate, default is 44100.
  4686. @item nb_samples, n
  4687. Set number of samples per each frame. Default is 1024.
  4688. @item win_func, w
  4689. Set window function. Default is blackman.
  4690. @end table
  4691. @section anullsrc
  4692. The null audio source, return unprocessed audio frames. It is mainly useful
  4693. as a template and to be employed in analysis / debugging tools, or as
  4694. the source for filters which ignore the input data (for example the sox
  4695. synth filter).
  4696. This source accepts the following options:
  4697. @table @option
  4698. @item channel_layout, cl
  4699. Specifies the channel layout, and can be either an integer or a string
  4700. representing a channel layout. The default value of @var{channel_layout}
  4701. is "stereo".
  4702. Check the channel_layout_map definition in
  4703. @file{libavutil/channel_layout.c} for the mapping between strings and
  4704. channel layout values.
  4705. @item sample_rate, r
  4706. Specifies the sample rate, and defaults to 44100.
  4707. @item nb_samples, n
  4708. Set the number of samples per requested frames.
  4709. @end table
  4710. @subsection Examples
  4711. @itemize
  4712. @item
  4713. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4714. @example
  4715. anullsrc=r=48000:cl=4
  4716. @end example
  4717. @item
  4718. Do the same operation with a more obvious syntax:
  4719. @example
  4720. anullsrc=r=48000:cl=mono
  4721. @end example
  4722. @end itemize
  4723. All the parameters need to be explicitly defined.
  4724. @section flite
  4725. Synthesize a voice utterance using the libflite library.
  4726. To enable compilation of this filter you need to configure FFmpeg with
  4727. @code{--enable-libflite}.
  4728. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4729. The filter accepts the following options:
  4730. @table @option
  4731. @item list_voices
  4732. If set to 1, list the names of the available voices and exit
  4733. immediately. Default value is 0.
  4734. @item nb_samples, n
  4735. Set the maximum number of samples per frame. Default value is 512.
  4736. @item textfile
  4737. Set the filename containing the text to speak.
  4738. @item text
  4739. Set the text to speak.
  4740. @item voice, v
  4741. Set the voice to use for the speech synthesis. Default value is
  4742. @code{kal}. See also the @var{list_voices} option.
  4743. @end table
  4744. @subsection Examples
  4745. @itemize
  4746. @item
  4747. Read from file @file{speech.txt}, and synthesize the text using the
  4748. standard flite voice:
  4749. @example
  4750. flite=textfile=speech.txt
  4751. @end example
  4752. @item
  4753. Read the specified text selecting the @code{slt} voice:
  4754. @example
  4755. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4756. @end example
  4757. @item
  4758. Input text to ffmpeg:
  4759. @example
  4760. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4761. @end example
  4762. @item
  4763. Make @file{ffplay} speak the specified text, using @code{flite} and
  4764. the @code{lavfi} device:
  4765. @example
  4766. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4767. @end example
  4768. @end itemize
  4769. For more information about libflite, check:
  4770. @url{http://www.festvox.org/flite/}
  4771. @section anoisesrc
  4772. Generate a noise audio signal.
  4773. The filter accepts the following options:
  4774. @table @option
  4775. @item sample_rate, r
  4776. Specify the sample rate. Default value is 48000 Hz.
  4777. @item amplitude, a
  4778. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4779. is 1.0.
  4780. @item duration, d
  4781. Specify the duration of the generated audio stream. Not specifying this option
  4782. results in noise with an infinite length.
  4783. @item color, colour, c
  4784. Specify the color of noise. Available noise colors are white, pink, brown,
  4785. blue, violet and velvet. Default color is white.
  4786. @item seed, s
  4787. Specify a value used to seed the PRNG.
  4788. @item nb_samples, n
  4789. Set the number of samples per each output frame, default is 1024.
  4790. @end table
  4791. @subsection Examples
  4792. @itemize
  4793. @item
  4794. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4795. @example
  4796. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4797. @end example
  4798. @end itemize
  4799. @section hilbert
  4800. Generate odd-tap Hilbert transform FIR coefficients.
  4801. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4802. the signal by 90 degrees.
  4803. This is used in many matrix coding schemes and for analytic signal generation.
  4804. The process is often written as a multiplication by i (or j), the imaginary unit.
  4805. The filter accepts the following options:
  4806. @table @option
  4807. @item sample_rate, s
  4808. Set sample rate, default is 44100.
  4809. @item taps, t
  4810. Set length of FIR filter, default is 22051.
  4811. @item nb_samples, n
  4812. Set number of samples per each frame.
  4813. @item win_func, w
  4814. Set window function to be used when generating FIR coefficients.
  4815. @end table
  4816. @section sinc
  4817. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4818. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4819. The filter accepts the following options:
  4820. @table @option
  4821. @item sample_rate, r
  4822. Set sample rate, default is 44100.
  4823. @item nb_samples, n
  4824. Set number of samples per each frame. Default is 1024.
  4825. @item hp
  4826. Set high-pass frequency. Default is 0.
  4827. @item lp
  4828. Set low-pass frequency. Default is 0.
  4829. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4830. is higher than 0 then filter will create band-pass filter coefficients,
  4831. otherwise band-reject filter coefficients.
  4832. @item phase
  4833. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4834. @item beta
  4835. Set Kaiser window beta.
  4836. @item att
  4837. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4838. @item round
  4839. Enable rounding, by default is disabled.
  4840. @item hptaps
  4841. Set number of taps for high-pass filter.
  4842. @item lptaps
  4843. Set number of taps for low-pass filter.
  4844. @end table
  4845. @section sine
  4846. Generate an audio signal made of a sine wave with amplitude 1/8.
  4847. The audio signal is bit-exact.
  4848. The filter accepts the following options:
  4849. @table @option
  4850. @item frequency, f
  4851. Set the carrier frequency. Default is 440 Hz.
  4852. @item beep_factor, b
  4853. Enable a periodic beep every second with frequency @var{beep_factor} times
  4854. the carrier frequency. Default is 0, meaning the beep is disabled.
  4855. @item sample_rate, r
  4856. Specify the sample rate, default is 44100.
  4857. @item duration, d
  4858. Specify the duration of the generated audio stream.
  4859. @item samples_per_frame
  4860. Set the number of samples per output frame.
  4861. The expression can contain the following constants:
  4862. @table @option
  4863. @item n
  4864. The (sequential) number of the output audio frame, starting from 0.
  4865. @item pts
  4866. The PTS (Presentation TimeStamp) of the output audio frame,
  4867. expressed in @var{TB} units.
  4868. @item t
  4869. The PTS of the output audio frame, expressed in seconds.
  4870. @item TB
  4871. The timebase of the output audio frames.
  4872. @end table
  4873. Default is @code{1024}.
  4874. @end table
  4875. @subsection Examples
  4876. @itemize
  4877. @item
  4878. Generate a simple 440 Hz sine wave:
  4879. @example
  4880. sine
  4881. @end example
  4882. @item
  4883. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4884. @example
  4885. sine=220:4:d=5
  4886. sine=f=220:b=4:d=5
  4887. sine=frequency=220:beep_factor=4:duration=5
  4888. @end example
  4889. @item
  4890. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4891. pattern:
  4892. @example
  4893. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4894. @end example
  4895. @end itemize
  4896. @c man end AUDIO SOURCES
  4897. @chapter Audio Sinks
  4898. @c man begin AUDIO SINKS
  4899. Below is a description of the currently available audio sinks.
  4900. @section abuffersink
  4901. Buffer audio frames, and make them available to the end of filter chain.
  4902. This sink is mainly intended for programmatic use, in particular
  4903. through the interface defined in @file{libavfilter/buffersink.h}
  4904. or the options system.
  4905. It accepts a pointer to an AVABufferSinkContext structure, which
  4906. defines the incoming buffers' formats, to be passed as the opaque
  4907. parameter to @code{avfilter_init_filter} for initialization.
  4908. @section anullsink
  4909. Null audio sink; do absolutely nothing with the input audio. It is
  4910. mainly useful as a template and for use in analysis / debugging
  4911. tools.
  4912. @c man end AUDIO SINKS
  4913. @chapter Video Filters
  4914. @c man begin VIDEO FILTERS
  4915. When you configure your FFmpeg build, you can disable any of the
  4916. existing filters using @code{--disable-filters}.
  4917. The configure output will show the video filters included in your
  4918. build.
  4919. Below is a description of the currently available video filters.
  4920. @section addroi
  4921. Mark a region of interest in a video frame.
  4922. The frame data is passed through unchanged, but metadata is attached
  4923. to the frame indicating regions of interest which can affect the
  4924. behaviour of later encoding. Multiple regions can be marked by
  4925. applying the filter multiple times.
  4926. @table @option
  4927. @item x
  4928. Region distance in pixels from the left edge of the frame.
  4929. @item y
  4930. Region distance in pixels from the top edge of the frame.
  4931. @item w
  4932. Region width in pixels.
  4933. @item h
  4934. Region height in pixels.
  4935. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4936. and may contain the following variables:
  4937. @table @option
  4938. @item iw
  4939. Width of the input frame.
  4940. @item ih
  4941. Height of the input frame.
  4942. @end table
  4943. @item qoffset
  4944. Quantisation offset to apply within the region.
  4945. This must be a real value in the range -1 to +1. A value of zero
  4946. indicates no quality change. A negative value asks for better quality
  4947. (less quantisation), while a positive value asks for worse quality
  4948. (greater quantisation).
  4949. The range is calibrated so that the extreme values indicate the
  4950. largest possible offset - if the rest of the frame is encoded with the
  4951. worst possible quality, an offset of -1 indicates that this region
  4952. should be encoded with the best possible quality anyway. Intermediate
  4953. values are then interpolated in some codec-dependent way.
  4954. For example, in 10-bit H.264 the quantisation parameter varies between
  4955. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4956. this region should be encoded with a QP around one-tenth of the full
  4957. range better than the rest of the frame. So, if most of the frame
  4958. were to be encoded with a QP of around 30, this region would get a QP
  4959. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4960. An extreme value of -1 would indicate that this region should be
  4961. encoded with the best possible quality regardless of the treatment of
  4962. the rest of the frame - that is, should be encoded at a QP of -12.
  4963. @item clear
  4964. If set to true, remove any existing regions of interest marked on the
  4965. frame before adding the new one.
  4966. @end table
  4967. @subsection Examples
  4968. @itemize
  4969. @item
  4970. Mark the centre quarter of the frame as interesting.
  4971. @example
  4972. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4973. @end example
  4974. @item
  4975. Mark the 100-pixel-wide region on the left edge of the frame as very
  4976. uninteresting (to be encoded at much lower quality than the rest of
  4977. the frame).
  4978. @example
  4979. addroi=0:0:100:ih:+1/5
  4980. @end example
  4981. @end itemize
  4982. @section alphaextract
  4983. Extract the alpha component from the input as a grayscale video. This
  4984. is especially useful with the @var{alphamerge} filter.
  4985. @section alphamerge
  4986. Add or replace the alpha component of the primary input with the
  4987. grayscale value of a second input. This is intended for use with
  4988. @var{alphaextract} to allow the transmission or storage of frame
  4989. sequences that have alpha in a format that doesn't support an alpha
  4990. channel.
  4991. For example, to reconstruct full frames from a normal YUV-encoded video
  4992. and a separate video created with @var{alphaextract}, you might use:
  4993. @example
  4994. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4995. @end example
  4996. Since this filter is designed for reconstruction, it operates on frame
  4997. sequences without considering timestamps, and terminates when either
  4998. input reaches end of stream. This will cause problems if your encoding
  4999. pipeline drops frames. If you're trying to apply an image as an
  5000. overlay to a video stream, consider the @var{overlay} filter instead.
  5001. @section amplify
  5002. Amplify differences between current pixel and pixels of adjacent frames in
  5003. same pixel location.
  5004. This filter accepts the following options:
  5005. @table @option
  5006. @item radius
  5007. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  5008. For example radius of 3 will instruct filter to calculate average of 7 frames.
  5009. @item factor
  5010. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  5011. @item threshold
  5012. Set threshold for difference amplification. Any difference greater or equal to
  5013. this value will not alter source pixel. Default is 10.
  5014. Allowed range is from 0 to 65535.
  5015. @item tolerance
  5016. Set tolerance for difference amplification. Any difference lower to
  5017. this value will not alter source pixel. Default is 0.
  5018. Allowed range is from 0 to 65535.
  5019. @item low
  5020. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5021. This option controls maximum possible value that will decrease source pixel value.
  5022. @item high
  5023. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5024. This option controls maximum possible value that will increase source pixel value.
  5025. @item planes
  5026. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  5027. @end table
  5028. @subsection Commands
  5029. This filter supports the following @ref{commands} that corresponds to option of same name:
  5030. @table @option
  5031. @item factor
  5032. @item threshold
  5033. @item tolerance
  5034. @item low
  5035. @item high
  5036. @item planes
  5037. @end table
  5038. @section ass
  5039. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  5040. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  5041. Substation Alpha) subtitles files.
  5042. This filter accepts the following option in addition to the common options from
  5043. the @ref{subtitles} filter:
  5044. @table @option
  5045. @item shaping
  5046. Set the shaping engine
  5047. Available values are:
  5048. @table @samp
  5049. @item auto
  5050. The default libass shaping engine, which is the best available.
  5051. @item simple
  5052. Fast, font-agnostic shaper that can do only substitutions
  5053. @item complex
  5054. Slower shaper using OpenType for substitutions and positioning
  5055. @end table
  5056. The default is @code{auto}.
  5057. @end table
  5058. @section atadenoise
  5059. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  5060. The filter accepts the following options:
  5061. @table @option
  5062. @item 0a
  5063. Set threshold A for 1st plane. Default is 0.02.
  5064. Valid range is 0 to 0.3.
  5065. @item 0b
  5066. Set threshold B for 1st plane. Default is 0.04.
  5067. Valid range is 0 to 5.
  5068. @item 1a
  5069. Set threshold A for 2nd plane. Default is 0.02.
  5070. Valid range is 0 to 0.3.
  5071. @item 1b
  5072. Set threshold B for 2nd plane. Default is 0.04.
  5073. Valid range is 0 to 5.
  5074. @item 2a
  5075. Set threshold A for 3rd plane. Default is 0.02.
  5076. Valid range is 0 to 0.3.
  5077. @item 2b
  5078. Set threshold B for 3rd plane. Default is 0.04.
  5079. Valid range is 0 to 5.
  5080. Threshold A is designed to react on abrupt changes in the input signal and
  5081. threshold B is designed to react on continuous changes in the input signal.
  5082. @item s
  5083. Set number of frames filter will use for averaging. Default is 9. Must be odd
  5084. number in range [5, 129].
  5085. @item p
  5086. Set what planes of frame filter will use for averaging. Default is all.
  5087. @item a
  5088. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  5089. Alternatively can be set to @code{s} serial.
  5090. Parallel can be faster then serial, while other way around is never true.
  5091. Parallel will abort early on first change being greater then thresholds, while serial
  5092. will continue processing other side of frames if they are equal or bellow thresholds.
  5093. @end table
  5094. @subsection Commands
  5095. This filter supports same @ref{commands} as options except option @code{s}.
  5096. The command accepts the same syntax of the corresponding option.
  5097. @section avgblur
  5098. Apply average blur filter.
  5099. The filter accepts the following options:
  5100. @table @option
  5101. @item sizeX
  5102. Set horizontal radius size.
  5103. @item planes
  5104. Set which planes to filter. By default all planes are filtered.
  5105. @item sizeY
  5106. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5107. Default is @code{0}.
  5108. @end table
  5109. @subsection Commands
  5110. This filter supports same commands as options.
  5111. The command accepts the same syntax of the corresponding option.
  5112. If the specified expression is not valid, it is kept at its current
  5113. value.
  5114. @section bbox
  5115. Compute the bounding box for the non-black pixels in the input frame
  5116. luminance plane.
  5117. This filter computes the bounding box containing all the pixels with a
  5118. luminance value greater than the minimum allowed value.
  5119. The parameters describing the bounding box are printed on the filter
  5120. log.
  5121. The filter accepts the following option:
  5122. @table @option
  5123. @item min_val
  5124. Set the minimal luminance value. Default is @code{16}.
  5125. @end table
  5126. @section bilateral
  5127. Apply bilateral filter, spatial smoothing while preserving edges.
  5128. The filter accepts the following options:
  5129. @table @option
  5130. @item sigmaS
  5131. Set sigma of gaussian function to calculate spatial weight.
  5132. Allowed range is 0 to 512. Default is 0.1.
  5133. @item sigmaR
  5134. Set sigma of gaussian function to calculate range weight.
  5135. Allowed range is 0 to 1. Default is 0.1.
  5136. @item planes
  5137. Set planes to filter. Default is first only.
  5138. @end table
  5139. @section bitplanenoise
  5140. Show and measure bit plane noise.
  5141. The filter accepts the following options:
  5142. @table @option
  5143. @item bitplane
  5144. Set which plane to analyze. Default is @code{1}.
  5145. @item filter
  5146. Filter out noisy pixels from @code{bitplane} set above.
  5147. Default is disabled.
  5148. @end table
  5149. @section blackdetect
  5150. Detect video intervals that are (almost) completely black. Can be
  5151. useful to detect chapter transitions, commercials, or invalid
  5152. recordings.
  5153. The filter outputs its detection analysis to both the log as well as
  5154. frame metadata. If a black segment of at least the specified minimum
  5155. duration is found, a line with the start and end timestamps as well
  5156. as duration is printed to the log with level @code{info}. In addition,
  5157. a log line with level @code{debug} is printed per frame showing the
  5158. black amount detected for that frame.
  5159. The filter also attaches metadata to the first frame of a black
  5160. segment with key @code{lavfi.black_start} and to the first frame
  5161. after the black segment ends with key @code{lavfi.black_end}. The
  5162. value is the frame's timestamp. This metadata is added regardless
  5163. of the minimum duration specified.
  5164. The filter accepts the following options:
  5165. @table @option
  5166. @item black_min_duration, d
  5167. Set the minimum detected black duration expressed in seconds. It must
  5168. be a non-negative floating point number.
  5169. Default value is 2.0.
  5170. @item picture_black_ratio_th, pic_th
  5171. Set the threshold for considering a picture "black".
  5172. Express the minimum value for the ratio:
  5173. @example
  5174. @var{nb_black_pixels} / @var{nb_pixels}
  5175. @end example
  5176. for which a picture is considered black.
  5177. Default value is 0.98.
  5178. @item pixel_black_th, pix_th
  5179. Set the threshold for considering a pixel "black".
  5180. The threshold expresses the maximum pixel luminance value for which a
  5181. pixel is considered "black". The provided value is scaled according to
  5182. the following equation:
  5183. @example
  5184. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5185. @end example
  5186. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5187. the input video format, the range is [0-255] for YUV full-range
  5188. formats and [16-235] for YUV non full-range formats.
  5189. Default value is 0.10.
  5190. @end table
  5191. The following example sets the maximum pixel threshold to the minimum
  5192. value, and detects only black intervals of 2 or more seconds:
  5193. @example
  5194. blackdetect=d=2:pix_th=0.00
  5195. @end example
  5196. @section blackframe
  5197. Detect frames that are (almost) completely black. Can be useful to
  5198. detect chapter transitions or commercials. Output lines consist of
  5199. the frame number of the detected frame, the percentage of blackness,
  5200. the position in the file if known or -1 and the timestamp in seconds.
  5201. In order to display the output lines, you need to set the loglevel at
  5202. least to the AV_LOG_INFO value.
  5203. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5204. The value represents the percentage of pixels in the picture that
  5205. are below the threshold value.
  5206. It accepts the following parameters:
  5207. @table @option
  5208. @item amount
  5209. The percentage of the pixels that have to be below the threshold; it defaults to
  5210. @code{98}.
  5211. @item threshold, thresh
  5212. The threshold below which a pixel value is considered black; it defaults to
  5213. @code{32}.
  5214. @end table
  5215. @anchor{blend}
  5216. @section blend
  5217. Blend two video frames into each other.
  5218. The @code{blend} filter takes two input streams and outputs one
  5219. stream, the first input is the "top" layer and second input is
  5220. "bottom" layer. By default, the output terminates when the longest input terminates.
  5221. The @code{tblend} (time blend) filter takes two consecutive frames
  5222. from one single stream, and outputs the result obtained by blending
  5223. the new frame on top of the old frame.
  5224. A description of the accepted options follows.
  5225. @table @option
  5226. @item c0_mode
  5227. @item c1_mode
  5228. @item c2_mode
  5229. @item c3_mode
  5230. @item all_mode
  5231. Set blend mode for specific pixel component or all pixel components in case
  5232. of @var{all_mode}. Default value is @code{normal}.
  5233. Available values for component modes are:
  5234. @table @samp
  5235. @item addition
  5236. @item grainmerge
  5237. @item and
  5238. @item average
  5239. @item burn
  5240. @item darken
  5241. @item difference
  5242. @item grainextract
  5243. @item divide
  5244. @item dodge
  5245. @item freeze
  5246. @item exclusion
  5247. @item extremity
  5248. @item glow
  5249. @item hardlight
  5250. @item hardmix
  5251. @item heat
  5252. @item lighten
  5253. @item linearlight
  5254. @item multiply
  5255. @item multiply128
  5256. @item negation
  5257. @item normal
  5258. @item or
  5259. @item overlay
  5260. @item phoenix
  5261. @item pinlight
  5262. @item reflect
  5263. @item screen
  5264. @item softlight
  5265. @item subtract
  5266. @item vividlight
  5267. @item xor
  5268. @end table
  5269. @item c0_opacity
  5270. @item c1_opacity
  5271. @item c2_opacity
  5272. @item c3_opacity
  5273. @item all_opacity
  5274. Set blend opacity for specific pixel component or all pixel components in case
  5275. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5276. @item c0_expr
  5277. @item c1_expr
  5278. @item c2_expr
  5279. @item c3_expr
  5280. @item all_expr
  5281. Set blend expression for specific pixel component or all pixel components in case
  5282. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5283. The expressions can use the following variables:
  5284. @table @option
  5285. @item N
  5286. The sequential number of the filtered frame, starting from @code{0}.
  5287. @item X
  5288. @item Y
  5289. the coordinates of the current sample
  5290. @item W
  5291. @item H
  5292. the width and height of currently filtered plane
  5293. @item SW
  5294. @item SH
  5295. Width and height scale for the plane being filtered. It is the
  5296. ratio between the dimensions of the current plane to the luma plane,
  5297. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5298. the luma plane and @code{0.5,0.5} for the chroma planes.
  5299. @item T
  5300. Time of the current frame, expressed in seconds.
  5301. @item TOP, A
  5302. Value of pixel component at current location for first video frame (top layer).
  5303. @item BOTTOM, B
  5304. Value of pixel component at current location for second video frame (bottom layer).
  5305. @end table
  5306. @end table
  5307. The @code{blend} filter also supports the @ref{framesync} options.
  5308. @subsection Examples
  5309. @itemize
  5310. @item
  5311. Apply transition from bottom layer to top layer in first 10 seconds:
  5312. @example
  5313. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5314. @end example
  5315. @item
  5316. Apply linear horizontal transition from top layer to bottom layer:
  5317. @example
  5318. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5319. @end example
  5320. @item
  5321. Apply 1x1 checkerboard effect:
  5322. @example
  5323. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5324. @end example
  5325. @item
  5326. Apply uncover left effect:
  5327. @example
  5328. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5329. @end example
  5330. @item
  5331. Apply uncover down effect:
  5332. @example
  5333. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5334. @end example
  5335. @item
  5336. Apply uncover up-left effect:
  5337. @example
  5338. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5339. @end example
  5340. @item
  5341. Split diagonally video and shows top and bottom layer on each side:
  5342. @example
  5343. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5344. @end example
  5345. @item
  5346. Display differences between the current and the previous frame:
  5347. @example
  5348. tblend=all_mode=grainextract
  5349. @end example
  5350. @end itemize
  5351. @section bm3d
  5352. Denoise frames using Block-Matching 3D algorithm.
  5353. The filter accepts the following options.
  5354. @table @option
  5355. @item sigma
  5356. Set denoising strength. Default value is 1.
  5357. Allowed range is from 0 to 999.9.
  5358. The denoising algorithm is very sensitive to sigma, so adjust it
  5359. according to the source.
  5360. @item block
  5361. Set local patch size. This sets dimensions in 2D.
  5362. @item bstep
  5363. Set sliding step for processing blocks. Default value is 4.
  5364. Allowed range is from 1 to 64.
  5365. Smaller values allows processing more reference blocks and is slower.
  5366. @item group
  5367. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5368. When set to 1, no block matching is done. Larger values allows more blocks
  5369. in single group.
  5370. Allowed range is from 1 to 256.
  5371. @item range
  5372. Set radius for search block matching. Default is 9.
  5373. Allowed range is from 1 to INT32_MAX.
  5374. @item mstep
  5375. Set step between two search locations for block matching. Default is 1.
  5376. Allowed range is from 1 to 64. Smaller is slower.
  5377. @item thmse
  5378. Set threshold of mean square error for block matching. Valid range is 0 to
  5379. INT32_MAX.
  5380. @item hdthr
  5381. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5382. Larger values results in stronger hard-thresholding filtering in frequency
  5383. domain.
  5384. @item estim
  5385. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5386. Default is @code{basic}.
  5387. @item ref
  5388. If enabled, filter will use 2nd stream for block matching.
  5389. Default is disabled for @code{basic} value of @var{estim} option,
  5390. and always enabled if value of @var{estim} is @code{final}.
  5391. @item planes
  5392. Set planes to filter. Default is all available except alpha.
  5393. @end table
  5394. @subsection Examples
  5395. @itemize
  5396. @item
  5397. Basic filtering with bm3d:
  5398. @example
  5399. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5400. @end example
  5401. @item
  5402. Same as above, but filtering only luma:
  5403. @example
  5404. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5405. @end example
  5406. @item
  5407. Same as above, but with both estimation modes:
  5408. @example
  5409. 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
  5410. @end example
  5411. @item
  5412. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5413. @example
  5414. 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
  5415. @end example
  5416. @end itemize
  5417. @section boxblur
  5418. Apply a boxblur algorithm to the input video.
  5419. It accepts the following parameters:
  5420. @table @option
  5421. @item luma_radius, lr
  5422. @item luma_power, lp
  5423. @item chroma_radius, cr
  5424. @item chroma_power, cp
  5425. @item alpha_radius, ar
  5426. @item alpha_power, ap
  5427. @end table
  5428. A description of the accepted options follows.
  5429. @table @option
  5430. @item luma_radius, lr
  5431. @item chroma_radius, cr
  5432. @item alpha_radius, ar
  5433. Set an expression for the box radius in pixels used for blurring the
  5434. corresponding input plane.
  5435. The radius value must be a non-negative number, and must not be
  5436. greater than the value of the expression @code{min(w,h)/2} for the
  5437. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5438. planes.
  5439. Default value for @option{luma_radius} is "2". If not specified,
  5440. @option{chroma_radius} and @option{alpha_radius} default to the
  5441. corresponding value set for @option{luma_radius}.
  5442. The expressions can contain the following constants:
  5443. @table @option
  5444. @item w
  5445. @item h
  5446. The input width and height in pixels.
  5447. @item cw
  5448. @item ch
  5449. The input chroma image width and height in pixels.
  5450. @item hsub
  5451. @item vsub
  5452. The horizontal and vertical chroma subsample values. For example, for the
  5453. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5454. @end table
  5455. @item luma_power, lp
  5456. @item chroma_power, cp
  5457. @item alpha_power, ap
  5458. Specify how many times the boxblur filter is applied to the
  5459. corresponding plane.
  5460. Default value for @option{luma_power} is 2. If not specified,
  5461. @option{chroma_power} and @option{alpha_power} default to the
  5462. corresponding value set for @option{luma_power}.
  5463. A value of 0 will disable the effect.
  5464. @end table
  5465. @subsection Examples
  5466. @itemize
  5467. @item
  5468. Apply a boxblur filter with the luma, chroma, and alpha radii
  5469. set to 2:
  5470. @example
  5471. boxblur=luma_radius=2:luma_power=1
  5472. boxblur=2:1
  5473. @end example
  5474. @item
  5475. Set the luma radius to 2, and alpha and chroma radius to 0:
  5476. @example
  5477. boxblur=2:1:cr=0:ar=0
  5478. @end example
  5479. @item
  5480. Set the luma and chroma radii to a fraction of the video dimension:
  5481. @example
  5482. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5483. @end example
  5484. @end itemize
  5485. @section bwdif
  5486. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5487. Deinterlacing Filter").
  5488. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5489. interpolation algorithms.
  5490. It accepts the following parameters:
  5491. @table @option
  5492. @item mode
  5493. The interlacing mode to adopt. It accepts one of the following values:
  5494. @table @option
  5495. @item 0, send_frame
  5496. Output one frame for each frame.
  5497. @item 1, send_field
  5498. Output one frame for each field.
  5499. @end table
  5500. The default value is @code{send_field}.
  5501. @item parity
  5502. The picture field parity assumed for the input interlaced video. It accepts one
  5503. of the following values:
  5504. @table @option
  5505. @item 0, tff
  5506. Assume the top field is first.
  5507. @item 1, bff
  5508. Assume the bottom field is first.
  5509. @item -1, auto
  5510. Enable automatic detection of field parity.
  5511. @end table
  5512. The default value is @code{auto}.
  5513. If the interlacing is unknown or the decoder does not export this information,
  5514. top field first will be assumed.
  5515. @item deint
  5516. Specify which frames to deinterlace. Accepts one of the following
  5517. values:
  5518. @table @option
  5519. @item 0, all
  5520. Deinterlace all frames.
  5521. @item 1, interlaced
  5522. Only deinterlace frames marked as interlaced.
  5523. @end table
  5524. The default value is @code{all}.
  5525. @end table
  5526. @section cas
  5527. Apply Contrast Adaptive Sharpen filter to video stream.
  5528. The filter accepts the following options:
  5529. @table @option
  5530. @item strength
  5531. Set the sharpening strength. Default value is 0.
  5532. @item planes
  5533. Set planes to filter. Default value is to filter all
  5534. planes except alpha plane.
  5535. @end table
  5536. @section chromahold
  5537. Remove all color information for all colors except for certain one.
  5538. The filter accepts the following options:
  5539. @table @option
  5540. @item color
  5541. The color which will not be replaced with neutral chroma.
  5542. @item similarity
  5543. Similarity percentage with the above color.
  5544. 0.01 matches only the exact key color, while 1.0 matches everything.
  5545. @item blend
  5546. Blend percentage.
  5547. 0.0 makes pixels either fully gray, or not gray at all.
  5548. Higher values result in more preserved color.
  5549. @item yuv
  5550. Signals that the color passed is already in YUV instead of RGB.
  5551. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5552. This can be used to pass exact YUV values as hexadecimal numbers.
  5553. @end table
  5554. @subsection Commands
  5555. This filter supports same @ref{commands} as options.
  5556. The command accepts the same syntax of the corresponding option.
  5557. If the specified expression is not valid, it is kept at its current
  5558. value.
  5559. @section chromakey
  5560. YUV colorspace color/chroma keying.
  5561. The filter accepts the following options:
  5562. @table @option
  5563. @item color
  5564. The color which will be replaced with transparency.
  5565. @item similarity
  5566. Similarity percentage with the key color.
  5567. 0.01 matches only the exact key color, while 1.0 matches everything.
  5568. @item blend
  5569. Blend percentage.
  5570. 0.0 makes pixels either fully transparent, or not transparent at all.
  5571. Higher values result in semi-transparent pixels, with a higher transparency
  5572. the more similar the pixels color is to the key color.
  5573. @item yuv
  5574. Signals that the color passed is already in YUV instead of RGB.
  5575. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5576. This can be used to pass exact YUV values as hexadecimal numbers.
  5577. @end table
  5578. @subsection Commands
  5579. This filter supports same @ref{commands} as options.
  5580. The command accepts the same syntax of the corresponding option.
  5581. If the specified expression is not valid, it is kept at its current
  5582. value.
  5583. @subsection Examples
  5584. @itemize
  5585. @item
  5586. Make every green pixel in the input image transparent:
  5587. @example
  5588. ffmpeg -i input.png -vf chromakey=green out.png
  5589. @end example
  5590. @item
  5591. Overlay a greenscreen-video on top of a static black background.
  5592. @example
  5593. 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
  5594. @end example
  5595. @end itemize
  5596. @section chromanr
  5597. Reduce chrominance noise.
  5598. The filter accepts the following options:
  5599. @table @option
  5600. @item thres
  5601. Set threshold for averaging chrominance values.
  5602. Sum of absolute difference of U and V pixel components or current
  5603. pixel and neighbour pixels lower than this threshold will be used in
  5604. averaging. Luma component is left unchanged and is copied to output.
  5605. Default value is 30. Allowed range is from 1 to 200.
  5606. @item sizew
  5607. Set horizontal radius of rectangle used for averaging.
  5608. Allowed range is from 1 to 100. Default value is 5.
  5609. @item sizeh
  5610. Set vertical radius of rectangle used for averaging.
  5611. Allowed range is from 1 to 100. Default value is 5.
  5612. @item stepw
  5613. Set horizontal step when averaging. Default value is 1.
  5614. Allowed range is from 1 to 50.
  5615. Mostly useful to speed-up filtering.
  5616. @item steph
  5617. Set vertical step when averaging. Default value is 1.
  5618. Allowed range is from 1 to 50.
  5619. Mostly useful to speed-up filtering.
  5620. @end table
  5621. @subsection Commands
  5622. This filter supports same @ref{commands} as options.
  5623. The command accepts the same syntax of the corresponding option.
  5624. @section chromashift
  5625. Shift chroma pixels horizontally and/or vertically.
  5626. The filter accepts the following options:
  5627. @table @option
  5628. @item cbh
  5629. Set amount to shift chroma-blue horizontally.
  5630. @item cbv
  5631. Set amount to shift chroma-blue vertically.
  5632. @item crh
  5633. Set amount to shift chroma-red horizontally.
  5634. @item crv
  5635. Set amount to shift chroma-red vertically.
  5636. @item edge
  5637. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5638. @end table
  5639. @subsection Commands
  5640. This filter supports the all above options as @ref{commands}.
  5641. @section ciescope
  5642. Display CIE color diagram with pixels overlaid onto it.
  5643. The filter accepts the following options:
  5644. @table @option
  5645. @item system
  5646. Set color system.
  5647. @table @samp
  5648. @item ntsc, 470m
  5649. @item ebu, 470bg
  5650. @item smpte
  5651. @item 240m
  5652. @item apple
  5653. @item widergb
  5654. @item cie1931
  5655. @item rec709, hdtv
  5656. @item uhdtv, rec2020
  5657. @item dcip3
  5658. @end table
  5659. @item cie
  5660. Set CIE system.
  5661. @table @samp
  5662. @item xyy
  5663. @item ucs
  5664. @item luv
  5665. @end table
  5666. @item gamuts
  5667. Set what gamuts to draw.
  5668. See @code{system} option for available values.
  5669. @item size, s
  5670. Set ciescope size, by default set to 512.
  5671. @item intensity, i
  5672. Set intensity used to map input pixel values to CIE diagram.
  5673. @item contrast
  5674. Set contrast used to draw tongue colors that are out of active color system gamut.
  5675. @item corrgamma
  5676. Correct gamma displayed on scope, by default enabled.
  5677. @item showwhite
  5678. Show white point on CIE diagram, by default disabled.
  5679. @item gamma
  5680. Set input gamma. Used only with XYZ input color space.
  5681. @end table
  5682. @section codecview
  5683. Visualize information exported by some codecs.
  5684. Some codecs can export information through frames using side-data or other
  5685. means. For example, some MPEG based codecs export motion vectors through the
  5686. @var{export_mvs} flag in the codec @option{flags2} option.
  5687. The filter accepts the following option:
  5688. @table @option
  5689. @item mv
  5690. Set motion vectors to visualize.
  5691. Available flags for @var{mv} are:
  5692. @table @samp
  5693. @item pf
  5694. forward predicted MVs of P-frames
  5695. @item bf
  5696. forward predicted MVs of B-frames
  5697. @item bb
  5698. backward predicted MVs of B-frames
  5699. @end table
  5700. @item qp
  5701. Display quantization parameters using the chroma planes.
  5702. @item mv_type, mvt
  5703. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5704. Available flags for @var{mv_type} are:
  5705. @table @samp
  5706. @item fp
  5707. forward predicted MVs
  5708. @item bp
  5709. backward predicted MVs
  5710. @end table
  5711. @item frame_type, ft
  5712. Set frame type to visualize motion vectors of.
  5713. Available flags for @var{frame_type} are:
  5714. @table @samp
  5715. @item if
  5716. intra-coded frames (I-frames)
  5717. @item pf
  5718. predicted frames (P-frames)
  5719. @item bf
  5720. bi-directionally predicted frames (B-frames)
  5721. @end table
  5722. @end table
  5723. @subsection Examples
  5724. @itemize
  5725. @item
  5726. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5727. @example
  5728. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5729. @end example
  5730. @item
  5731. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5732. @example
  5733. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5734. @end example
  5735. @end itemize
  5736. @section colorbalance
  5737. Modify intensity of primary colors (red, green and blue) of input frames.
  5738. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5739. regions for the red-cyan, green-magenta or blue-yellow balance.
  5740. A positive adjustment value shifts the balance towards the primary color, a negative
  5741. value towards the complementary color.
  5742. The filter accepts the following options:
  5743. @table @option
  5744. @item rs
  5745. @item gs
  5746. @item bs
  5747. Adjust red, green and blue shadows (darkest pixels).
  5748. @item rm
  5749. @item gm
  5750. @item bm
  5751. Adjust red, green and blue midtones (medium pixels).
  5752. @item rh
  5753. @item gh
  5754. @item bh
  5755. Adjust red, green and blue highlights (brightest pixels).
  5756. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5757. @item pl
  5758. Preserve lightness when changing color balance. Default is disabled.
  5759. @end table
  5760. @subsection Examples
  5761. @itemize
  5762. @item
  5763. Add red color cast to shadows:
  5764. @example
  5765. colorbalance=rs=.3
  5766. @end example
  5767. @end itemize
  5768. @subsection Commands
  5769. This filter supports the all above options as @ref{commands}.
  5770. @section colorchannelmixer
  5771. Adjust video input frames by re-mixing color channels.
  5772. This filter modifies a color channel by adding the values associated to
  5773. the other channels of the same pixels. For example if the value to
  5774. modify is red, the output value will be:
  5775. @example
  5776. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5777. @end example
  5778. The filter accepts the following options:
  5779. @table @option
  5780. @item rr
  5781. @item rg
  5782. @item rb
  5783. @item ra
  5784. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5785. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5786. @item gr
  5787. @item gg
  5788. @item gb
  5789. @item ga
  5790. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5791. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5792. @item br
  5793. @item bg
  5794. @item bb
  5795. @item ba
  5796. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5797. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5798. @item ar
  5799. @item ag
  5800. @item ab
  5801. @item aa
  5802. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5803. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5804. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5805. @end table
  5806. @subsection Examples
  5807. @itemize
  5808. @item
  5809. Convert source to grayscale:
  5810. @example
  5811. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5812. @end example
  5813. @item
  5814. Simulate sepia tones:
  5815. @example
  5816. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5817. @end example
  5818. @end itemize
  5819. @subsection Commands
  5820. This filter supports the all above options as @ref{commands}.
  5821. @section colorkey
  5822. RGB colorspace color keying.
  5823. The filter accepts the following options:
  5824. @table @option
  5825. @item color
  5826. The color which will be replaced with transparency.
  5827. @item similarity
  5828. Similarity percentage with the key color.
  5829. 0.01 matches only the exact key color, while 1.0 matches everything.
  5830. @item blend
  5831. Blend percentage.
  5832. 0.0 makes pixels either fully transparent, or not transparent at all.
  5833. Higher values result in semi-transparent pixels, with a higher transparency
  5834. the more similar the pixels color is to the key color.
  5835. @end table
  5836. @subsection Examples
  5837. @itemize
  5838. @item
  5839. Make every green pixel in the input image transparent:
  5840. @example
  5841. ffmpeg -i input.png -vf colorkey=green out.png
  5842. @end example
  5843. @item
  5844. Overlay a greenscreen-video on top of a static background image.
  5845. @example
  5846. 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
  5847. @end example
  5848. @end itemize
  5849. @subsection Commands
  5850. This filter supports same @ref{commands} as options.
  5851. The command accepts the same syntax of the corresponding option.
  5852. If the specified expression is not valid, it is kept at its current
  5853. value.
  5854. @section colorhold
  5855. Remove all color information for all RGB colors except for certain one.
  5856. The filter accepts the following options:
  5857. @table @option
  5858. @item color
  5859. The color which will not be replaced with neutral gray.
  5860. @item similarity
  5861. Similarity percentage with the above color.
  5862. 0.01 matches only the exact key color, while 1.0 matches everything.
  5863. @item blend
  5864. Blend percentage. 0.0 makes pixels fully gray.
  5865. Higher values result in more preserved color.
  5866. @end table
  5867. @subsection Commands
  5868. This filter supports same @ref{commands} as options.
  5869. The command accepts the same syntax of the corresponding option.
  5870. If the specified expression is not valid, it is kept at its current
  5871. value.
  5872. @section colorlevels
  5873. Adjust video input frames using levels.
  5874. The filter accepts the following options:
  5875. @table @option
  5876. @item rimin
  5877. @item gimin
  5878. @item bimin
  5879. @item aimin
  5880. Adjust red, green, blue and alpha input black point.
  5881. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5882. @item rimax
  5883. @item gimax
  5884. @item bimax
  5885. @item aimax
  5886. Adjust red, green, blue and alpha input white point.
  5887. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5888. Input levels are used to lighten highlights (bright tones), darken shadows
  5889. (dark tones), change the balance of bright and dark tones.
  5890. @item romin
  5891. @item gomin
  5892. @item bomin
  5893. @item aomin
  5894. Adjust red, green, blue and alpha output black point.
  5895. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5896. @item romax
  5897. @item gomax
  5898. @item bomax
  5899. @item aomax
  5900. Adjust red, green, blue and alpha output white point.
  5901. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5902. Output levels allows manual selection of a constrained output level range.
  5903. @end table
  5904. @subsection Examples
  5905. @itemize
  5906. @item
  5907. Make video output darker:
  5908. @example
  5909. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5910. @end example
  5911. @item
  5912. Increase contrast:
  5913. @example
  5914. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5915. @end example
  5916. @item
  5917. Make video output lighter:
  5918. @example
  5919. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5920. @end example
  5921. @item
  5922. Increase brightness:
  5923. @example
  5924. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5925. @end example
  5926. @end itemize
  5927. @subsection Commands
  5928. This filter supports the all above options as @ref{commands}.
  5929. @section colormatrix
  5930. Convert color matrix.
  5931. The filter accepts the following options:
  5932. @table @option
  5933. @item src
  5934. @item dst
  5935. Specify the source and destination color matrix. Both values must be
  5936. specified.
  5937. The accepted values are:
  5938. @table @samp
  5939. @item bt709
  5940. BT.709
  5941. @item fcc
  5942. FCC
  5943. @item bt601
  5944. BT.601
  5945. @item bt470
  5946. BT.470
  5947. @item bt470bg
  5948. BT.470BG
  5949. @item smpte170m
  5950. SMPTE-170M
  5951. @item smpte240m
  5952. SMPTE-240M
  5953. @item bt2020
  5954. BT.2020
  5955. @end table
  5956. @end table
  5957. For example to convert from BT.601 to SMPTE-240M, use the command:
  5958. @example
  5959. colormatrix=bt601:smpte240m
  5960. @end example
  5961. @section colorspace
  5962. Convert colorspace, transfer characteristics or color primaries.
  5963. Input video needs to have an even size.
  5964. The filter accepts the following options:
  5965. @table @option
  5966. @anchor{all}
  5967. @item all
  5968. Specify all color properties at once.
  5969. The accepted values are:
  5970. @table @samp
  5971. @item bt470m
  5972. BT.470M
  5973. @item bt470bg
  5974. BT.470BG
  5975. @item bt601-6-525
  5976. BT.601-6 525
  5977. @item bt601-6-625
  5978. BT.601-6 625
  5979. @item bt709
  5980. BT.709
  5981. @item smpte170m
  5982. SMPTE-170M
  5983. @item smpte240m
  5984. SMPTE-240M
  5985. @item bt2020
  5986. BT.2020
  5987. @end table
  5988. @anchor{space}
  5989. @item space
  5990. Specify output colorspace.
  5991. The accepted values are:
  5992. @table @samp
  5993. @item bt709
  5994. BT.709
  5995. @item fcc
  5996. FCC
  5997. @item bt470bg
  5998. BT.470BG or BT.601-6 625
  5999. @item smpte170m
  6000. SMPTE-170M or BT.601-6 525
  6001. @item smpte240m
  6002. SMPTE-240M
  6003. @item ycgco
  6004. YCgCo
  6005. @item bt2020ncl
  6006. BT.2020 with non-constant luminance
  6007. @end table
  6008. @anchor{trc}
  6009. @item trc
  6010. Specify output transfer characteristics.
  6011. The accepted values are:
  6012. @table @samp
  6013. @item bt709
  6014. BT.709
  6015. @item bt470m
  6016. BT.470M
  6017. @item bt470bg
  6018. BT.470BG
  6019. @item gamma22
  6020. Constant gamma of 2.2
  6021. @item gamma28
  6022. Constant gamma of 2.8
  6023. @item smpte170m
  6024. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  6025. @item smpte240m
  6026. SMPTE-240M
  6027. @item srgb
  6028. SRGB
  6029. @item iec61966-2-1
  6030. iec61966-2-1
  6031. @item iec61966-2-4
  6032. iec61966-2-4
  6033. @item xvycc
  6034. xvycc
  6035. @item bt2020-10
  6036. BT.2020 for 10-bits content
  6037. @item bt2020-12
  6038. BT.2020 for 12-bits content
  6039. @end table
  6040. @anchor{primaries}
  6041. @item primaries
  6042. Specify output color primaries.
  6043. The accepted values are:
  6044. @table @samp
  6045. @item bt709
  6046. BT.709
  6047. @item bt470m
  6048. BT.470M
  6049. @item bt470bg
  6050. BT.470BG or BT.601-6 625
  6051. @item smpte170m
  6052. SMPTE-170M or BT.601-6 525
  6053. @item smpte240m
  6054. SMPTE-240M
  6055. @item film
  6056. film
  6057. @item smpte431
  6058. SMPTE-431
  6059. @item smpte432
  6060. SMPTE-432
  6061. @item bt2020
  6062. BT.2020
  6063. @item jedec-p22
  6064. JEDEC P22 phosphors
  6065. @end table
  6066. @anchor{range}
  6067. @item range
  6068. Specify output color range.
  6069. The accepted values are:
  6070. @table @samp
  6071. @item tv
  6072. TV (restricted) range
  6073. @item mpeg
  6074. MPEG (restricted) range
  6075. @item pc
  6076. PC (full) range
  6077. @item jpeg
  6078. JPEG (full) range
  6079. @end table
  6080. @item format
  6081. Specify output color format.
  6082. The accepted values are:
  6083. @table @samp
  6084. @item yuv420p
  6085. YUV 4:2:0 planar 8-bits
  6086. @item yuv420p10
  6087. YUV 4:2:0 planar 10-bits
  6088. @item yuv420p12
  6089. YUV 4:2:0 planar 12-bits
  6090. @item yuv422p
  6091. YUV 4:2:2 planar 8-bits
  6092. @item yuv422p10
  6093. YUV 4:2:2 planar 10-bits
  6094. @item yuv422p12
  6095. YUV 4:2:2 planar 12-bits
  6096. @item yuv444p
  6097. YUV 4:4:4 planar 8-bits
  6098. @item yuv444p10
  6099. YUV 4:4:4 planar 10-bits
  6100. @item yuv444p12
  6101. YUV 4:4:4 planar 12-bits
  6102. @end table
  6103. @item fast
  6104. Do a fast conversion, which skips gamma/primary correction. This will take
  6105. significantly less CPU, but will be mathematically incorrect. To get output
  6106. compatible with that produced by the colormatrix filter, use fast=1.
  6107. @item dither
  6108. Specify dithering mode.
  6109. The accepted values are:
  6110. @table @samp
  6111. @item none
  6112. No dithering
  6113. @item fsb
  6114. Floyd-Steinberg dithering
  6115. @end table
  6116. @item wpadapt
  6117. Whitepoint adaptation mode.
  6118. The accepted values are:
  6119. @table @samp
  6120. @item bradford
  6121. Bradford whitepoint adaptation
  6122. @item vonkries
  6123. von Kries whitepoint adaptation
  6124. @item identity
  6125. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  6126. @end table
  6127. @item iall
  6128. Override all input properties at once. Same accepted values as @ref{all}.
  6129. @item ispace
  6130. Override input colorspace. Same accepted values as @ref{space}.
  6131. @item iprimaries
  6132. Override input color primaries. Same accepted values as @ref{primaries}.
  6133. @item itrc
  6134. Override input transfer characteristics. Same accepted values as @ref{trc}.
  6135. @item irange
  6136. Override input color range. Same accepted values as @ref{range}.
  6137. @end table
  6138. The filter converts the transfer characteristics, color space and color
  6139. primaries to the specified user values. The output value, if not specified,
  6140. is set to a default value based on the "all" property. If that property is
  6141. also not specified, the filter will log an error. The output color range and
  6142. format default to the same value as the input color range and format. The
  6143. input transfer characteristics, color space, color primaries and color range
  6144. should be set on the input data. If any of these are missing, the filter will
  6145. log an error and no conversion will take place.
  6146. For example to convert the input to SMPTE-240M, use the command:
  6147. @example
  6148. colorspace=smpte240m
  6149. @end example
  6150. @section convolution
  6151. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  6152. The filter accepts the following options:
  6153. @table @option
  6154. @item 0m
  6155. @item 1m
  6156. @item 2m
  6157. @item 3m
  6158. Set matrix for each plane.
  6159. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  6160. and from 1 to 49 odd number of signed integers in @var{row} mode.
  6161. @item 0rdiv
  6162. @item 1rdiv
  6163. @item 2rdiv
  6164. @item 3rdiv
  6165. Set multiplier for calculated value for each plane.
  6166. If unset or 0, it will be sum of all matrix elements.
  6167. @item 0bias
  6168. @item 1bias
  6169. @item 2bias
  6170. @item 3bias
  6171. Set bias for each plane. This value is added to the result of the multiplication.
  6172. Useful for making the overall image brighter or darker. Default is 0.0.
  6173. @item 0mode
  6174. @item 1mode
  6175. @item 2mode
  6176. @item 3mode
  6177. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  6178. Default is @var{square}.
  6179. @end table
  6180. @subsection Examples
  6181. @itemize
  6182. @item
  6183. Apply sharpen:
  6184. @example
  6185. 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"
  6186. @end example
  6187. @item
  6188. Apply blur:
  6189. @example
  6190. 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"
  6191. @end example
  6192. @item
  6193. Apply edge enhance:
  6194. @example
  6195. 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"
  6196. @end example
  6197. @item
  6198. Apply edge detect:
  6199. @example
  6200. 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"
  6201. @end example
  6202. @item
  6203. Apply laplacian edge detector which includes diagonals:
  6204. @example
  6205. 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"
  6206. @end example
  6207. @item
  6208. Apply emboss:
  6209. @example
  6210. 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"
  6211. @end example
  6212. @end itemize
  6213. @section convolve
  6214. Apply 2D convolution of video stream in frequency domain using second stream
  6215. as impulse.
  6216. The filter accepts the following options:
  6217. @table @option
  6218. @item planes
  6219. Set which planes to process.
  6220. @item impulse
  6221. Set which impulse video frames will be processed, can be @var{first}
  6222. or @var{all}. Default is @var{all}.
  6223. @end table
  6224. The @code{convolve} filter also supports the @ref{framesync} options.
  6225. @section copy
  6226. Copy the input video source unchanged to the output. This is mainly useful for
  6227. testing purposes.
  6228. @anchor{coreimage}
  6229. @section coreimage
  6230. Video filtering on GPU using Apple's CoreImage API on OSX.
  6231. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6232. processed by video hardware. However, software-based OpenGL implementations
  6233. exist which means there is no guarantee for hardware processing. It depends on
  6234. the respective OSX.
  6235. There are many filters and image generators provided by Apple that come with a
  6236. large variety of options. The filter has to be referenced by its name along
  6237. with its options.
  6238. The coreimage filter accepts the following options:
  6239. @table @option
  6240. @item list_filters
  6241. List all available filters and generators along with all their respective
  6242. options as well as possible minimum and maximum values along with the default
  6243. values.
  6244. @example
  6245. list_filters=true
  6246. @end example
  6247. @item filter
  6248. Specify all filters by their respective name and options.
  6249. Use @var{list_filters} to determine all valid filter names and options.
  6250. Numerical options are specified by a float value and are automatically clamped
  6251. to their respective value range. Vector and color options have to be specified
  6252. by a list of space separated float values. Character escaping has to be done.
  6253. A special option name @code{default} is available to use default options for a
  6254. filter.
  6255. It is required to specify either @code{default} or at least one of the filter options.
  6256. All omitted options are used with their default values.
  6257. The syntax of the filter string is as follows:
  6258. @example
  6259. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6260. @end example
  6261. @item output_rect
  6262. Specify a rectangle where the output of the filter chain is copied into the
  6263. input image. It is given by a list of space separated float values:
  6264. @example
  6265. output_rect=x\ y\ width\ height
  6266. @end example
  6267. If not given, the output rectangle equals the dimensions of the input image.
  6268. The output rectangle is automatically cropped at the borders of the input
  6269. image. Negative values are valid for each component.
  6270. @example
  6271. output_rect=25\ 25\ 100\ 100
  6272. @end example
  6273. @end table
  6274. Several filters can be chained for successive processing without GPU-HOST
  6275. transfers allowing for fast processing of complex filter chains.
  6276. Currently, only filters with zero (generators) or exactly one (filters) input
  6277. image and one output image are supported. Also, transition filters are not yet
  6278. usable as intended.
  6279. Some filters generate output images with additional padding depending on the
  6280. respective filter kernel. The padding is automatically removed to ensure the
  6281. filter output has the same size as the input image.
  6282. For image generators, the size of the output image is determined by the
  6283. previous output image of the filter chain or the input image of the whole
  6284. filterchain, respectively. The generators do not use the pixel information of
  6285. this image to generate their output. However, the generated output is
  6286. blended onto this image, resulting in partial or complete coverage of the
  6287. output image.
  6288. The @ref{coreimagesrc} video source can be used for generating input images
  6289. which are directly fed into the filter chain. By using it, providing input
  6290. images by another video source or an input video is not required.
  6291. @subsection Examples
  6292. @itemize
  6293. @item
  6294. List all filters available:
  6295. @example
  6296. coreimage=list_filters=true
  6297. @end example
  6298. @item
  6299. Use the CIBoxBlur filter with default options to blur an image:
  6300. @example
  6301. coreimage=filter=CIBoxBlur@@default
  6302. @end example
  6303. @item
  6304. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6305. its center at 100x100 and a radius of 50 pixels:
  6306. @example
  6307. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6308. @end example
  6309. @item
  6310. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6311. given as complete and escaped command-line for Apple's standard bash shell:
  6312. @example
  6313. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6314. @end example
  6315. @end itemize
  6316. @section cover_rect
  6317. Cover a rectangular object
  6318. It accepts the following options:
  6319. @table @option
  6320. @item cover
  6321. Filepath of the optional cover image, needs to be in yuv420.
  6322. @item mode
  6323. Set covering mode.
  6324. It accepts the following values:
  6325. @table @samp
  6326. @item cover
  6327. cover it by the supplied image
  6328. @item blur
  6329. cover it by interpolating the surrounding pixels
  6330. @end table
  6331. Default value is @var{blur}.
  6332. @end table
  6333. @subsection Examples
  6334. @itemize
  6335. @item
  6336. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6337. @example
  6338. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6339. @end example
  6340. @end itemize
  6341. @section crop
  6342. Crop the input video to given dimensions.
  6343. It accepts the following parameters:
  6344. @table @option
  6345. @item w, out_w
  6346. The width of the output video. It defaults to @code{iw}.
  6347. This expression is evaluated only once during the filter
  6348. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6349. @item h, out_h
  6350. The height of the output video. It defaults to @code{ih}.
  6351. This expression is evaluated only once during the filter
  6352. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6353. @item x
  6354. The horizontal position, in the input video, of the left edge of the output
  6355. video. It defaults to @code{(in_w-out_w)/2}.
  6356. This expression is evaluated per-frame.
  6357. @item y
  6358. The vertical position, in the input video, of the top edge of the output video.
  6359. It defaults to @code{(in_h-out_h)/2}.
  6360. This expression is evaluated per-frame.
  6361. @item keep_aspect
  6362. If set to 1 will force the output display aspect ratio
  6363. to be the same of the input, by changing the output sample aspect
  6364. ratio. It defaults to 0.
  6365. @item exact
  6366. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6367. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6368. It defaults to 0.
  6369. @end table
  6370. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6371. expressions containing the following constants:
  6372. @table @option
  6373. @item x
  6374. @item y
  6375. The computed values for @var{x} and @var{y}. They are evaluated for
  6376. each new frame.
  6377. @item in_w
  6378. @item in_h
  6379. The input width and height.
  6380. @item iw
  6381. @item ih
  6382. These are the same as @var{in_w} and @var{in_h}.
  6383. @item out_w
  6384. @item out_h
  6385. The output (cropped) width and height.
  6386. @item ow
  6387. @item oh
  6388. These are the same as @var{out_w} and @var{out_h}.
  6389. @item a
  6390. same as @var{iw} / @var{ih}
  6391. @item sar
  6392. input sample aspect ratio
  6393. @item dar
  6394. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6395. @item hsub
  6396. @item vsub
  6397. horizontal and vertical chroma subsample values. For example for the
  6398. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6399. @item n
  6400. The number of the input frame, starting from 0.
  6401. @item pos
  6402. the position in the file of the input frame, NAN if unknown
  6403. @item t
  6404. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6405. @end table
  6406. The expression for @var{out_w} may depend on the value of @var{out_h},
  6407. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6408. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6409. evaluated after @var{out_w} and @var{out_h}.
  6410. The @var{x} and @var{y} parameters specify the expressions for the
  6411. position of the top-left corner of the output (non-cropped) area. They
  6412. are evaluated for each frame. If the evaluated value is not valid, it
  6413. is approximated to the nearest valid value.
  6414. The expression for @var{x} may depend on @var{y}, and the expression
  6415. for @var{y} may depend on @var{x}.
  6416. @subsection Examples
  6417. @itemize
  6418. @item
  6419. Crop area with size 100x100 at position (12,34).
  6420. @example
  6421. crop=100:100:12:34
  6422. @end example
  6423. Using named options, the example above becomes:
  6424. @example
  6425. crop=w=100:h=100:x=12:y=34
  6426. @end example
  6427. @item
  6428. Crop the central input area with size 100x100:
  6429. @example
  6430. crop=100:100
  6431. @end example
  6432. @item
  6433. Crop the central input area with size 2/3 of the input video:
  6434. @example
  6435. crop=2/3*in_w:2/3*in_h
  6436. @end example
  6437. @item
  6438. Crop the input video central square:
  6439. @example
  6440. crop=out_w=in_h
  6441. crop=in_h
  6442. @end example
  6443. @item
  6444. Delimit the rectangle with the top-left corner placed at position
  6445. 100:100 and the right-bottom corner corresponding to the right-bottom
  6446. corner of the input image.
  6447. @example
  6448. crop=in_w-100:in_h-100:100:100
  6449. @end example
  6450. @item
  6451. Crop 10 pixels from the left and right borders, and 20 pixels from
  6452. the top and bottom borders
  6453. @example
  6454. crop=in_w-2*10:in_h-2*20
  6455. @end example
  6456. @item
  6457. Keep only the bottom right quarter of the input image:
  6458. @example
  6459. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6460. @end example
  6461. @item
  6462. Crop height for getting Greek harmony:
  6463. @example
  6464. crop=in_w:1/PHI*in_w
  6465. @end example
  6466. @item
  6467. Apply trembling effect:
  6468. @example
  6469. 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)
  6470. @end example
  6471. @item
  6472. Apply erratic camera effect depending on timestamp:
  6473. @example
  6474. 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)"
  6475. @end example
  6476. @item
  6477. Set x depending on the value of y:
  6478. @example
  6479. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6480. @end example
  6481. @end itemize
  6482. @subsection Commands
  6483. This filter supports the following commands:
  6484. @table @option
  6485. @item w, out_w
  6486. @item h, out_h
  6487. @item x
  6488. @item y
  6489. Set width/height of the output video and the horizontal/vertical position
  6490. in the input video.
  6491. The command accepts the same syntax of the corresponding option.
  6492. If the specified expression is not valid, it is kept at its current
  6493. value.
  6494. @end table
  6495. @section cropdetect
  6496. Auto-detect the crop size.
  6497. It calculates the necessary cropping parameters and prints the
  6498. recommended parameters via the logging system. The detected dimensions
  6499. correspond to the non-black area of the input video.
  6500. It accepts the following parameters:
  6501. @table @option
  6502. @item limit
  6503. Set higher black value threshold, which can be optionally specified
  6504. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6505. value greater to the set value is considered non-black. It defaults to 24.
  6506. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6507. on the bitdepth of the pixel format.
  6508. @item round
  6509. The value which the width/height should be divisible by. It defaults to
  6510. 16. The offset is automatically adjusted to center the video. Use 2 to
  6511. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6512. encoding to most video codecs.
  6513. @item reset_count, reset
  6514. Set the counter that determines after how many frames cropdetect will
  6515. reset the previously detected largest video area and start over to
  6516. detect the current optimal crop area. Default value is 0.
  6517. This can be useful when channel logos distort the video area. 0
  6518. indicates 'never reset', and returns the largest area encountered during
  6519. playback.
  6520. @end table
  6521. @anchor{cue}
  6522. @section cue
  6523. Delay video filtering until a given wallclock timestamp. The filter first
  6524. passes on @option{preroll} amount of frames, then it buffers at most
  6525. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6526. it forwards the buffered frames and also any subsequent frames coming in its
  6527. input.
  6528. The filter can be used synchronize the output of multiple ffmpeg processes for
  6529. realtime output devices like decklink. By putting the delay in the filtering
  6530. chain and pre-buffering frames the process can pass on data to output almost
  6531. immediately after the target wallclock timestamp is reached.
  6532. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6533. some use cases.
  6534. @table @option
  6535. @item cue
  6536. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6537. @item preroll
  6538. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6539. @item buffer
  6540. The maximum duration of content to buffer before waiting for the cue expressed
  6541. in seconds. Default is 0.
  6542. @end table
  6543. @anchor{curves}
  6544. @section curves
  6545. Apply color adjustments using curves.
  6546. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6547. component (red, green and blue) has its values defined by @var{N} key points
  6548. tied from each other using a smooth curve. The x-axis represents the pixel
  6549. values from the input frame, and the y-axis the new pixel values to be set for
  6550. the output frame.
  6551. By default, a component curve is defined by the two points @var{(0;0)} and
  6552. @var{(1;1)}. This creates a straight line where each original pixel value is
  6553. "adjusted" to its own value, which means no change to the image.
  6554. The filter allows you to redefine these two points and add some more. A new
  6555. curve (using a natural cubic spline interpolation) will be define to pass
  6556. smoothly through all these new coordinates. The new defined points needs to be
  6557. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6558. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6559. the vector spaces, the values will be clipped accordingly.
  6560. The filter accepts the following options:
  6561. @table @option
  6562. @item preset
  6563. Select one of the available color presets. This option can be used in addition
  6564. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6565. options takes priority on the preset values.
  6566. Available presets are:
  6567. @table @samp
  6568. @item none
  6569. @item color_negative
  6570. @item cross_process
  6571. @item darker
  6572. @item increase_contrast
  6573. @item lighter
  6574. @item linear_contrast
  6575. @item medium_contrast
  6576. @item negative
  6577. @item strong_contrast
  6578. @item vintage
  6579. @end table
  6580. Default is @code{none}.
  6581. @item master, m
  6582. Set the master key points. These points will define a second pass mapping. It
  6583. is sometimes called a "luminance" or "value" mapping. It can be used with
  6584. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6585. post-processing LUT.
  6586. @item red, r
  6587. Set the key points for the red component.
  6588. @item green, g
  6589. Set the key points for the green component.
  6590. @item blue, b
  6591. Set the key points for the blue component.
  6592. @item all
  6593. Set the key points for all components (not including master).
  6594. Can be used in addition to the other key points component
  6595. options. In this case, the unset component(s) will fallback on this
  6596. @option{all} setting.
  6597. @item psfile
  6598. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6599. @item plot
  6600. Save Gnuplot script of the curves in specified file.
  6601. @end table
  6602. To avoid some filtergraph syntax conflicts, each key points list need to be
  6603. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6604. @subsection Examples
  6605. @itemize
  6606. @item
  6607. Increase slightly the middle level of blue:
  6608. @example
  6609. curves=blue='0/0 0.5/0.58 1/1'
  6610. @end example
  6611. @item
  6612. Vintage effect:
  6613. @example
  6614. 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'
  6615. @end example
  6616. Here we obtain the following coordinates for each components:
  6617. @table @var
  6618. @item red
  6619. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6620. @item green
  6621. @code{(0;0) (0.50;0.48) (1;1)}
  6622. @item blue
  6623. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6624. @end table
  6625. @item
  6626. The previous example can also be achieved with the associated built-in preset:
  6627. @example
  6628. curves=preset=vintage
  6629. @end example
  6630. @item
  6631. Or simply:
  6632. @example
  6633. curves=vintage
  6634. @end example
  6635. @item
  6636. Use a Photoshop preset and redefine the points of the green component:
  6637. @example
  6638. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6639. @end example
  6640. @item
  6641. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6642. and @command{gnuplot}:
  6643. @example
  6644. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6645. gnuplot -p /tmp/curves.plt
  6646. @end example
  6647. @end itemize
  6648. @section datascope
  6649. Video data analysis filter.
  6650. This filter shows hexadecimal pixel values of part of video.
  6651. The filter accepts the following options:
  6652. @table @option
  6653. @item size, s
  6654. Set output video size.
  6655. @item x
  6656. Set x offset from where to pick pixels.
  6657. @item y
  6658. Set y offset from where to pick pixels.
  6659. @item mode
  6660. Set scope mode, can be one of the following:
  6661. @table @samp
  6662. @item mono
  6663. Draw hexadecimal pixel values with white color on black background.
  6664. @item color
  6665. Draw hexadecimal pixel values with input video pixel color on black
  6666. background.
  6667. @item color2
  6668. Draw hexadecimal pixel values on color background picked from input video,
  6669. the text color is picked in such way so its always visible.
  6670. @end table
  6671. @item axis
  6672. Draw rows and columns numbers on left and top of video.
  6673. @item opacity
  6674. Set background opacity.
  6675. @item format
  6676. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  6677. @end table
  6678. @section dblur
  6679. Apply Directional blur filter.
  6680. The filter accepts the following options:
  6681. @table @option
  6682. @item angle
  6683. Set angle of directional blur. Default is @code{45}.
  6684. @item radius
  6685. Set radius of directional blur. Default is @code{5}.
  6686. @item planes
  6687. Set which planes to filter. By default all planes are filtered.
  6688. @end table
  6689. @subsection Commands
  6690. This filter supports same @ref{commands} as options.
  6691. The command accepts the same syntax of the corresponding option.
  6692. If the specified expression is not valid, it is kept at its current
  6693. value.
  6694. @section dctdnoiz
  6695. Denoise frames using 2D DCT (frequency domain filtering).
  6696. This filter is not designed for real time.
  6697. The filter accepts the following options:
  6698. @table @option
  6699. @item sigma, s
  6700. Set the noise sigma constant.
  6701. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6702. coefficient (absolute value) below this threshold with be dropped.
  6703. If you need a more advanced filtering, see @option{expr}.
  6704. Default is @code{0}.
  6705. @item overlap
  6706. Set number overlapping pixels for each block. Since the filter can be slow, you
  6707. may want to reduce this value, at the cost of a less effective filter and the
  6708. risk of various artefacts.
  6709. If the overlapping value doesn't permit processing the whole input width or
  6710. height, a warning will be displayed and according borders won't be denoised.
  6711. Default value is @var{blocksize}-1, which is the best possible setting.
  6712. @item expr, e
  6713. Set the coefficient factor expression.
  6714. For each coefficient of a DCT block, this expression will be evaluated as a
  6715. multiplier value for the coefficient.
  6716. If this is option is set, the @option{sigma} option will be ignored.
  6717. The absolute value of the coefficient can be accessed through the @var{c}
  6718. variable.
  6719. @item n
  6720. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6721. @var{blocksize}, which is the width and height of the processed blocks.
  6722. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6723. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6724. on the speed processing. Also, a larger block size does not necessarily means a
  6725. better de-noising.
  6726. @end table
  6727. @subsection Examples
  6728. Apply a denoise with a @option{sigma} of @code{4.5}:
  6729. @example
  6730. dctdnoiz=4.5
  6731. @end example
  6732. The same operation can be achieved using the expression system:
  6733. @example
  6734. dctdnoiz=e='gte(c, 4.5*3)'
  6735. @end example
  6736. Violent denoise using a block size of @code{16x16}:
  6737. @example
  6738. dctdnoiz=15:n=4
  6739. @end example
  6740. @section deband
  6741. Remove banding artifacts from input video.
  6742. It works by replacing banded pixels with average value of referenced pixels.
  6743. The filter accepts the following options:
  6744. @table @option
  6745. @item 1thr
  6746. @item 2thr
  6747. @item 3thr
  6748. @item 4thr
  6749. Set banding detection threshold for each plane. Default is 0.02.
  6750. Valid range is 0.00003 to 0.5.
  6751. If difference between current pixel and reference pixel is less than threshold,
  6752. it will be considered as banded.
  6753. @item range, r
  6754. Banding detection range in pixels. Default is 16. If positive, random number
  6755. in range 0 to set value will be used. If negative, exact absolute value
  6756. will be used.
  6757. The range defines square of four pixels around current pixel.
  6758. @item direction, d
  6759. Set direction in radians from which four pixel will be compared. If positive,
  6760. random direction from 0 to set direction will be picked. If negative, exact of
  6761. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6762. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6763. column.
  6764. @item blur, b
  6765. If enabled, current pixel is compared with average value of all four
  6766. surrounding pixels. The default is enabled. If disabled current pixel is
  6767. compared with all four surrounding pixels. The pixel is considered banded
  6768. if only all four differences with surrounding pixels are less than threshold.
  6769. @item coupling, c
  6770. If enabled, current pixel is changed if and only if all pixel components are banded,
  6771. e.g. banding detection threshold is triggered for all color components.
  6772. The default is disabled.
  6773. @end table
  6774. @section deblock
  6775. Remove blocking artifacts from input video.
  6776. The filter accepts the following options:
  6777. @table @option
  6778. @item filter
  6779. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6780. This controls what kind of deblocking is applied.
  6781. @item block
  6782. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6783. @item alpha
  6784. @item beta
  6785. @item gamma
  6786. @item delta
  6787. Set blocking detection thresholds. Allowed range is 0 to 1.
  6788. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6789. Using higher threshold gives more deblocking strength.
  6790. Setting @var{alpha} controls threshold detection at exact edge of block.
  6791. Remaining options controls threshold detection near the edge. Each one for
  6792. below/above or left/right. Setting any of those to @var{0} disables
  6793. deblocking.
  6794. @item planes
  6795. Set planes to filter. Default is to filter all available planes.
  6796. @end table
  6797. @subsection Examples
  6798. @itemize
  6799. @item
  6800. Deblock using weak filter and block size of 4 pixels.
  6801. @example
  6802. deblock=filter=weak:block=4
  6803. @end example
  6804. @item
  6805. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6806. deblocking more edges.
  6807. @example
  6808. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6809. @end example
  6810. @item
  6811. Similar as above, but filter only first plane.
  6812. @example
  6813. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6814. @end example
  6815. @item
  6816. Similar as above, but filter only second and third plane.
  6817. @example
  6818. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6819. @end example
  6820. @end itemize
  6821. @anchor{decimate}
  6822. @section decimate
  6823. Drop duplicated frames at regular intervals.
  6824. The filter accepts the following options:
  6825. @table @option
  6826. @item cycle
  6827. Set the number of frames from which one will be dropped. Setting this to
  6828. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6829. Default is @code{5}.
  6830. @item dupthresh
  6831. Set the threshold for duplicate detection. If the difference metric for a frame
  6832. is less than or equal to this value, then it is declared as duplicate. Default
  6833. is @code{1.1}
  6834. @item scthresh
  6835. Set scene change threshold. Default is @code{15}.
  6836. @item blockx
  6837. @item blocky
  6838. Set the size of the x and y-axis blocks used during metric calculations.
  6839. Larger blocks give better noise suppression, but also give worse detection of
  6840. small movements. Must be a power of two. Default is @code{32}.
  6841. @item ppsrc
  6842. Mark main input as a pre-processed input and activate clean source input
  6843. stream. This allows the input to be pre-processed with various filters to help
  6844. the metrics calculation while keeping the frame selection lossless. When set to
  6845. @code{1}, the first stream is for the pre-processed input, and the second
  6846. stream is the clean source from where the kept frames are chosen. Default is
  6847. @code{0}.
  6848. @item chroma
  6849. Set whether or not chroma is considered in the metric calculations. Default is
  6850. @code{1}.
  6851. @end table
  6852. @section deconvolve
  6853. Apply 2D deconvolution of video stream in frequency domain using second stream
  6854. as impulse.
  6855. The filter accepts the following options:
  6856. @table @option
  6857. @item planes
  6858. Set which planes to process.
  6859. @item impulse
  6860. Set which impulse video frames will be processed, can be @var{first}
  6861. or @var{all}. Default is @var{all}.
  6862. @item noise
  6863. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6864. and height are not same and not power of 2 or if stream prior to convolving
  6865. had noise.
  6866. @end table
  6867. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6868. @section dedot
  6869. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6870. It accepts the following options:
  6871. @table @option
  6872. @item m
  6873. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6874. @var{rainbows} for cross-color reduction.
  6875. @item lt
  6876. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6877. @item tl
  6878. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6879. @item tc
  6880. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6881. @item ct
  6882. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6883. @end table
  6884. @section deflate
  6885. Apply deflate effect to the video.
  6886. This filter replaces the pixel by the local(3x3) average by taking into account
  6887. only values lower than the pixel.
  6888. It accepts the following options:
  6889. @table @option
  6890. @item threshold0
  6891. @item threshold1
  6892. @item threshold2
  6893. @item threshold3
  6894. Limit the maximum change for each plane, default is 65535.
  6895. If 0, plane will remain unchanged.
  6896. @end table
  6897. @subsection Commands
  6898. This filter supports the all above options as @ref{commands}.
  6899. @section deflicker
  6900. Remove temporal frame luminance variations.
  6901. It accepts the following options:
  6902. @table @option
  6903. @item size, s
  6904. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6905. @item mode, m
  6906. Set averaging mode to smooth temporal luminance variations.
  6907. Available values are:
  6908. @table @samp
  6909. @item am
  6910. Arithmetic mean
  6911. @item gm
  6912. Geometric mean
  6913. @item hm
  6914. Harmonic mean
  6915. @item qm
  6916. Quadratic mean
  6917. @item cm
  6918. Cubic mean
  6919. @item pm
  6920. Power mean
  6921. @item median
  6922. Median
  6923. @end table
  6924. @item bypass
  6925. Do not actually modify frame. Useful when one only wants metadata.
  6926. @end table
  6927. @section dejudder
  6928. Remove judder produced by partially interlaced telecined content.
  6929. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6930. source was partially telecined content then the output of @code{pullup,dejudder}
  6931. will have a variable frame rate. May change the recorded frame rate of the
  6932. container. Aside from that change, this filter will not affect constant frame
  6933. rate video.
  6934. The option available in this filter is:
  6935. @table @option
  6936. @item cycle
  6937. Specify the length of the window over which the judder repeats.
  6938. Accepts any integer greater than 1. Useful values are:
  6939. @table @samp
  6940. @item 4
  6941. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6942. @item 5
  6943. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6944. @item 20
  6945. If a mixture of the two.
  6946. @end table
  6947. The default is @samp{4}.
  6948. @end table
  6949. @section delogo
  6950. Suppress a TV station logo by a simple interpolation of the surrounding
  6951. pixels. Just set a rectangle covering the logo and watch it disappear
  6952. (and sometimes something even uglier appear - your mileage may vary).
  6953. It accepts the following parameters:
  6954. @table @option
  6955. @item x
  6956. @item y
  6957. Specify the top left corner coordinates of the logo. They must be
  6958. specified.
  6959. @item w
  6960. @item h
  6961. Specify the width and height of the logo to clear. They must be
  6962. specified.
  6963. @item band, t
  6964. Specify the thickness of the fuzzy edge of the rectangle (added to
  6965. @var{w} and @var{h}). The default value is 1. This option is
  6966. deprecated, setting higher values should no longer be necessary and
  6967. is not recommended.
  6968. @item show
  6969. When set to 1, a green rectangle is drawn on the screen to simplify
  6970. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6971. The default value is 0.
  6972. The rectangle is drawn on the outermost pixels which will be (partly)
  6973. replaced with interpolated values. The values of the next pixels
  6974. immediately outside this rectangle in each direction will be used to
  6975. compute the interpolated pixel values inside the rectangle.
  6976. @end table
  6977. @subsection Examples
  6978. @itemize
  6979. @item
  6980. Set a rectangle covering the area with top left corner coordinates 0,0
  6981. and size 100x77, and a band of size 10:
  6982. @example
  6983. delogo=x=0:y=0:w=100:h=77:band=10
  6984. @end example
  6985. @end itemize
  6986. @anchor{derain}
  6987. @section derain
  6988. Remove the rain in the input image/video by applying the derain methods based on
  6989. convolutional neural networks. Supported models:
  6990. @itemize
  6991. @item
  6992. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6993. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6994. @end itemize
  6995. Training as well as model generation scripts are provided in
  6996. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6997. Native model files (.model) can be generated from TensorFlow model
  6998. files (.pb) by using tools/python/convert.py
  6999. The filter accepts the following options:
  7000. @table @option
  7001. @item filter_type
  7002. Specify which filter to use. This option accepts the following values:
  7003. @table @samp
  7004. @item derain
  7005. Derain filter. To conduct derain filter, you need to use a derain model.
  7006. @item dehaze
  7007. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  7008. @end table
  7009. Default value is @samp{derain}.
  7010. @item dnn_backend
  7011. Specify which DNN backend to use for model loading and execution. This option accepts
  7012. the following values:
  7013. @table @samp
  7014. @item native
  7015. Native implementation of DNN loading and execution.
  7016. @item tensorflow
  7017. TensorFlow backend. To enable this backend you
  7018. need to install the TensorFlow for C library (see
  7019. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7020. @code{--enable-libtensorflow}
  7021. @end table
  7022. Default value is @samp{native}.
  7023. @item model
  7024. Set path to model file specifying network architecture and its parameters.
  7025. Note that different backends use different file formats. TensorFlow and native
  7026. backend can load files for only its format.
  7027. @end table
  7028. It can also be finished with @ref{dnn_processing} filter.
  7029. @section deshake
  7030. Attempt to fix small changes in horizontal and/or vertical shift. This
  7031. filter helps remove camera shake from hand-holding a camera, bumping a
  7032. tripod, moving on a vehicle, etc.
  7033. The filter accepts the following options:
  7034. @table @option
  7035. @item x
  7036. @item y
  7037. @item w
  7038. @item h
  7039. Specify a rectangular area where to limit the search for motion
  7040. vectors.
  7041. If desired the search for motion vectors can be limited to a
  7042. rectangular area of the frame defined by its top left corner, width
  7043. and height. These parameters have the same meaning as the drawbox
  7044. filter which can be used to visualise the position of the bounding
  7045. box.
  7046. This is useful when simultaneous movement of subjects within the frame
  7047. might be confused for camera motion by the motion vector search.
  7048. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  7049. then the full frame is used. This allows later options to be set
  7050. without specifying the bounding box for the motion vector search.
  7051. Default - search the whole frame.
  7052. @item rx
  7053. @item ry
  7054. Specify the maximum extent of movement in x and y directions in the
  7055. range 0-64 pixels. Default 16.
  7056. @item edge
  7057. Specify how to generate pixels to fill blanks at the edge of the
  7058. frame. Available values are:
  7059. @table @samp
  7060. @item blank, 0
  7061. Fill zeroes at blank locations
  7062. @item original, 1
  7063. Original image at blank locations
  7064. @item clamp, 2
  7065. Extruded edge value at blank locations
  7066. @item mirror, 3
  7067. Mirrored edge at blank locations
  7068. @end table
  7069. Default value is @samp{mirror}.
  7070. @item blocksize
  7071. Specify the blocksize to use for motion search. Range 4-128 pixels,
  7072. default 8.
  7073. @item contrast
  7074. Specify the contrast threshold for blocks. Only blocks with more than
  7075. the specified contrast (difference between darkest and lightest
  7076. pixels) will be considered. Range 1-255, default 125.
  7077. @item search
  7078. Specify the search strategy. Available values are:
  7079. @table @samp
  7080. @item exhaustive, 0
  7081. Set exhaustive search
  7082. @item less, 1
  7083. Set less exhaustive search.
  7084. @end table
  7085. Default value is @samp{exhaustive}.
  7086. @item filename
  7087. If set then a detailed log of the motion search is written to the
  7088. specified file.
  7089. @end table
  7090. @section despill
  7091. Remove unwanted contamination of foreground colors, caused by reflected color of
  7092. greenscreen or bluescreen.
  7093. This filter accepts the following options:
  7094. @table @option
  7095. @item type
  7096. Set what type of despill to use.
  7097. @item mix
  7098. Set how spillmap will be generated.
  7099. @item expand
  7100. Set how much to get rid of still remaining spill.
  7101. @item red
  7102. Controls amount of red in spill area.
  7103. @item green
  7104. Controls amount of green in spill area.
  7105. Should be -1 for greenscreen.
  7106. @item blue
  7107. Controls amount of blue in spill area.
  7108. Should be -1 for bluescreen.
  7109. @item brightness
  7110. Controls brightness of spill area, preserving colors.
  7111. @item alpha
  7112. Modify alpha from generated spillmap.
  7113. @end table
  7114. @section detelecine
  7115. Apply an exact inverse of the telecine operation. It requires a predefined
  7116. pattern specified using the pattern option which must be the same as that passed
  7117. to the telecine filter.
  7118. This filter accepts the following options:
  7119. @table @option
  7120. @item first_field
  7121. @table @samp
  7122. @item top, t
  7123. top field first
  7124. @item bottom, b
  7125. bottom field first
  7126. The default value is @code{top}.
  7127. @end table
  7128. @item pattern
  7129. A string of numbers representing the pulldown pattern you wish to apply.
  7130. The default value is @code{23}.
  7131. @item start_frame
  7132. A number representing position of the first frame with respect to the telecine
  7133. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  7134. @end table
  7135. @section dilation
  7136. Apply dilation effect to the video.
  7137. This filter replaces the pixel by the local(3x3) maximum.
  7138. It accepts the following options:
  7139. @table @option
  7140. @item threshold0
  7141. @item threshold1
  7142. @item threshold2
  7143. @item threshold3
  7144. Limit the maximum change for each plane, default is 65535.
  7145. If 0, plane will remain unchanged.
  7146. @item coordinates
  7147. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7148. pixels are used.
  7149. Flags to local 3x3 coordinates maps like this:
  7150. 1 2 3
  7151. 4 5
  7152. 6 7 8
  7153. @end table
  7154. @subsection Commands
  7155. This filter supports the all above options as @ref{commands}.
  7156. @section displace
  7157. Displace pixels as indicated by second and third input stream.
  7158. It takes three input streams and outputs one stream, the first input is the
  7159. source, and second and third input are displacement maps.
  7160. The second input specifies how much to displace pixels along the
  7161. x-axis, while the third input specifies how much to displace pixels
  7162. along the y-axis.
  7163. If one of displacement map streams terminates, last frame from that
  7164. displacement map will be used.
  7165. Note that once generated, displacements maps can be reused over and over again.
  7166. A description of the accepted options follows.
  7167. @table @option
  7168. @item edge
  7169. Set displace behavior for pixels that are out of range.
  7170. Available values are:
  7171. @table @samp
  7172. @item blank
  7173. Missing pixels are replaced by black pixels.
  7174. @item smear
  7175. Adjacent pixels will spread out to replace missing pixels.
  7176. @item wrap
  7177. Out of range pixels are wrapped so they point to pixels of other side.
  7178. @item mirror
  7179. Out of range pixels will be replaced with mirrored pixels.
  7180. @end table
  7181. Default is @samp{smear}.
  7182. @end table
  7183. @subsection Examples
  7184. @itemize
  7185. @item
  7186. Add ripple effect to rgb input of video size hd720:
  7187. @example
  7188. 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
  7189. @end example
  7190. @item
  7191. Add wave effect to rgb input of video size hd720:
  7192. @example
  7193. 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
  7194. @end example
  7195. @end itemize
  7196. @anchor{dnn_processing}
  7197. @section dnn_processing
  7198. Do image processing with deep neural networks. It works together with another filter
  7199. which converts the pixel format of the Frame to what the dnn network requires.
  7200. The filter accepts the following options:
  7201. @table @option
  7202. @item dnn_backend
  7203. Specify which DNN backend to use for model loading and execution. This option accepts
  7204. the following values:
  7205. @table @samp
  7206. @item native
  7207. Native implementation of DNN loading and execution.
  7208. @item tensorflow
  7209. TensorFlow backend. To enable this backend you
  7210. need to install the TensorFlow for C library (see
  7211. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7212. @code{--enable-libtensorflow}
  7213. @item openvino
  7214. OpenVINO backend. To enable this backend you
  7215. need to build and install the OpenVINO for C library (see
  7216. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  7217. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  7218. be needed if the header files and libraries are not installed into system path)
  7219. @end table
  7220. Default value is @samp{native}.
  7221. @item model
  7222. Set path to model file specifying network architecture and its parameters.
  7223. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  7224. backend can load files for only its format.
  7225. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7226. @item input
  7227. Set the input name of the dnn network.
  7228. @item output
  7229. Set the output name of the dnn network.
  7230. @end table
  7231. @subsection Examples
  7232. @itemize
  7233. @item
  7234. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7235. @example
  7236. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7237. @end example
  7238. @item
  7239. Halve the pixel value of the frame with format gray32f:
  7240. @example
  7241. ffmpeg -i input.jpg -vf format=grayf32,dnn_processing=model=halve_gray_float.model:input=dnn_in:output=dnn_out:dnn_backend=native -y out.native.png
  7242. @end example
  7243. @item
  7244. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7245. @example
  7246. ./ffmpeg -i 480p.jpg -vf format=yuv420p,scale=w=iw*2:h=ih*2,dnn_processing=dnn_backend=tensorflow:model=srcnn.pb:input=x:output=y -y srcnn.jpg
  7247. @end example
  7248. @item
  7249. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7250. @example
  7251. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7252. @end example
  7253. @end itemize
  7254. @section drawbox
  7255. Draw a colored box on the input image.
  7256. It accepts the following parameters:
  7257. @table @option
  7258. @item x
  7259. @item y
  7260. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7261. @item width, w
  7262. @item height, h
  7263. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7264. the input width and height. It defaults to 0.
  7265. @item color, c
  7266. Specify the color of the box to write. For the general syntax of this option,
  7267. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7268. value @code{invert} is used, the box edge color is the same as the
  7269. video with inverted luma.
  7270. @item thickness, t
  7271. The expression which sets the thickness of the box edge.
  7272. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7273. See below for the list of accepted constants.
  7274. @item replace
  7275. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7276. will overwrite the video's color and alpha pixels.
  7277. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7278. @end table
  7279. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7280. following constants:
  7281. @table @option
  7282. @item dar
  7283. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7284. @item hsub
  7285. @item vsub
  7286. horizontal and vertical chroma subsample values. For example for the
  7287. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7288. @item in_h, ih
  7289. @item in_w, iw
  7290. The input width and height.
  7291. @item sar
  7292. The input sample aspect ratio.
  7293. @item x
  7294. @item y
  7295. The x and y offset coordinates where the box is drawn.
  7296. @item w
  7297. @item h
  7298. The width and height of the drawn box.
  7299. @item t
  7300. The thickness of the drawn box.
  7301. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7302. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7303. @end table
  7304. @subsection Examples
  7305. @itemize
  7306. @item
  7307. Draw a black box around the edge of the input image:
  7308. @example
  7309. drawbox
  7310. @end example
  7311. @item
  7312. Draw a box with color red and an opacity of 50%:
  7313. @example
  7314. drawbox=10:20:200:60:red@@0.5
  7315. @end example
  7316. The previous example can be specified as:
  7317. @example
  7318. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7319. @end example
  7320. @item
  7321. Fill the box with pink color:
  7322. @example
  7323. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7324. @end example
  7325. @item
  7326. Draw a 2-pixel red 2.40:1 mask:
  7327. @example
  7328. 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
  7329. @end example
  7330. @end itemize
  7331. @subsection Commands
  7332. This filter supports same commands as options.
  7333. The command accepts the same syntax of the corresponding option.
  7334. If the specified expression is not valid, it is kept at its current
  7335. value.
  7336. @anchor{drawgraph}
  7337. @section drawgraph
  7338. Draw a graph using input video metadata.
  7339. It accepts the following parameters:
  7340. @table @option
  7341. @item m1
  7342. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7343. @item fg1
  7344. Set 1st foreground color expression.
  7345. @item m2
  7346. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7347. @item fg2
  7348. Set 2nd foreground color expression.
  7349. @item m3
  7350. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7351. @item fg3
  7352. Set 3rd foreground color expression.
  7353. @item m4
  7354. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7355. @item fg4
  7356. Set 4th foreground color expression.
  7357. @item min
  7358. Set minimal value of metadata value.
  7359. @item max
  7360. Set maximal value of metadata value.
  7361. @item bg
  7362. Set graph background color. Default is white.
  7363. @item mode
  7364. Set graph mode.
  7365. Available values for mode is:
  7366. @table @samp
  7367. @item bar
  7368. @item dot
  7369. @item line
  7370. @end table
  7371. Default is @code{line}.
  7372. @item slide
  7373. Set slide mode.
  7374. Available values for slide is:
  7375. @table @samp
  7376. @item frame
  7377. Draw new frame when right border is reached.
  7378. @item replace
  7379. Replace old columns with new ones.
  7380. @item scroll
  7381. Scroll from right to left.
  7382. @item rscroll
  7383. Scroll from left to right.
  7384. @item picture
  7385. Draw single picture.
  7386. @end table
  7387. Default is @code{frame}.
  7388. @item size
  7389. Set size of graph video. For the syntax of this option, check the
  7390. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7391. The default value is @code{900x256}.
  7392. @item rate, r
  7393. Set the output frame rate. Default value is @code{25}.
  7394. The foreground color expressions can use the following variables:
  7395. @table @option
  7396. @item MIN
  7397. Minimal value of metadata value.
  7398. @item MAX
  7399. Maximal value of metadata value.
  7400. @item VAL
  7401. Current metadata key value.
  7402. @end table
  7403. The color is defined as 0xAABBGGRR.
  7404. @end table
  7405. Example using metadata from @ref{signalstats} filter:
  7406. @example
  7407. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7408. @end example
  7409. Example using metadata from @ref{ebur128} filter:
  7410. @example
  7411. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7412. @end example
  7413. @section drawgrid
  7414. Draw a grid on the input image.
  7415. It accepts the following parameters:
  7416. @table @option
  7417. @item x
  7418. @item y
  7419. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7420. @item width, w
  7421. @item height, h
  7422. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7423. input width and height, respectively, minus @code{thickness}, so image gets
  7424. framed. Default to 0.
  7425. @item color, c
  7426. Specify the color of the grid. For the general syntax of this option,
  7427. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7428. value @code{invert} is used, the grid color is the same as the
  7429. video with inverted luma.
  7430. @item thickness, t
  7431. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7432. See below for the list of accepted constants.
  7433. @item replace
  7434. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7435. will overwrite the video's color and alpha pixels.
  7436. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7437. @end table
  7438. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7439. following constants:
  7440. @table @option
  7441. @item dar
  7442. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7443. @item hsub
  7444. @item vsub
  7445. horizontal and vertical chroma subsample values. For example for the
  7446. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7447. @item in_h, ih
  7448. @item in_w, iw
  7449. The input grid cell width and height.
  7450. @item sar
  7451. The input sample aspect ratio.
  7452. @item x
  7453. @item y
  7454. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7455. @item w
  7456. @item h
  7457. The width and height of the drawn cell.
  7458. @item t
  7459. The thickness of the drawn cell.
  7460. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7461. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7462. @end table
  7463. @subsection Examples
  7464. @itemize
  7465. @item
  7466. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7467. @example
  7468. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7469. @end example
  7470. @item
  7471. Draw a white 3x3 grid with an opacity of 50%:
  7472. @example
  7473. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7474. @end example
  7475. @end itemize
  7476. @subsection Commands
  7477. This filter supports same commands as options.
  7478. The command accepts the same syntax of the corresponding option.
  7479. If the specified expression is not valid, it is kept at its current
  7480. value.
  7481. @anchor{drawtext}
  7482. @section drawtext
  7483. Draw a text string or text from a specified file on top of a video, using the
  7484. libfreetype library.
  7485. To enable compilation of this filter, you need to configure FFmpeg with
  7486. @code{--enable-libfreetype}.
  7487. To enable default font fallback and the @var{font} option you need to
  7488. configure FFmpeg with @code{--enable-libfontconfig}.
  7489. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7490. @code{--enable-libfribidi}.
  7491. @subsection Syntax
  7492. It accepts the following parameters:
  7493. @table @option
  7494. @item box
  7495. Used to draw a box around text using the background color.
  7496. The value must be either 1 (enable) or 0 (disable).
  7497. The default value of @var{box} is 0.
  7498. @item boxborderw
  7499. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7500. The default value of @var{boxborderw} is 0.
  7501. @item boxcolor
  7502. The color to be used for drawing box around text. For the syntax of this
  7503. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7504. The default value of @var{boxcolor} is "white".
  7505. @item line_spacing
  7506. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7507. The default value of @var{line_spacing} is 0.
  7508. @item borderw
  7509. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7510. The default value of @var{borderw} is 0.
  7511. @item bordercolor
  7512. Set the color to be used for drawing border around text. For the syntax of this
  7513. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7514. The default value of @var{bordercolor} is "black".
  7515. @item expansion
  7516. Select how the @var{text} is expanded. Can be either @code{none},
  7517. @code{strftime} (deprecated) or
  7518. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7519. below for details.
  7520. @item basetime
  7521. Set a start time for the count. Value is in microseconds. Only applied
  7522. in the deprecated strftime expansion mode. To emulate in normal expansion
  7523. mode use the @code{pts} function, supplying the start time (in seconds)
  7524. as the second argument.
  7525. @item fix_bounds
  7526. If true, check and fix text coords to avoid clipping.
  7527. @item fontcolor
  7528. The color to be used for drawing fonts. For the syntax of this option, check
  7529. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7530. The default value of @var{fontcolor} is "black".
  7531. @item fontcolor_expr
  7532. String which is expanded the same way as @var{text} to obtain dynamic
  7533. @var{fontcolor} value. By default this option has empty value and is not
  7534. processed. When this option is set, it overrides @var{fontcolor} option.
  7535. @item font
  7536. The font family to be used for drawing text. By default Sans.
  7537. @item fontfile
  7538. The font file to be used for drawing text. The path must be included.
  7539. This parameter is mandatory if the fontconfig support is disabled.
  7540. @item alpha
  7541. Draw the text applying alpha blending. The value can
  7542. be a number between 0.0 and 1.0.
  7543. The expression accepts the same variables @var{x, y} as well.
  7544. The default value is 1.
  7545. Please see @var{fontcolor_expr}.
  7546. @item fontsize
  7547. The font size to be used for drawing text.
  7548. The default value of @var{fontsize} is 16.
  7549. @item text_shaping
  7550. If set to 1, attempt to shape the text (for example, reverse the order of
  7551. right-to-left text and join Arabic characters) before drawing it.
  7552. Otherwise, just draw the text exactly as given.
  7553. By default 1 (if supported).
  7554. @item ft_load_flags
  7555. The flags to be used for loading the fonts.
  7556. The flags map the corresponding flags supported by libfreetype, and are
  7557. a combination of the following values:
  7558. @table @var
  7559. @item default
  7560. @item no_scale
  7561. @item no_hinting
  7562. @item render
  7563. @item no_bitmap
  7564. @item vertical_layout
  7565. @item force_autohint
  7566. @item crop_bitmap
  7567. @item pedantic
  7568. @item ignore_global_advance_width
  7569. @item no_recurse
  7570. @item ignore_transform
  7571. @item monochrome
  7572. @item linear_design
  7573. @item no_autohint
  7574. @end table
  7575. Default value is "default".
  7576. For more information consult the documentation for the FT_LOAD_*
  7577. libfreetype flags.
  7578. @item shadowcolor
  7579. The color to be used for drawing a shadow behind the drawn text. For the
  7580. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7581. ffmpeg-utils manual,ffmpeg-utils}.
  7582. The default value of @var{shadowcolor} is "black".
  7583. @item shadowx
  7584. @item shadowy
  7585. The x and y offsets for the text shadow position with respect to the
  7586. position of the text. They can be either positive or negative
  7587. values. The default value for both is "0".
  7588. @item start_number
  7589. The starting frame number for the n/frame_num variable. The default value
  7590. is "0".
  7591. @item tabsize
  7592. The size in number of spaces to use for rendering the tab.
  7593. Default value is 4.
  7594. @item timecode
  7595. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7596. format. It can be used with or without text parameter. @var{timecode_rate}
  7597. option must be specified.
  7598. @item timecode_rate, rate, r
  7599. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7600. integer. Minimum value is "1".
  7601. Drop-frame timecode is supported for frame rates 30 & 60.
  7602. @item tc24hmax
  7603. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7604. Default is 0 (disabled).
  7605. @item text
  7606. The text string to be drawn. The text must be a sequence of UTF-8
  7607. encoded characters.
  7608. This parameter is mandatory if no file is specified with the parameter
  7609. @var{textfile}.
  7610. @item textfile
  7611. A text file containing text to be drawn. The text must be a sequence
  7612. of UTF-8 encoded characters.
  7613. This parameter is mandatory if no text string is specified with the
  7614. parameter @var{text}.
  7615. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7616. @item reload
  7617. If set to 1, the @var{textfile} will be reloaded before each frame.
  7618. Be sure to update it atomically, or it may be read partially, or even fail.
  7619. @item x
  7620. @item y
  7621. The expressions which specify the offsets where text will be drawn
  7622. within the video frame. They are relative to the top/left border of the
  7623. output image.
  7624. The default value of @var{x} and @var{y} is "0".
  7625. See below for the list of accepted constants and functions.
  7626. @end table
  7627. The parameters for @var{x} and @var{y} are expressions containing the
  7628. following constants and functions:
  7629. @table @option
  7630. @item dar
  7631. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7632. @item hsub
  7633. @item vsub
  7634. horizontal and vertical chroma subsample values. For example for the
  7635. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7636. @item line_h, lh
  7637. the height of each text line
  7638. @item main_h, h, H
  7639. the input height
  7640. @item main_w, w, W
  7641. the input width
  7642. @item max_glyph_a, ascent
  7643. the maximum distance from the baseline to the highest/upper grid
  7644. coordinate used to place a glyph outline point, for all the rendered
  7645. glyphs.
  7646. It is a positive value, due to the grid's orientation with the Y axis
  7647. upwards.
  7648. @item max_glyph_d, descent
  7649. the maximum distance from the baseline to the lowest grid coordinate
  7650. used to place a glyph outline point, for all the rendered glyphs.
  7651. This is a negative value, due to the grid's orientation, with the Y axis
  7652. upwards.
  7653. @item max_glyph_h
  7654. maximum glyph height, that is the maximum height for all the glyphs
  7655. contained in the rendered text, it is equivalent to @var{ascent} -
  7656. @var{descent}.
  7657. @item max_glyph_w
  7658. maximum glyph width, that is the maximum width for all the glyphs
  7659. contained in the rendered text
  7660. @item n
  7661. the number of input frame, starting from 0
  7662. @item rand(min, max)
  7663. return a random number included between @var{min} and @var{max}
  7664. @item sar
  7665. The input sample aspect ratio.
  7666. @item t
  7667. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7668. @item text_h, th
  7669. the height of the rendered text
  7670. @item text_w, tw
  7671. the width of the rendered text
  7672. @item x
  7673. @item y
  7674. the x and y offset coordinates where the text is drawn.
  7675. These parameters allow the @var{x} and @var{y} expressions to refer
  7676. to each other, so you can for example specify @code{y=x/dar}.
  7677. @item pict_type
  7678. A one character description of the current frame's picture type.
  7679. @item pkt_pos
  7680. The current packet's position in the input file or stream
  7681. (in bytes, from the start of the input). A value of -1 indicates
  7682. this info is not available.
  7683. @item pkt_duration
  7684. The current packet's duration, in seconds.
  7685. @item pkt_size
  7686. The current packet's size (in bytes).
  7687. @end table
  7688. @anchor{drawtext_expansion}
  7689. @subsection Text expansion
  7690. If @option{expansion} is set to @code{strftime},
  7691. the filter recognizes strftime() sequences in the provided text and
  7692. expands them accordingly. Check the documentation of strftime(). This
  7693. feature is deprecated.
  7694. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7695. If @option{expansion} is set to @code{normal} (which is the default),
  7696. the following expansion mechanism is used.
  7697. The backslash character @samp{\}, followed by any character, always expands to
  7698. the second character.
  7699. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7700. braces is a function name, possibly followed by arguments separated by ':'.
  7701. If the arguments contain special characters or delimiters (':' or '@}'),
  7702. they should be escaped.
  7703. Note that they probably must also be escaped as the value for the
  7704. @option{text} option in the filter argument string and as the filter
  7705. argument in the filtergraph description, and possibly also for the shell,
  7706. that makes up to four levels of escaping; using a text file avoids these
  7707. problems.
  7708. The following functions are available:
  7709. @table @command
  7710. @item expr, e
  7711. The expression evaluation result.
  7712. It must take one argument specifying the expression to be evaluated,
  7713. which accepts the same constants and functions as the @var{x} and
  7714. @var{y} values. Note that not all constants should be used, for
  7715. example the text size is not known when evaluating the expression, so
  7716. the constants @var{text_w} and @var{text_h} will have an undefined
  7717. value.
  7718. @item expr_int_format, eif
  7719. Evaluate the expression's value and output as formatted integer.
  7720. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7721. The second argument specifies the output format. Allowed values are @samp{x},
  7722. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7723. @code{printf} function.
  7724. The third parameter is optional and sets the number of positions taken by the output.
  7725. It can be used to add padding with zeros from the left.
  7726. @item gmtime
  7727. The time at which the filter is running, expressed in UTC.
  7728. It can accept an argument: a strftime() format string.
  7729. @item localtime
  7730. The time at which the filter is running, expressed in the local time zone.
  7731. It can accept an argument: a strftime() format string.
  7732. @item metadata
  7733. Frame metadata. Takes one or two arguments.
  7734. The first argument is mandatory and specifies the metadata key.
  7735. The second argument is optional and specifies a default value, used when the
  7736. metadata key is not found or empty.
  7737. Available metadata can be identified by inspecting entries
  7738. starting with TAG included within each frame section
  7739. printed by running @code{ffprobe -show_frames}.
  7740. String metadata generated in filters leading to
  7741. the drawtext filter are also available.
  7742. @item n, frame_num
  7743. The frame number, starting from 0.
  7744. @item pict_type
  7745. A one character description of the current picture type.
  7746. @item pts
  7747. The timestamp of the current frame.
  7748. It can take up to three arguments.
  7749. The first argument is the format of the timestamp; it defaults to @code{flt}
  7750. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7751. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7752. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7753. @code{localtime} stands for the timestamp of the frame formatted as
  7754. local time zone time.
  7755. The second argument is an offset added to the timestamp.
  7756. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7757. supplied to present the hour part of the formatted timestamp in 24h format
  7758. (00-23).
  7759. If the format is set to @code{localtime} or @code{gmtime},
  7760. a third argument may be supplied: a strftime() format string.
  7761. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7762. @end table
  7763. @subsection Commands
  7764. This filter supports altering parameters via commands:
  7765. @table @option
  7766. @item reinit
  7767. Alter existing filter parameters.
  7768. Syntax for the argument is the same as for filter invocation, e.g.
  7769. @example
  7770. fontsize=56:fontcolor=green:text='Hello World'
  7771. @end example
  7772. Full filter invocation with sendcmd would look like this:
  7773. @example
  7774. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7775. @end example
  7776. @end table
  7777. If the entire argument can't be parsed or applied as valid values then the filter will
  7778. continue with its existing parameters.
  7779. @subsection Examples
  7780. @itemize
  7781. @item
  7782. Draw "Test Text" with font FreeSerif, using the default values for the
  7783. optional parameters.
  7784. @example
  7785. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7786. @end example
  7787. @item
  7788. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7789. and y=50 (counting from the top-left corner of the screen), text is
  7790. yellow with a red box around it. Both the text and the box have an
  7791. opacity of 20%.
  7792. @example
  7793. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7794. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7795. @end example
  7796. Note that the double quotes are not necessary if spaces are not used
  7797. within the parameter list.
  7798. @item
  7799. Show the text at the center of the video frame:
  7800. @example
  7801. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7802. @end example
  7803. @item
  7804. Show the text at a random position, switching to a new position every 30 seconds:
  7805. @example
  7806. 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)"
  7807. @end example
  7808. @item
  7809. Show a text line sliding from right to left in the last row of the video
  7810. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7811. with no newlines.
  7812. @example
  7813. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7814. @end example
  7815. @item
  7816. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7817. @example
  7818. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7819. @end example
  7820. @item
  7821. Draw a single green letter "g", at the center of the input video.
  7822. The glyph baseline is placed at half screen height.
  7823. @example
  7824. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7825. @end example
  7826. @item
  7827. Show text for 1 second every 3 seconds:
  7828. @example
  7829. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7830. @end example
  7831. @item
  7832. Use fontconfig to set the font. Note that the colons need to be escaped.
  7833. @example
  7834. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7835. @end example
  7836. @item
  7837. Print the date of a real-time encoding (see strftime(3)):
  7838. @example
  7839. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7840. @end example
  7841. @item
  7842. Show text fading in and out (appearing/disappearing):
  7843. @example
  7844. #!/bin/sh
  7845. DS=1.0 # display start
  7846. DE=10.0 # display end
  7847. FID=1.5 # fade in duration
  7848. FOD=5 # fade out duration
  7849. 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 @}"
  7850. @end example
  7851. @item
  7852. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7853. and the @option{fontsize} value are included in the @option{y} offset.
  7854. @example
  7855. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7856. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7857. @end example
  7858. @item
  7859. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  7860. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  7861. must have option @option{-export_path_metadata 1} for the special metadata fields
  7862. to be available for filters.
  7863. @example
  7864. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  7865. @end example
  7866. @end itemize
  7867. For more information about libfreetype, check:
  7868. @url{http://www.freetype.org/}.
  7869. For more information about fontconfig, check:
  7870. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7871. For more information about libfribidi, check:
  7872. @url{http://fribidi.org/}.
  7873. @section edgedetect
  7874. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7875. The filter accepts the following options:
  7876. @table @option
  7877. @item low
  7878. @item high
  7879. Set low and high threshold values used by the Canny thresholding
  7880. algorithm.
  7881. The high threshold selects the "strong" edge pixels, which are then
  7882. connected through 8-connectivity with the "weak" edge pixels selected
  7883. by the low threshold.
  7884. @var{low} and @var{high} threshold values must be chosen in the range
  7885. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7886. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7887. is @code{50/255}.
  7888. @item mode
  7889. Define the drawing mode.
  7890. @table @samp
  7891. @item wires
  7892. Draw white/gray wires on black background.
  7893. @item colormix
  7894. Mix the colors to create a paint/cartoon effect.
  7895. @item canny
  7896. Apply Canny edge detector on all selected planes.
  7897. @end table
  7898. Default value is @var{wires}.
  7899. @item planes
  7900. Select planes for filtering. By default all available planes are filtered.
  7901. @end table
  7902. @subsection Examples
  7903. @itemize
  7904. @item
  7905. Standard edge detection with custom values for the hysteresis thresholding:
  7906. @example
  7907. edgedetect=low=0.1:high=0.4
  7908. @end example
  7909. @item
  7910. Painting effect without thresholding:
  7911. @example
  7912. edgedetect=mode=colormix:high=0
  7913. @end example
  7914. @end itemize
  7915. @section elbg
  7916. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7917. For each input image, the filter will compute the optimal mapping from
  7918. the input to the output given the codebook length, that is the number
  7919. of distinct output colors.
  7920. This filter accepts the following options.
  7921. @table @option
  7922. @item codebook_length, l
  7923. Set codebook length. The value must be a positive integer, and
  7924. represents the number of distinct output colors. Default value is 256.
  7925. @item nb_steps, n
  7926. Set the maximum number of iterations to apply for computing the optimal
  7927. mapping. The higher the value the better the result and the higher the
  7928. computation time. Default value is 1.
  7929. @item seed, s
  7930. Set a random seed, must be an integer included between 0 and
  7931. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7932. will try to use a good random seed on a best effort basis.
  7933. @item pal8
  7934. Set pal8 output pixel format. This option does not work with codebook
  7935. length greater than 256.
  7936. @end table
  7937. @section entropy
  7938. Measure graylevel entropy in histogram of color channels of video frames.
  7939. It accepts the following parameters:
  7940. @table @option
  7941. @item mode
  7942. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7943. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7944. between neighbour histogram values.
  7945. @end table
  7946. @section eq
  7947. Set brightness, contrast, saturation and approximate gamma adjustment.
  7948. The filter accepts the following options:
  7949. @table @option
  7950. @item contrast
  7951. Set the contrast expression. The value must be a float value in range
  7952. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7953. @item brightness
  7954. Set the brightness expression. The value must be a float value in
  7955. range @code{-1.0} to @code{1.0}. The default value is "0".
  7956. @item saturation
  7957. Set the saturation expression. The value must be a float in
  7958. range @code{0.0} to @code{3.0}. The default value is "1".
  7959. @item gamma
  7960. Set the gamma expression. The value must be a float in range
  7961. @code{0.1} to @code{10.0}. The default value is "1".
  7962. @item gamma_r
  7963. Set the gamma expression for red. The value must be a float in
  7964. range @code{0.1} to @code{10.0}. The default value is "1".
  7965. @item gamma_g
  7966. Set the gamma expression for green. The value must be a float in range
  7967. @code{0.1} to @code{10.0}. The default value is "1".
  7968. @item gamma_b
  7969. Set the gamma expression for blue. The value must be a float in range
  7970. @code{0.1} to @code{10.0}. The default value is "1".
  7971. @item gamma_weight
  7972. Set the gamma weight expression. It can be used to reduce the effect
  7973. of a high gamma value on bright image areas, e.g. keep them from
  7974. getting overamplified and just plain white. The value must be a float
  7975. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7976. gamma correction all the way down while @code{1.0} leaves it at its
  7977. full strength. Default is "1".
  7978. @item eval
  7979. Set when the expressions for brightness, contrast, saturation and
  7980. gamma expressions are evaluated.
  7981. It accepts the following values:
  7982. @table @samp
  7983. @item init
  7984. only evaluate expressions once during the filter initialization or
  7985. when a command is processed
  7986. @item frame
  7987. evaluate expressions for each incoming frame
  7988. @end table
  7989. Default value is @samp{init}.
  7990. @end table
  7991. The expressions accept the following parameters:
  7992. @table @option
  7993. @item n
  7994. frame count of the input frame starting from 0
  7995. @item pos
  7996. byte position of the corresponding packet in the input file, NAN if
  7997. unspecified
  7998. @item r
  7999. frame rate of the input video, NAN if the input frame rate is unknown
  8000. @item t
  8001. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8002. @end table
  8003. @subsection Commands
  8004. The filter supports the following commands:
  8005. @table @option
  8006. @item contrast
  8007. Set the contrast expression.
  8008. @item brightness
  8009. Set the brightness expression.
  8010. @item saturation
  8011. Set the saturation expression.
  8012. @item gamma
  8013. Set the gamma expression.
  8014. @item gamma_r
  8015. Set the gamma_r expression.
  8016. @item gamma_g
  8017. Set gamma_g expression.
  8018. @item gamma_b
  8019. Set gamma_b expression.
  8020. @item gamma_weight
  8021. Set gamma_weight expression.
  8022. The command accepts the same syntax of the corresponding option.
  8023. If the specified expression is not valid, it is kept at its current
  8024. value.
  8025. @end table
  8026. @section erosion
  8027. Apply erosion effect to the video.
  8028. This filter replaces the pixel by the local(3x3) minimum.
  8029. It accepts the following options:
  8030. @table @option
  8031. @item threshold0
  8032. @item threshold1
  8033. @item threshold2
  8034. @item threshold3
  8035. Limit the maximum change for each plane, default is 65535.
  8036. If 0, plane will remain unchanged.
  8037. @item coordinates
  8038. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8039. pixels are used.
  8040. Flags to local 3x3 coordinates maps like this:
  8041. 1 2 3
  8042. 4 5
  8043. 6 7 8
  8044. @end table
  8045. @subsection Commands
  8046. This filter supports the all above options as @ref{commands}.
  8047. @section extractplanes
  8048. Extract color channel components from input video stream into
  8049. separate grayscale video streams.
  8050. The filter accepts the following option:
  8051. @table @option
  8052. @item planes
  8053. Set plane(s) to extract.
  8054. Available values for planes are:
  8055. @table @samp
  8056. @item y
  8057. @item u
  8058. @item v
  8059. @item a
  8060. @item r
  8061. @item g
  8062. @item b
  8063. @end table
  8064. Choosing planes not available in the input will result in an error.
  8065. That means you cannot select @code{r}, @code{g}, @code{b} planes
  8066. with @code{y}, @code{u}, @code{v} planes at same time.
  8067. @end table
  8068. @subsection Examples
  8069. @itemize
  8070. @item
  8071. Extract luma, u and v color channel component from input video frame
  8072. into 3 grayscale outputs:
  8073. @example
  8074. 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
  8075. @end example
  8076. @end itemize
  8077. @section fade
  8078. Apply a fade-in/out effect to the input video.
  8079. It accepts the following parameters:
  8080. @table @option
  8081. @item type, t
  8082. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  8083. effect.
  8084. Default is @code{in}.
  8085. @item start_frame, s
  8086. Specify the number of the frame to start applying the fade
  8087. effect at. Default is 0.
  8088. @item nb_frames, n
  8089. The number of frames that the fade effect lasts. At the end of the
  8090. fade-in effect, the output video will have the same intensity as the input video.
  8091. At the end of the fade-out transition, the output video will be filled with the
  8092. selected @option{color}.
  8093. Default is 25.
  8094. @item alpha
  8095. If set to 1, fade only alpha channel, if one exists on the input.
  8096. Default value is 0.
  8097. @item start_time, st
  8098. Specify the timestamp (in seconds) of the frame to start to apply the fade
  8099. effect. If both start_frame and start_time are specified, the fade will start at
  8100. whichever comes last. Default is 0.
  8101. @item duration, d
  8102. The number of seconds for which the fade effect has to last. At the end of the
  8103. fade-in effect the output video will have the same intensity as the input video,
  8104. at the end of the fade-out transition the output video will be filled with the
  8105. selected @option{color}.
  8106. If both duration and nb_frames are specified, duration is used. Default is 0
  8107. (nb_frames is used by default).
  8108. @item color, c
  8109. Specify the color of the fade. Default is "black".
  8110. @end table
  8111. @subsection Examples
  8112. @itemize
  8113. @item
  8114. Fade in the first 30 frames of video:
  8115. @example
  8116. fade=in:0:30
  8117. @end example
  8118. The command above is equivalent to:
  8119. @example
  8120. fade=t=in:s=0:n=30
  8121. @end example
  8122. @item
  8123. Fade out the last 45 frames of a 200-frame video:
  8124. @example
  8125. fade=out:155:45
  8126. fade=type=out:start_frame=155:nb_frames=45
  8127. @end example
  8128. @item
  8129. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  8130. @example
  8131. fade=in:0:25, fade=out:975:25
  8132. @end example
  8133. @item
  8134. Make the first 5 frames yellow, then fade in from frame 5-24:
  8135. @example
  8136. fade=in:5:20:color=yellow
  8137. @end example
  8138. @item
  8139. Fade in alpha over first 25 frames of video:
  8140. @example
  8141. fade=in:0:25:alpha=1
  8142. @end example
  8143. @item
  8144. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  8145. @example
  8146. fade=t=in:st=5.5:d=0.5
  8147. @end example
  8148. @end itemize
  8149. @section fftdnoiz
  8150. Denoise frames using 3D FFT (frequency domain filtering).
  8151. The filter accepts the following options:
  8152. @table @option
  8153. @item sigma
  8154. Set the noise sigma constant. This sets denoising strength.
  8155. Default value is 1. Allowed range is from 0 to 30.
  8156. Using very high sigma with low overlap may give blocking artifacts.
  8157. @item amount
  8158. Set amount of denoising. By default all detected noise is reduced.
  8159. Default value is 1. Allowed range is from 0 to 1.
  8160. @item block
  8161. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  8162. Actual size of block in pixels is 2 to power of @var{block}, so by default
  8163. block size in pixels is 2^4 which is 16.
  8164. @item overlap
  8165. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  8166. @item prev
  8167. Set number of previous frames to use for denoising. By default is set to 0.
  8168. @item next
  8169. Set number of next frames to to use for denoising. By default is set to 0.
  8170. @item planes
  8171. Set planes which will be filtered, by default are all available filtered
  8172. except alpha.
  8173. @end table
  8174. @section fftfilt
  8175. Apply arbitrary expressions to samples in frequency domain
  8176. @table @option
  8177. @item dc_Y
  8178. Adjust the dc value (gain) of the luma plane of the image. The filter
  8179. accepts an integer value in range @code{0} to @code{1000}. The default
  8180. value is set to @code{0}.
  8181. @item dc_U
  8182. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8183. filter accepts an integer value in range @code{0} to @code{1000}. The
  8184. default value is set to @code{0}.
  8185. @item dc_V
  8186. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8187. filter accepts an integer value in range @code{0} to @code{1000}. The
  8188. default value is set to @code{0}.
  8189. @item weight_Y
  8190. Set the frequency domain weight expression for the luma plane.
  8191. @item weight_U
  8192. Set the frequency domain weight expression for the 1st chroma plane.
  8193. @item weight_V
  8194. Set the frequency domain weight expression for the 2nd chroma plane.
  8195. @item eval
  8196. Set when the expressions are evaluated.
  8197. It accepts the following values:
  8198. @table @samp
  8199. @item init
  8200. Only evaluate expressions once during the filter initialization.
  8201. @item frame
  8202. Evaluate expressions for each incoming frame.
  8203. @end table
  8204. Default value is @samp{init}.
  8205. The filter accepts the following variables:
  8206. @item X
  8207. @item Y
  8208. The coordinates of the current sample.
  8209. @item W
  8210. @item H
  8211. The width and height of the image.
  8212. @item N
  8213. The number of input frame, starting from 0.
  8214. @end table
  8215. @subsection Examples
  8216. @itemize
  8217. @item
  8218. High-pass:
  8219. @example
  8220. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8221. @end example
  8222. @item
  8223. Low-pass:
  8224. @example
  8225. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8226. @end example
  8227. @item
  8228. Sharpen:
  8229. @example
  8230. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8231. @end example
  8232. @item
  8233. Blur:
  8234. @example
  8235. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8236. @end example
  8237. @end itemize
  8238. @section field
  8239. Extract a single field from an interlaced image using stride
  8240. arithmetic to avoid wasting CPU time. The output frames are marked as
  8241. non-interlaced.
  8242. The filter accepts the following options:
  8243. @table @option
  8244. @item type
  8245. Specify whether to extract the top (if the value is @code{0} or
  8246. @code{top}) or the bottom field (if the value is @code{1} or
  8247. @code{bottom}).
  8248. @end table
  8249. @section fieldhint
  8250. Create new frames by copying the top and bottom fields from surrounding frames
  8251. supplied as numbers by the hint file.
  8252. @table @option
  8253. @item hint
  8254. Set file containing hints: absolute/relative frame numbers.
  8255. There must be one line for each frame in a clip. Each line must contain two
  8256. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8257. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8258. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8259. for @code{relative} mode. First number tells from which frame to pick up top
  8260. field and second number tells from which frame to pick up bottom field.
  8261. If optionally followed by @code{+} output frame will be marked as interlaced,
  8262. else if followed by @code{-} output frame will be marked as progressive, else
  8263. it will be marked same as input frame.
  8264. If optionally followed by @code{t} output frame will use only top field, or in
  8265. case of @code{b} it will use only bottom field.
  8266. If line starts with @code{#} or @code{;} that line is skipped.
  8267. @item mode
  8268. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8269. @end table
  8270. Example of first several lines of @code{hint} file for @code{relative} mode:
  8271. @example
  8272. 0,0 - # first frame
  8273. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8274. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8275. 1,0 -
  8276. 0,0 -
  8277. 0,0 -
  8278. 1,0 -
  8279. 1,0 -
  8280. 1,0 -
  8281. 0,0 -
  8282. 0,0 -
  8283. 1,0 -
  8284. 1,0 -
  8285. 1,0 -
  8286. 0,0 -
  8287. @end example
  8288. @section fieldmatch
  8289. Field matching filter for inverse telecine. It is meant to reconstruct the
  8290. progressive frames from a telecined stream. The filter does not drop duplicated
  8291. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8292. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8293. The separation of the field matching and the decimation is notably motivated by
  8294. the possibility of inserting a de-interlacing filter fallback between the two.
  8295. If the source has mixed telecined and real interlaced content,
  8296. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8297. But these remaining combed frames will be marked as interlaced, and thus can be
  8298. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8299. In addition to the various configuration options, @code{fieldmatch} can take an
  8300. optional second stream, activated through the @option{ppsrc} option. If
  8301. enabled, the frames reconstruction will be based on the fields and frames from
  8302. this second stream. This allows the first input to be pre-processed in order to
  8303. help the various algorithms of the filter, while keeping the output lossless
  8304. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8305. or brightness/contrast adjustments can help.
  8306. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8307. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8308. which @code{fieldmatch} is based on. While the semantic and usage are very
  8309. close, some behaviour and options names can differ.
  8310. The @ref{decimate} filter currently only works for constant frame rate input.
  8311. If your input has mixed telecined (30fps) and progressive content with a lower
  8312. framerate like 24fps use the following filterchain to produce the necessary cfr
  8313. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8314. The filter accepts the following options:
  8315. @table @option
  8316. @item order
  8317. Specify the assumed field order of the input stream. Available values are:
  8318. @table @samp
  8319. @item auto
  8320. Auto detect parity (use FFmpeg's internal parity value).
  8321. @item bff
  8322. Assume bottom field first.
  8323. @item tff
  8324. Assume top field first.
  8325. @end table
  8326. Note that it is sometimes recommended not to trust the parity announced by the
  8327. stream.
  8328. Default value is @var{auto}.
  8329. @item mode
  8330. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8331. sense that it won't risk creating jerkiness due to duplicate frames when
  8332. possible, but if there are bad edits or blended fields it will end up
  8333. outputting combed frames when a good match might actually exist. On the other
  8334. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8335. but will almost always find a good frame if there is one. The other values are
  8336. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8337. jerkiness and creating duplicate frames versus finding good matches in sections
  8338. with bad edits, orphaned fields, blended fields, etc.
  8339. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8340. Available values are:
  8341. @table @samp
  8342. @item pc
  8343. 2-way matching (p/c)
  8344. @item pc_n
  8345. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8346. @item pc_u
  8347. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8348. @item pc_n_ub
  8349. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8350. still combed (p/c + n + u/b)
  8351. @item pcn
  8352. 3-way matching (p/c/n)
  8353. @item pcn_ub
  8354. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8355. detected as combed (p/c/n + u/b)
  8356. @end table
  8357. The parenthesis at the end indicate the matches that would be used for that
  8358. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8359. @var{top}).
  8360. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8361. the slowest.
  8362. Default value is @var{pc_n}.
  8363. @item ppsrc
  8364. Mark the main input stream as a pre-processed input, and enable the secondary
  8365. input stream as the clean source to pick the fields from. See the filter
  8366. introduction for more details. It is similar to the @option{clip2} feature from
  8367. VFM/TFM.
  8368. Default value is @code{0} (disabled).
  8369. @item field
  8370. Set the field to match from. It is recommended to set this to the same value as
  8371. @option{order} unless you experience matching failures with that setting. In
  8372. certain circumstances changing the field that is used to match from can have a
  8373. large impact on matching performance. Available values are:
  8374. @table @samp
  8375. @item auto
  8376. Automatic (same value as @option{order}).
  8377. @item bottom
  8378. Match from the bottom field.
  8379. @item top
  8380. Match from the top field.
  8381. @end table
  8382. Default value is @var{auto}.
  8383. @item mchroma
  8384. Set whether or not chroma is included during the match comparisons. In most
  8385. cases it is recommended to leave this enabled. You should set this to @code{0}
  8386. only if your clip has bad chroma problems such as heavy rainbowing or other
  8387. artifacts. Setting this to @code{0} could also be used to speed things up at
  8388. the cost of some accuracy.
  8389. Default value is @code{1}.
  8390. @item y0
  8391. @item y1
  8392. These define an exclusion band which excludes the lines between @option{y0} and
  8393. @option{y1} from being included in the field matching decision. An exclusion
  8394. band can be used to ignore subtitles, a logo, or other things that may
  8395. interfere with the matching. @option{y0} sets the starting scan line and
  8396. @option{y1} sets the ending line; all lines in between @option{y0} and
  8397. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8398. @option{y0} and @option{y1} to the same value will disable the feature.
  8399. @option{y0} and @option{y1} defaults to @code{0}.
  8400. @item scthresh
  8401. Set the scene change detection threshold as a percentage of maximum change on
  8402. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8403. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8404. @option{scthresh} is @code{[0.0, 100.0]}.
  8405. Default value is @code{12.0}.
  8406. @item combmatch
  8407. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8408. account the combed scores of matches when deciding what match to use as the
  8409. final match. Available values are:
  8410. @table @samp
  8411. @item none
  8412. No final matching based on combed scores.
  8413. @item sc
  8414. Combed scores are only used when a scene change is detected.
  8415. @item full
  8416. Use combed scores all the time.
  8417. @end table
  8418. Default is @var{sc}.
  8419. @item combdbg
  8420. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8421. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8422. Available values are:
  8423. @table @samp
  8424. @item none
  8425. No forced calculation.
  8426. @item pcn
  8427. Force p/c/n calculations.
  8428. @item pcnub
  8429. Force p/c/n/u/b calculations.
  8430. @end table
  8431. Default value is @var{none}.
  8432. @item cthresh
  8433. This is the area combing threshold used for combed frame detection. This
  8434. essentially controls how "strong" or "visible" combing must be to be detected.
  8435. Larger values mean combing must be more visible and smaller values mean combing
  8436. can be less visible or strong and still be detected. Valid settings are from
  8437. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8438. be detected as combed). This is basically a pixel difference value. A good
  8439. range is @code{[8, 12]}.
  8440. Default value is @code{9}.
  8441. @item chroma
  8442. Sets whether or not chroma is considered in the combed frame decision. Only
  8443. disable this if your source has chroma problems (rainbowing, etc.) that are
  8444. causing problems for the combed frame detection with chroma enabled. Actually,
  8445. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8446. where there is chroma only combing in the source.
  8447. Default value is @code{0}.
  8448. @item blockx
  8449. @item blocky
  8450. Respectively set the x-axis and y-axis size of the window used during combed
  8451. frame detection. This has to do with the size of the area in which
  8452. @option{combpel} pixels are required to be detected as combed for a frame to be
  8453. declared combed. See the @option{combpel} parameter description for more info.
  8454. Possible values are any number that is a power of 2 starting at 4 and going up
  8455. to 512.
  8456. Default value is @code{16}.
  8457. @item combpel
  8458. The number of combed pixels inside any of the @option{blocky} by
  8459. @option{blockx} size blocks on the frame for the frame to be detected as
  8460. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8461. setting controls "how much" combing there must be in any localized area (a
  8462. window defined by the @option{blockx} and @option{blocky} settings) on the
  8463. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8464. which point no frames will ever be detected as combed). This setting is known
  8465. as @option{MI} in TFM/VFM vocabulary.
  8466. Default value is @code{80}.
  8467. @end table
  8468. @anchor{p/c/n/u/b meaning}
  8469. @subsection p/c/n/u/b meaning
  8470. @subsubsection p/c/n
  8471. We assume the following telecined stream:
  8472. @example
  8473. Top fields: 1 2 2 3 4
  8474. Bottom fields: 1 2 3 4 4
  8475. @end example
  8476. The numbers correspond to the progressive frame the fields relate to. Here, the
  8477. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8478. When @code{fieldmatch} is configured to run a matching from bottom
  8479. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8480. @example
  8481. Input stream:
  8482. T 1 2 2 3 4
  8483. B 1 2 3 4 4 <-- matching reference
  8484. Matches: c c n n c
  8485. Output stream:
  8486. T 1 2 3 4 4
  8487. B 1 2 3 4 4
  8488. @end example
  8489. As a result of the field matching, we can see that some frames get duplicated.
  8490. To perform a complete inverse telecine, you need to rely on a decimation filter
  8491. after this operation. See for instance the @ref{decimate} filter.
  8492. The same operation now matching from top fields (@option{field}=@var{top})
  8493. looks like this:
  8494. @example
  8495. Input stream:
  8496. T 1 2 2 3 4 <-- matching reference
  8497. B 1 2 3 4 4
  8498. Matches: c c p p c
  8499. Output stream:
  8500. T 1 2 2 3 4
  8501. B 1 2 2 3 4
  8502. @end example
  8503. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8504. basically, they refer to the frame and field of the opposite parity:
  8505. @itemize
  8506. @item @var{p} matches the field of the opposite parity in the previous frame
  8507. @item @var{c} matches the field of the opposite parity in the current frame
  8508. @item @var{n} matches the field of the opposite parity in the next frame
  8509. @end itemize
  8510. @subsubsection u/b
  8511. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8512. from the opposite parity flag. In the following examples, we assume that we are
  8513. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8514. 'x' is placed above and below each matched fields.
  8515. With bottom matching (@option{field}=@var{bottom}):
  8516. @example
  8517. Match: c p n b u
  8518. x x x x x
  8519. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8520. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8521. x x x x x
  8522. Output frames:
  8523. 2 1 2 2 2
  8524. 2 2 2 1 3
  8525. @end example
  8526. With top matching (@option{field}=@var{top}):
  8527. @example
  8528. Match: c p n b u
  8529. x x x x x
  8530. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8531. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8532. x x x x x
  8533. Output frames:
  8534. 2 2 2 1 2
  8535. 2 1 3 2 2
  8536. @end example
  8537. @subsection Examples
  8538. Simple IVTC of a top field first telecined stream:
  8539. @example
  8540. fieldmatch=order=tff:combmatch=none, decimate
  8541. @end example
  8542. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8543. @example
  8544. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8545. @end example
  8546. @section fieldorder
  8547. Transform the field order of the input video.
  8548. It accepts the following parameters:
  8549. @table @option
  8550. @item order
  8551. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8552. for bottom field first.
  8553. @end table
  8554. The default value is @samp{tff}.
  8555. The transformation is done by shifting the picture content up or down
  8556. by one line, and filling the remaining line with appropriate picture content.
  8557. This method is consistent with most broadcast field order converters.
  8558. If the input video is not flagged as being interlaced, or it is already
  8559. flagged as being of the required output field order, then this filter does
  8560. not alter the incoming video.
  8561. It is very useful when converting to or from PAL DV material,
  8562. which is bottom field first.
  8563. For example:
  8564. @example
  8565. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8566. @end example
  8567. @section fifo, afifo
  8568. Buffer input images and send them when they are requested.
  8569. It is mainly useful when auto-inserted by the libavfilter
  8570. framework.
  8571. It does not take parameters.
  8572. @section fillborders
  8573. Fill borders of the input video, without changing video stream dimensions.
  8574. Sometimes video can have garbage at the four edges and you may not want to
  8575. crop video input to keep size multiple of some number.
  8576. This filter accepts the following options:
  8577. @table @option
  8578. @item left
  8579. Number of pixels to fill from left border.
  8580. @item right
  8581. Number of pixels to fill from right border.
  8582. @item top
  8583. Number of pixels to fill from top border.
  8584. @item bottom
  8585. Number of pixels to fill from bottom border.
  8586. @item mode
  8587. Set fill mode.
  8588. It accepts the following values:
  8589. @table @samp
  8590. @item smear
  8591. fill pixels using outermost pixels
  8592. @item mirror
  8593. fill pixels using mirroring
  8594. @item fixed
  8595. fill pixels with constant value
  8596. @end table
  8597. Default is @var{smear}.
  8598. @item color
  8599. Set color for pixels in fixed mode. Default is @var{black}.
  8600. @end table
  8601. @subsection Commands
  8602. This filter supports same @ref{commands} as options.
  8603. The command accepts the same syntax of the corresponding option.
  8604. If the specified expression is not valid, it is kept at its current
  8605. value.
  8606. @section find_rect
  8607. Find a rectangular object
  8608. It accepts the following options:
  8609. @table @option
  8610. @item object
  8611. Filepath of the object image, needs to be in gray8.
  8612. @item threshold
  8613. Detection threshold, default is 0.5.
  8614. @item mipmaps
  8615. Number of mipmaps, default is 3.
  8616. @item xmin, ymin, xmax, ymax
  8617. Specifies the rectangle in which to search.
  8618. @end table
  8619. @subsection Examples
  8620. @itemize
  8621. @item
  8622. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8623. @example
  8624. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8625. @end example
  8626. @end itemize
  8627. @section floodfill
  8628. Flood area with values of same pixel components with another values.
  8629. It accepts the following options:
  8630. @table @option
  8631. @item x
  8632. Set pixel x coordinate.
  8633. @item y
  8634. Set pixel y coordinate.
  8635. @item s0
  8636. Set source #0 component value.
  8637. @item s1
  8638. Set source #1 component value.
  8639. @item s2
  8640. Set source #2 component value.
  8641. @item s3
  8642. Set source #3 component value.
  8643. @item d0
  8644. Set destination #0 component value.
  8645. @item d1
  8646. Set destination #1 component value.
  8647. @item d2
  8648. Set destination #2 component value.
  8649. @item d3
  8650. Set destination #3 component value.
  8651. @end table
  8652. @anchor{format}
  8653. @section format
  8654. Convert the input video to one of the specified pixel formats.
  8655. Libavfilter will try to pick one that is suitable as input to
  8656. the next filter.
  8657. It accepts the following parameters:
  8658. @table @option
  8659. @item pix_fmts
  8660. A '|'-separated list of pixel format names, such as
  8661. "pix_fmts=yuv420p|monow|rgb24".
  8662. @end table
  8663. @subsection Examples
  8664. @itemize
  8665. @item
  8666. Convert the input video to the @var{yuv420p} format
  8667. @example
  8668. format=pix_fmts=yuv420p
  8669. @end example
  8670. Convert the input video to any of the formats in the list
  8671. @example
  8672. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8673. @end example
  8674. @end itemize
  8675. @anchor{fps}
  8676. @section fps
  8677. Convert the video to specified constant frame rate by duplicating or dropping
  8678. frames as necessary.
  8679. It accepts the following parameters:
  8680. @table @option
  8681. @item fps
  8682. The desired output frame rate. The default is @code{25}.
  8683. @item start_time
  8684. Assume the first PTS should be the given value, in seconds. This allows for
  8685. padding/trimming at the start of stream. By default, no assumption is made
  8686. about the first frame's expected PTS, so no padding or trimming is done.
  8687. For example, this could be set to 0 to pad the beginning with duplicates of
  8688. the first frame if a video stream starts after the audio stream or to trim any
  8689. frames with a negative PTS.
  8690. @item round
  8691. Timestamp (PTS) rounding method.
  8692. Possible values are:
  8693. @table @option
  8694. @item zero
  8695. round towards 0
  8696. @item inf
  8697. round away from 0
  8698. @item down
  8699. round towards -infinity
  8700. @item up
  8701. round towards +infinity
  8702. @item near
  8703. round to nearest
  8704. @end table
  8705. The default is @code{near}.
  8706. @item eof_action
  8707. Action performed when reading the last frame.
  8708. Possible values are:
  8709. @table @option
  8710. @item round
  8711. Use same timestamp rounding method as used for other frames.
  8712. @item pass
  8713. Pass through last frame if input duration has not been reached yet.
  8714. @end table
  8715. The default is @code{round}.
  8716. @end table
  8717. Alternatively, the options can be specified as a flat string:
  8718. @var{fps}[:@var{start_time}[:@var{round}]].
  8719. See also the @ref{setpts} filter.
  8720. @subsection Examples
  8721. @itemize
  8722. @item
  8723. A typical usage in order to set the fps to 25:
  8724. @example
  8725. fps=fps=25
  8726. @end example
  8727. @item
  8728. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8729. @example
  8730. fps=fps=film:round=near
  8731. @end example
  8732. @end itemize
  8733. @section framepack
  8734. Pack two different video streams into a stereoscopic video, setting proper
  8735. metadata on supported codecs. The two views should have the same size and
  8736. framerate and processing will stop when the shorter video ends. Please note
  8737. that you may conveniently adjust view properties with the @ref{scale} and
  8738. @ref{fps} filters.
  8739. It accepts the following parameters:
  8740. @table @option
  8741. @item format
  8742. The desired packing format. Supported values are:
  8743. @table @option
  8744. @item sbs
  8745. The views are next to each other (default).
  8746. @item tab
  8747. The views are on top of each other.
  8748. @item lines
  8749. The views are packed by line.
  8750. @item columns
  8751. The views are packed by column.
  8752. @item frameseq
  8753. The views are temporally interleaved.
  8754. @end table
  8755. @end table
  8756. Some examples:
  8757. @example
  8758. # Convert left and right views into a frame-sequential video
  8759. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8760. # Convert views into a side-by-side video with the same output resolution as the input
  8761. 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
  8762. @end example
  8763. @section framerate
  8764. Change the frame rate by interpolating new video output frames from the source
  8765. frames.
  8766. This filter is not designed to function correctly with interlaced media. If
  8767. you wish to change the frame rate of interlaced media then you are required
  8768. to deinterlace before this filter and re-interlace after this filter.
  8769. A description of the accepted options follows.
  8770. @table @option
  8771. @item fps
  8772. Specify the output frames per second. This option can also be specified
  8773. as a value alone. The default is @code{50}.
  8774. @item interp_start
  8775. Specify the start of a range where the output frame will be created as a
  8776. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8777. the default is @code{15}.
  8778. @item interp_end
  8779. Specify the end of a range where the output frame will be created as a
  8780. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8781. the default is @code{240}.
  8782. @item scene
  8783. Specify the level at which a scene change is detected as a value between
  8784. 0 and 100 to indicate a new scene; a low value reflects a low
  8785. probability for the current frame to introduce a new scene, while a higher
  8786. value means the current frame is more likely to be one.
  8787. The default is @code{8.2}.
  8788. @item flags
  8789. Specify flags influencing the filter process.
  8790. Available value for @var{flags} is:
  8791. @table @option
  8792. @item scene_change_detect, scd
  8793. Enable scene change detection using the value of the option @var{scene}.
  8794. This flag is enabled by default.
  8795. @end table
  8796. @end table
  8797. @section framestep
  8798. Select one frame every N-th frame.
  8799. This filter accepts the following option:
  8800. @table @option
  8801. @item step
  8802. Select frame after every @code{step} frames.
  8803. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8804. @end table
  8805. @section freezedetect
  8806. Detect frozen video.
  8807. This filter logs a message and sets frame metadata when it detects that the
  8808. input video has no significant change in content during a specified duration.
  8809. Video freeze detection calculates the mean average absolute difference of all
  8810. the components of video frames and compares it to a noise floor.
  8811. The printed times and duration are expressed in seconds. The
  8812. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8813. whose timestamp equals or exceeds the detection duration and it contains the
  8814. timestamp of the first frame of the freeze. The
  8815. @code{lavfi.freezedetect.freeze_duration} and
  8816. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8817. after the freeze.
  8818. The filter accepts the following options:
  8819. @table @option
  8820. @item noise, n
  8821. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8822. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8823. 0.001.
  8824. @item duration, d
  8825. Set freeze duration until notification (default is 2 seconds).
  8826. @end table
  8827. @section freezeframes
  8828. Freeze video frames.
  8829. This filter freezes video frames using frame from 2nd input.
  8830. The filter accepts the following options:
  8831. @table @option
  8832. @item first
  8833. Set number of first frame from which to start freeze.
  8834. @item last
  8835. Set number of last frame from which to end freeze.
  8836. @item replace
  8837. Set number of frame from 2nd input which will be used instead of replaced frames.
  8838. @end table
  8839. @anchor{frei0r}
  8840. @section frei0r
  8841. Apply a frei0r effect to the input video.
  8842. To enable the compilation of this filter, you need to install the frei0r
  8843. header and configure FFmpeg with @code{--enable-frei0r}.
  8844. It accepts the following parameters:
  8845. @table @option
  8846. @item filter_name
  8847. The name of the frei0r effect to load. If the environment variable
  8848. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8849. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8850. Otherwise, the standard frei0r paths are searched, in this order:
  8851. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8852. @file{/usr/lib/frei0r-1/}.
  8853. @item filter_params
  8854. A '|'-separated list of parameters to pass to the frei0r effect.
  8855. @end table
  8856. A frei0r effect parameter can be a boolean (its value is either
  8857. "y" or "n"), a double, a color (specified as
  8858. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8859. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8860. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8861. a position (specified as @var{X}/@var{Y}, where
  8862. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8863. The number and types of parameters depend on the loaded effect. If an
  8864. effect parameter is not specified, the default value is set.
  8865. @subsection Examples
  8866. @itemize
  8867. @item
  8868. Apply the distort0r effect, setting the first two double parameters:
  8869. @example
  8870. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8871. @end example
  8872. @item
  8873. Apply the colordistance effect, taking a color as the first parameter:
  8874. @example
  8875. frei0r=colordistance:0.2/0.3/0.4
  8876. frei0r=colordistance:violet
  8877. frei0r=colordistance:0x112233
  8878. @end example
  8879. @item
  8880. Apply the perspective effect, specifying the top left and top right image
  8881. positions:
  8882. @example
  8883. frei0r=perspective:0.2/0.2|0.8/0.2
  8884. @end example
  8885. @end itemize
  8886. For more information, see
  8887. @url{http://frei0r.dyne.org}
  8888. @section fspp
  8889. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8890. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8891. processing filter, one of them is performed once per block, not per pixel.
  8892. This allows for much higher speed.
  8893. The filter accepts the following options:
  8894. @table @option
  8895. @item quality
  8896. Set quality. This option defines the number of levels for averaging. It accepts
  8897. an integer in the range 4-5. Default value is @code{4}.
  8898. @item qp
  8899. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8900. If not set, the filter will use the QP from the video stream (if available).
  8901. @item strength
  8902. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8903. more details but also more artifacts, while higher values make the image smoother
  8904. but also blurrier. Default value is @code{0} − PSNR optimal.
  8905. @item use_bframe_qp
  8906. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8907. option may cause flicker since the B-Frames have often larger QP. Default is
  8908. @code{0} (not enabled).
  8909. @end table
  8910. @section gblur
  8911. Apply Gaussian blur filter.
  8912. The filter accepts the following options:
  8913. @table @option
  8914. @item sigma
  8915. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8916. @item steps
  8917. Set number of steps for Gaussian approximation. Default is @code{1}.
  8918. @item planes
  8919. Set which planes to filter. By default all planes are filtered.
  8920. @item sigmaV
  8921. Set vertical sigma, if negative it will be same as @code{sigma}.
  8922. Default is @code{-1}.
  8923. @end table
  8924. @subsection Commands
  8925. This filter supports same commands as options.
  8926. The command accepts the same syntax of the corresponding option.
  8927. If the specified expression is not valid, it is kept at its current
  8928. value.
  8929. @section geq
  8930. Apply generic equation to each pixel.
  8931. The filter accepts the following options:
  8932. @table @option
  8933. @item lum_expr, lum
  8934. Set the luminance expression.
  8935. @item cb_expr, cb
  8936. Set the chrominance blue expression.
  8937. @item cr_expr, cr
  8938. Set the chrominance red expression.
  8939. @item alpha_expr, a
  8940. Set the alpha expression.
  8941. @item red_expr, r
  8942. Set the red expression.
  8943. @item green_expr, g
  8944. Set the green expression.
  8945. @item blue_expr, b
  8946. Set the blue expression.
  8947. @end table
  8948. The colorspace is selected according to the specified options. If one
  8949. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8950. options is specified, the filter will automatically select a YCbCr
  8951. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8952. @option{blue_expr} options is specified, it will select an RGB
  8953. colorspace.
  8954. If one of the chrominance expression is not defined, it falls back on the other
  8955. one. If no alpha expression is specified it will evaluate to opaque value.
  8956. If none of chrominance expressions are specified, they will evaluate
  8957. to the luminance expression.
  8958. The expressions can use the following variables and functions:
  8959. @table @option
  8960. @item N
  8961. The sequential number of the filtered frame, starting from @code{0}.
  8962. @item X
  8963. @item Y
  8964. The coordinates of the current sample.
  8965. @item W
  8966. @item H
  8967. The width and height of the image.
  8968. @item SW
  8969. @item SH
  8970. Width and height scale depending on the currently filtered plane. It is the
  8971. ratio between the corresponding luma plane number of pixels and the current
  8972. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8973. @code{0.5,0.5} for chroma planes.
  8974. @item T
  8975. Time of the current frame, expressed in seconds.
  8976. @item p(x, y)
  8977. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8978. plane.
  8979. @item lum(x, y)
  8980. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8981. plane.
  8982. @item cb(x, y)
  8983. Return the value of the pixel at location (@var{x},@var{y}) of the
  8984. blue-difference chroma plane. Return 0 if there is no such plane.
  8985. @item cr(x, y)
  8986. Return the value of the pixel at location (@var{x},@var{y}) of the
  8987. red-difference chroma plane. Return 0 if there is no such plane.
  8988. @item r(x, y)
  8989. @item g(x, y)
  8990. @item b(x, y)
  8991. Return the value of the pixel at location (@var{x},@var{y}) of the
  8992. red/green/blue component. Return 0 if there is no such component.
  8993. @item alpha(x, y)
  8994. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8995. plane. Return 0 if there is no such plane.
  8996. @item psum(x,y), lumsum(x, y), cbsum(x,y), crsum(x,y), rsum(x,y), gsum(x,y), bsum(x,y), alphasum(x,y)
  8997. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  8998. sums of samples within a rectangle. See the functions without the sum postfix.
  8999. @item interpolation
  9000. Set one of interpolation methods:
  9001. @table @option
  9002. @item nearest, n
  9003. @item bilinear, b
  9004. @end table
  9005. Default is bilinear.
  9006. @end table
  9007. For functions, if @var{x} and @var{y} are outside the area, the value will be
  9008. automatically clipped to the closer edge.
  9009. Please note that this filter can use multiple threads in which case each slice
  9010. will have its own expression state. If you want to use only a single expression
  9011. state because your expressions depend on previous state then you should limit
  9012. the number of filter threads to 1.
  9013. @subsection Examples
  9014. @itemize
  9015. @item
  9016. Flip the image horizontally:
  9017. @example
  9018. geq=p(W-X\,Y)
  9019. @end example
  9020. @item
  9021. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  9022. wavelength of 100 pixels:
  9023. @example
  9024. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  9025. @end example
  9026. @item
  9027. Generate a fancy enigmatic moving light:
  9028. @example
  9029. 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
  9030. @end example
  9031. @item
  9032. Generate a quick emboss effect:
  9033. @example
  9034. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  9035. @end example
  9036. @item
  9037. Modify RGB components depending on pixel position:
  9038. @example
  9039. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  9040. @end example
  9041. @item
  9042. Create a radial gradient that is the same size as the input (also see
  9043. the @ref{vignette} filter):
  9044. @example
  9045. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  9046. @end example
  9047. @end itemize
  9048. @section gradfun
  9049. Fix the banding artifacts that are sometimes introduced into nearly flat
  9050. regions by truncation to 8-bit color depth.
  9051. Interpolate the gradients that should go where the bands are, and
  9052. dither them.
  9053. It is designed for playback only. Do not use it prior to
  9054. lossy compression, because compression tends to lose the dither and
  9055. bring back the bands.
  9056. It accepts the following parameters:
  9057. @table @option
  9058. @item strength
  9059. The maximum amount by which the filter will change any one pixel. This is also
  9060. the threshold for detecting nearly flat regions. Acceptable values range from
  9061. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  9062. valid range.
  9063. @item radius
  9064. The neighborhood to fit the gradient to. A larger radius makes for smoother
  9065. gradients, but also prevents the filter from modifying the pixels near detailed
  9066. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  9067. values will be clipped to the valid range.
  9068. @end table
  9069. Alternatively, the options can be specified as a flat string:
  9070. @var{strength}[:@var{radius}]
  9071. @subsection Examples
  9072. @itemize
  9073. @item
  9074. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  9075. @example
  9076. gradfun=3.5:8
  9077. @end example
  9078. @item
  9079. Specify radius, omitting the strength (which will fall-back to the default
  9080. value):
  9081. @example
  9082. gradfun=radius=8
  9083. @end example
  9084. @end itemize
  9085. @anchor{graphmonitor}
  9086. @section graphmonitor
  9087. Show various filtergraph stats.
  9088. With this filter one can debug complete filtergraph.
  9089. Especially issues with links filling with queued frames.
  9090. The filter accepts the following options:
  9091. @table @option
  9092. @item size, s
  9093. Set video output size. Default is @var{hd720}.
  9094. @item opacity, o
  9095. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  9096. @item mode, m
  9097. Set output mode, can be @var{fulll} or @var{compact}.
  9098. In @var{compact} mode only filters with some queued frames have displayed stats.
  9099. @item flags, f
  9100. Set flags which enable which stats are shown in video.
  9101. Available values for flags are:
  9102. @table @samp
  9103. @item queue
  9104. Display number of queued frames in each link.
  9105. @item frame_count_in
  9106. Display number of frames taken from filter.
  9107. @item frame_count_out
  9108. Display number of frames given out from filter.
  9109. @item pts
  9110. Display current filtered frame pts.
  9111. @item time
  9112. Display current filtered frame time.
  9113. @item timebase
  9114. Display time base for filter link.
  9115. @item format
  9116. Display used format for filter link.
  9117. @item size
  9118. Display video size or number of audio channels in case of audio used by filter link.
  9119. @item rate
  9120. Display video frame rate or sample rate in case of audio used by filter link.
  9121. @item eof
  9122. Display link output status.
  9123. @end table
  9124. @item rate, r
  9125. Set upper limit for video rate of output stream, Default value is @var{25}.
  9126. This guarantee that output video frame rate will not be higher than this value.
  9127. @end table
  9128. @section greyedge
  9129. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  9130. and corrects the scene colors accordingly.
  9131. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  9132. The filter accepts the following options:
  9133. @table @option
  9134. @item difford
  9135. The order of differentiation to be applied on the scene. Must be chosen in the range
  9136. [0,2] and default value is 1.
  9137. @item minknorm
  9138. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  9139. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  9140. max value instead of calculating Minkowski distance.
  9141. @item sigma
  9142. The standard deviation of Gaussian blur to be applied on the scene. Must be
  9143. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  9144. can't be equal to 0 if @var{difford} is greater than 0.
  9145. @end table
  9146. @subsection Examples
  9147. @itemize
  9148. @item
  9149. Grey Edge:
  9150. @example
  9151. greyedge=difford=1:minknorm=5:sigma=2
  9152. @end example
  9153. @item
  9154. Max Edge:
  9155. @example
  9156. greyedge=difford=1:minknorm=0:sigma=2
  9157. @end example
  9158. @end itemize
  9159. @anchor{haldclut}
  9160. @section haldclut
  9161. Apply a Hald CLUT to a video stream.
  9162. First input is the video stream to process, and second one is the Hald CLUT.
  9163. The Hald CLUT input can be a simple picture or a complete video stream.
  9164. The filter accepts the following options:
  9165. @table @option
  9166. @item shortest
  9167. Force termination when the shortest input terminates. Default is @code{0}.
  9168. @item repeatlast
  9169. Continue applying the last CLUT after the end of the stream. A value of
  9170. @code{0} disable the filter after the last frame of the CLUT is reached.
  9171. Default is @code{1}.
  9172. @end table
  9173. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9174. filters share the same internals).
  9175. This filter also supports the @ref{framesync} options.
  9176. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9177. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9178. @subsection Workflow examples
  9179. @subsubsection Hald CLUT video stream
  9180. Generate an identity Hald CLUT stream altered with various effects:
  9181. @example
  9182. 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
  9183. @end example
  9184. Note: make sure you use a lossless codec.
  9185. Then use it with @code{haldclut} to apply it on some random stream:
  9186. @example
  9187. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9188. @end example
  9189. The Hald CLUT will be applied to the 10 first seconds (duration of
  9190. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9191. to the remaining frames of the @code{mandelbrot} stream.
  9192. @subsubsection Hald CLUT with preview
  9193. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9194. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9195. biggest possible square starting at the top left of the picture. The remaining
  9196. padding pixels (bottom or right) will be ignored. This area can be used to add
  9197. a preview of the Hald CLUT.
  9198. Typically, the following generated Hald CLUT will be supported by the
  9199. @code{haldclut} filter:
  9200. @example
  9201. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9202. pad=iw+320 [padded_clut];
  9203. smptebars=s=320x256, split [a][b];
  9204. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9205. [main][b] overlay=W-320" -frames:v 1 clut.png
  9206. @end example
  9207. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9208. bars are displayed on the right-top, and below the same color bars processed by
  9209. the color changes.
  9210. Then, the effect of this Hald CLUT can be visualized with:
  9211. @example
  9212. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9213. @end example
  9214. @section hflip
  9215. Flip the input video horizontally.
  9216. For example, to horizontally flip the input video with @command{ffmpeg}:
  9217. @example
  9218. ffmpeg -i in.avi -vf "hflip" out.avi
  9219. @end example
  9220. @section histeq
  9221. This filter applies a global color histogram equalization on a
  9222. per-frame basis.
  9223. It can be used to correct video that has a compressed range of pixel
  9224. intensities. The filter redistributes the pixel intensities to
  9225. equalize their distribution across the intensity range. It may be
  9226. viewed as an "automatically adjusting contrast filter". This filter is
  9227. useful only for correcting degraded or poorly captured source
  9228. video.
  9229. The filter accepts the following options:
  9230. @table @option
  9231. @item strength
  9232. Determine the amount of equalization to be applied. As the strength
  9233. is reduced, the distribution of pixel intensities more-and-more
  9234. approaches that of the input frame. The value must be a float number
  9235. in the range [0,1] and defaults to 0.200.
  9236. @item intensity
  9237. Set the maximum intensity that can generated and scale the output
  9238. values appropriately. The strength should be set as desired and then
  9239. the intensity can be limited if needed to avoid washing-out. The value
  9240. must be a float number in the range [0,1] and defaults to 0.210.
  9241. @item antibanding
  9242. Set the antibanding level. If enabled the filter will randomly vary
  9243. the luminance of output pixels by a small amount to avoid banding of
  9244. the histogram. Possible values are @code{none}, @code{weak} or
  9245. @code{strong}. It defaults to @code{none}.
  9246. @end table
  9247. @anchor{histogram}
  9248. @section histogram
  9249. Compute and draw a color distribution histogram for the input video.
  9250. The computed histogram is a representation of the color component
  9251. distribution in an image.
  9252. Standard histogram displays the color components distribution in an image.
  9253. Displays color graph for each color component. Shows distribution of
  9254. the Y, U, V, A or R, G, B components, depending on input format, in the
  9255. current frame. Below each graph a color component scale meter is shown.
  9256. The filter accepts the following options:
  9257. @table @option
  9258. @item level_height
  9259. Set height of level. Default value is @code{200}.
  9260. Allowed range is [50, 2048].
  9261. @item scale_height
  9262. Set height of color scale. Default value is @code{12}.
  9263. Allowed range is [0, 40].
  9264. @item display_mode
  9265. Set display mode.
  9266. It accepts the following values:
  9267. @table @samp
  9268. @item stack
  9269. Per color component graphs are placed below each other.
  9270. @item parade
  9271. Per color component graphs are placed side by side.
  9272. @item overlay
  9273. Presents information identical to that in the @code{parade}, except
  9274. that the graphs representing color components are superimposed directly
  9275. over one another.
  9276. @end table
  9277. Default is @code{stack}.
  9278. @item levels_mode
  9279. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9280. Default is @code{linear}.
  9281. @item components
  9282. Set what color components to display.
  9283. Default is @code{7}.
  9284. @item fgopacity
  9285. Set foreground opacity. Default is @code{0.7}.
  9286. @item bgopacity
  9287. Set background opacity. Default is @code{0.5}.
  9288. @end table
  9289. @subsection Examples
  9290. @itemize
  9291. @item
  9292. Calculate and draw histogram:
  9293. @example
  9294. ffplay -i input -vf histogram
  9295. @end example
  9296. @end itemize
  9297. @anchor{hqdn3d}
  9298. @section hqdn3d
  9299. This is a high precision/quality 3d denoise filter. It aims to reduce
  9300. image noise, producing smooth images and making still images really
  9301. still. It should enhance compressibility.
  9302. It accepts the following optional parameters:
  9303. @table @option
  9304. @item luma_spatial
  9305. A non-negative floating point number which specifies spatial luma strength.
  9306. It defaults to 4.0.
  9307. @item chroma_spatial
  9308. A non-negative floating point number which specifies spatial chroma strength.
  9309. It defaults to 3.0*@var{luma_spatial}/4.0.
  9310. @item luma_tmp
  9311. A floating point number which specifies luma temporal strength. It defaults to
  9312. 6.0*@var{luma_spatial}/4.0.
  9313. @item chroma_tmp
  9314. A floating point number which specifies chroma temporal strength. It defaults to
  9315. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9316. @end table
  9317. @subsection Commands
  9318. This filter supports same @ref{commands} as options.
  9319. The command accepts the same syntax of the corresponding option.
  9320. If the specified expression is not valid, it is kept at its current
  9321. value.
  9322. @anchor{hwdownload}
  9323. @section hwdownload
  9324. Download hardware frames to system memory.
  9325. The input must be in hardware frames, and the output a non-hardware format.
  9326. Not all formats will be supported on the output - it may be necessary to insert
  9327. an additional @option{format} filter immediately following in the graph to get
  9328. the output in a supported format.
  9329. @section hwmap
  9330. Map hardware frames to system memory or to another device.
  9331. This filter has several different modes of operation; which one is used depends
  9332. on the input and output formats:
  9333. @itemize
  9334. @item
  9335. Hardware frame input, normal frame output
  9336. Map the input frames to system memory and pass them to the output. If the
  9337. original hardware frame is later required (for example, after overlaying
  9338. something else on part of it), the @option{hwmap} filter can be used again
  9339. in the next mode to retrieve it.
  9340. @item
  9341. Normal frame input, hardware frame output
  9342. If the input is actually a software-mapped hardware frame, then unmap it -
  9343. that is, return the original hardware frame.
  9344. Otherwise, a device must be provided. Create new hardware surfaces on that
  9345. device for the output, then map them back to the software format at the input
  9346. and give those frames to the preceding filter. This will then act like the
  9347. @option{hwupload} filter, but may be able to avoid an additional copy when
  9348. the input is already in a compatible format.
  9349. @item
  9350. Hardware frame input and output
  9351. A device must be supplied for the output, either directly or with the
  9352. @option{derive_device} option. The input and output devices must be of
  9353. different types and compatible - the exact meaning of this is
  9354. system-dependent, but typically it means that they must refer to the same
  9355. underlying hardware context (for example, refer to the same graphics card).
  9356. If the input frames were originally created on the output device, then unmap
  9357. to retrieve the original frames.
  9358. Otherwise, map the frames to the output device - create new hardware frames
  9359. on the output corresponding to the frames on the input.
  9360. @end itemize
  9361. The following additional parameters are accepted:
  9362. @table @option
  9363. @item mode
  9364. Set the frame mapping mode. Some combination of:
  9365. @table @var
  9366. @item read
  9367. The mapped frame should be readable.
  9368. @item write
  9369. The mapped frame should be writeable.
  9370. @item overwrite
  9371. The mapping will always overwrite the entire frame.
  9372. This may improve performance in some cases, as the original contents of the
  9373. frame need not be loaded.
  9374. @item direct
  9375. The mapping must not involve any copying.
  9376. Indirect mappings to copies of frames are created in some cases where either
  9377. direct mapping is not possible or it would have unexpected properties.
  9378. Setting this flag ensures that the mapping is direct and will fail if that is
  9379. not possible.
  9380. @end table
  9381. Defaults to @var{read+write} if not specified.
  9382. @item derive_device @var{type}
  9383. Rather than using the device supplied at initialisation, instead derive a new
  9384. device of type @var{type} from the device the input frames exist on.
  9385. @item reverse
  9386. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9387. and map them back to the source. This may be necessary in some cases where
  9388. a mapping in one direction is required but only the opposite direction is
  9389. supported by the devices being used.
  9390. This option is dangerous - it may break the preceding filter in undefined
  9391. ways if there are any additional constraints on that filter's output.
  9392. Do not use it without fully understanding the implications of its use.
  9393. @end table
  9394. @anchor{hwupload}
  9395. @section hwupload
  9396. Upload system memory frames to hardware surfaces.
  9397. The device to upload to must be supplied when the filter is initialised. If
  9398. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9399. option or with the @option{derive_device} option. The input and output devices
  9400. must be of different types and compatible - the exact meaning of this is
  9401. system-dependent, but typically it means that they must refer to the same
  9402. underlying hardware context (for example, refer to the same graphics card).
  9403. The following additional parameters are accepted:
  9404. @table @option
  9405. @item derive_device @var{type}
  9406. Rather than using the device supplied at initialisation, instead derive a new
  9407. device of type @var{type} from the device the input frames exist on.
  9408. @end table
  9409. @anchor{hwupload_cuda}
  9410. @section hwupload_cuda
  9411. Upload system memory frames to a CUDA device.
  9412. It accepts the following optional parameters:
  9413. @table @option
  9414. @item device
  9415. The number of the CUDA device to use
  9416. @end table
  9417. @section hqx
  9418. Apply a high-quality magnification filter designed for pixel art. This filter
  9419. was originally created by Maxim Stepin.
  9420. It accepts the following option:
  9421. @table @option
  9422. @item n
  9423. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9424. @code{hq3x} and @code{4} for @code{hq4x}.
  9425. Default is @code{3}.
  9426. @end table
  9427. @section hstack
  9428. Stack input videos horizontally.
  9429. All streams must be of same pixel format and of same height.
  9430. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9431. to create same output.
  9432. The filter accepts the following option:
  9433. @table @option
  9434. @item inputs
  9435. Set number of input streams. Default is 2.
  9436. @item shortest
  9437. If set to 1, force the output to terminate when the shortest input
  9438. terminates. Default value is 0.
  9439. @end table
  9440. @section hue
  9441. Modify the hue and/or the saturation of the input.
  9442. It accepts the following parameters:
  9443. @table @option
  9444. @item h
  9445. Specify the hue angle as a number of degrees. It accepts an expression,
  9446. and defaults to "0".
  9447. @item s
  9448. Specify the saturation in the [-10,10] range. It accepts an expression and
  9449. defaults to "1".
  9450. @item H
  9451. Specify the hue angle as a number of radians. It accepts an
  9452. expression, and defaults to "0".
  9453. @item b
  9454. Specify the brightness in the [-10,10] range. It accepts an expression and
  9455. defaults to "0".
  9456. @end table
  9457. @option{h} and @option{H} are mutually exclusive, and can't be
  9458. specified at the same time.
  9459. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9460. expressions containing the following constants:
  9461. @table @option
  9462. @item n
  9463. frame count of the input frame starting from 0
  9464. @item pts
  9465. presentation timestamp of the input frame expressed in time base units
  9466. @item r
  9467. frame rate of the input video, NAN if the input frame rate is unknown
  9468. @item t
  9469. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9470. @item tb
  9471. time base of the input video
  9472. @end table
  9473. @subsection Examples
  9474. @itemize
  9475. @item
  9476. Set the hue to 90 degrees and the saturation to 1.0:
  9477. @example
  9478. hue=h=90:s=1
  9479. @end example
  9480. @item
  9481. Same command but expressing the hue in radians:
  9482. @example
  9483. hue=H=PI/2:s=1
  9484. @end example
  9485. @item
  9486. Rotate hue and make the saturation swing between 0
  9487. and 2 over a period of 1 second:
  9488. @example
  9489. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9490. @end example
  9491. @item
  9492. Apply a 3 seconds saturation fade-in effect starting at 0:
  9493. @example
  9494. hue="s=min(t/3\,1)"
  9495. @end example
  9496. The general fade-in expression can be written as:
  9497. @example
  9498. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9499. @end example
  9500. @item
  9501. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9502. @example
  9503. hue="s=max(0\, min(1\, (8-t)/3))"
  9504. @end example
  9505. The general fade-out expression can be written as:
  9506. @example
  9507. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9508. @end example
  9509. @end itemize
  9510. @subsection Commands
  9511. This filter supports the following commands:
  9512. @table @option
  9513. @item b
  9514. @item s
  9515. @item h
  9516. @item H
  9517. Modify the hue and/or the saturation and/or brightness of the input video.
  9518. The command accepts the same syntax of the corresponding option.
  9519. If the specified expression is not valid, it is kept at its current
  9520. value.
  9521. @end table
  9522. @section hysteresis
  9523. Grow first stream into second stream by connecting components.
  9524. This makes it possible to build more robust edge masks.
  9525. This filter accepts the following options:
  9526. @table @option
  9527. @item planes
  9528. Set which planes will be processed as bitmap, unprocessed planes will be
  9529. copied from first stream.
  9530. By default value 0xf, all planes will be processed.
  9531. @item threshold
  9532. Set threshold which is used in filtering. If pixel component value is higher than
  9533. this value filter algorithm for connecting components is activated.
  9534. By default value is 0.
  9535. @end table
  9536. The @code{hysteresis} filter also supports the @ref{framesync} options.
  9537. @section idet
  9538. Detect video interlacing type.
  9539. This filter tries to detect if the input frames are interlaced, progressive,
  9540. top or bottom field first. It will also try to detect fields that are
  9541. repeated between adjacent frames (a sign of telecine).
  9542. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9543. Multiple frame detection incorporates the classification history of previous frames.
  9544. The filter will log these metadata values:
  9545. @table @option
  9546. @item single.current_frame
  9547. Detected type of current frame using single-frame detection. One of:
  9548. ``tff'' (top field first), ``bff'' (bottom field first),
  9549. ``progressive'', or ``undetermined''
  9550. @item single.tff
  9551. Cumulative number of frames detected as top field first using single-frame detection.
  9552. @item multiple.tff
  9553. Cumulative number of frames detected as top field first using multiple-frame detection.
  9554. @item single.bff
  9555. Cumulative number of frames detected as bottom field first using single-frame detection.
  9556. @item multiple.current_frame
  9557. Detected type of current frame using multiple-frame detection. One of:
  9558. ``tff'' (top field first), ``bff'' (bottom field first),
  9559. ``progressive'', or ``undetermined''
  9560. @item multiple.bff
  9561. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9562. @item single.progressive
  9563. Cumulative number of frames detected as progressive using single-frame detection.
  9564. @item multiple.progressive
  9565. Cumulative number of frames detected as progressive using multiple-frame detection.
  9566. @item single.undetermined
  9567. Cumulative number of frames that could not be classified using single-frame detection.
  9568. @item multiple.undetermined
  9569. Cumulative number of frames that could not be classified using multiple-frame detection.
  9570. @item repeated.current_frame
  9571. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9572. @item repeated.neither
  9573. Cumulative number of frames with no repeated field.
  9574. @item repeated.top
  9575. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9576. @item repeated.bottom
  9577. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9578. @end table
  9579. The filter accepts the following options:
  9580. @table @option
  9581. @item intl_thres
  9582. Set interlacing threshold.
  9583. @item prog_thres
  9584. Set progressive threshold.
  9585. @item rep_thres
  9586. Threshold for repeated field detection.
  9587. @item half_life
  9588. Number of frames after which a given frame's contribution to the
  9589. statistics is halved (i.e., it contributes only 0.5 to its
  9590. classification). The default of 0 means that all frames seen are given
  9591. full weight of 1.0 forever.
  9592. @item analyze_interlaced_flag
  9593. When this is not 0 then idet will use the specified number of frames to determine
  9594. if the interlaced flag is accurate, it will not count undetermined frames.
  9595. If the flag is found to be accurate it will be used without any further
  9596. computations, if it is found to be inaccurate it will be cleared without any
  9597. further computations. This allows inserting the idet filter as a low computational
  9598. method to clean up the interlaced flag
  9599. @end table
  9600. @section il
  9601. Deinterleave or interleave fields.
  9602. This filter allows one to process interlaced images fields without
  9603. deinterlacing them. Deinterleaving splits the input frame into 2
  9604. fields (so called half pictures). Odd lines are moved to the top
  9605. half of the output image, even lines to the bottom half.
  9606. You can process (filter) them independently and then re-interleave them.
  9607. The filter accepts the following options:
  9608. @table @option
  9609. @item luma_mode, l
  9610. @item chroma_mode, c
  9611. @item alpha_mode, a
  9612. Available values for @var{luma_mode}, @var{chroma_mode} and
  9613. @var{alpha_mode} are:
  9614. @table @samp
  9615. @item none
  9616. Do nothing.
  9617. @item deinterleave, d
  9618. Deinterleave fields, placing one above the other.
  9619. @item interleave, i
  9620. Interleave fields. Reverse the effect of deinterleaving.
  9621. @end table
  9622. Default value is @code{none}.
  9623. @item luma_swap, ls
  9624. @item chroma_swap, cs
  9625. @item alpha_swap, as
  9626. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9627. @end table
  9628. @subsection Commands
  9629. This filter supports the all above options as @ref{commands}.
  9630. @section inflate
  9631. Apply inflate effect to the video.
  9632. This filter replaces the pixel by the local(3x3) average by taking into account
  9633. only values higher than the pixel.
  9634. It accepts the following options:
  9635. @table @option
  9636. @item threshold0
  9637. @item threshold1
  9638. @item threshold2
  9639. @item threshold3
  9640. Limit the maximum change for each plane, default is 65535.
  9641. If 0, plane will remain unchanged.
  9642. @end table
  9643. @subsection Commands
  9644. This filter supports the all above options as @ref{commands}.
  9645. @section interlace
  9646. Simple interlacing filter from progressive contents. This interleaves upper (or
  9647. lower) lines from odd frames with lower (or upper) lines from even frames,
  9648. halving the frame rate and preserving image height.
  9649. @example
  9650. Original Original New Frame
  9651. Frame 'j' Frame 'j+1' (tff)
  9652. ========== =========== ==================
  9653. Line 0 --------------------> Frame 'j' Line 0
  9654. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9655. Line 2 ---------------------> Frame 'j' Line 2
  9656. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9657. ... ... ...
  9658. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9659. @end example
  9660. It accepts the following optional parameters:
  9661. @table @option
  9662. @item scan
  9663. This determines whether the interlaced frame is taken from the even
  9664. (tff - default) or odd (bff) lines of the progressive frame.
  9665. @item lowpass
  9666. Vertical lowpass filter to avoid twitter interlacing and
  9667. reduce moire patterns.
  9668. @table @samp
  9669. @item 0, off
  9670. Disable vertical lowpass filter
  9671. @item 1, linear
  9672. Enable linear filter (default)
  9673. @item 2, complex
  9674. Enable complex filter. This will slightly less reduce twitter and moire
  9675. but better retain detail and subjective sharpness impression.
  9676. @end table
  9677. @end table
  9678. @section kerndeint
  9679. Deinterlace input video by applying Donald Graft's adaptive kernel
  9680. deinterling. Work on interlaced parts of a video to produce
  9681. progressive frames.
  9682. The description of the accepted parameters follows.
  9683. @table @option
  9684. @item thresh
  9685. Set the threshold which affects the filter's tolerance when
  9686. determining if a pixel line must be processed. It must be an integer
  9687. in the range [0,255] and defaults to 10. A value of 0 will result in
  9688. applying the process on every pixels.
  9689. @item map
  9690. Paint pixels exceeding the threshold value to white if set to 1.
  9691. Default is 0.
  9692. @item order
  9693. Set the fields order. Swap fields if set to 1, leave fields alone if
  9694. 0. Default is 0.
  9695. @item sharp
  9696. Enable additional sharpening if set to 1. Default is 0.
  9697. @item twoway
  9698. Enable twoway sharpening if set to 1. Default is 0.
  9699. @end table
  9700. @subsection Examples
  9701. @itemize
  9702. @item
  9703. Apply default values:
  9704. @example
  9705. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9706. @end example
  9707. @item
  9708. Enable additional sharpening:
  9709. @example
  9710. kerndeint=sharp=1
  9711. @end example
  9712. @item
  9713. Paint processed pixels in white:
  9714. @example
  9715. kerndeint=map=1
  9716. @end example
  9717. @end itemize
  9718. @section lagfun
  9719. Slowly update darker pixels.
  9720. This filter makes short flashes of light appear longer.
  9721. This filter accepts the following options:
  9722. @table @option
  9723. @item decay
  9724. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9725. @item planes
  9726. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9727. @end table
  9728. @section lenscorrection
  9729. Correct radial lens distortion
  9730. This filter can be used to correct for radial distortion as can result from the use
  9731. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9732. one can use tools available for example as part of opencv or simply trial-and-error.
  9733. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9734. and extract the k1 and k2 coefficients from the resulting matrix.
  9735. Note that effectively the same filter is available in the open-source tools Krita and
  9736. Digikam from the KDE project.
  9737. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9738. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9739. brightness distribution, so you may want to use both filters together in certain
  9740. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9741. be applied before or after lens correction.
  9742. @subsection Options
  9743. The filter accepts the following options:
  9744. @table @option
  9745. @item cx
  9746. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9747. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9748. width. Default is 0.5.
  9749. @item cy
  9750. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9751. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9752. height. Default is 0.5.
  9753. @item k1
  9754. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9755. no correction. Default is 0.
  9756. @item k2
  9757. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9758. 0 means no correction. Default is 0.
  9759. @end table
  9760. The formula that generates the correction is:
  9761. @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)
  9762. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9763. distances from the focal point in the source and target images, respectively.
  9764. @section lensfun
  9765. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9766. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9767. to apply the lens correction. The filter will load the lensfun database and
  9768. query it to find the corresponding camera and lens entries in the database. As
  9769. long as these entries can be found with the given options, the filter can
  9770. perform corrections on frames. Note that incomplete strings will result in the
  9771. filter choosing the best match with the given options, and the filter will
  9772. output the chosen camera and lens models (logged with level "info"). You must
  9773. provide the make, camera model, and lens model as they are required.
  9774. The filter accepts the following options:
  9775. @table @option
  9776. @item make
  9777. The make of the camera (for example, "Canon"). This option is required.
  9778. @item model
  9779. The model of the camera (for example, "Canon EOS 100D"). This option is
  9780. required.
  9781. @item lens_model
  9782. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9783. option is required.
  9784. @item mode
  9785. The type of correction to apply. The following values are valid options:
  9786. @table @samp
  9787. @item vignetting
  9788. Enables fixing lens vignetting.
  9789. @item geometry
  9790. Enables fixing lens geometry. This is the default.
  9791. @item subpixel
  9792. Enables fixing chromatic aberrations.
  9793. @item vig_geo
  9794. Enables fixing lens vignetting and lens geometry.
  9795. @item vig_subpixel
  9796. Enables fixing lens vignetting and chromatic aberrations.
  9797. @item distortion
  9798. Enables fixing both lens geometry and chromatic aberrations.
  9799. @item all
  9800. Enables all possible corrections.
  9801. @end table
  9802. @item focal_length
  9803. The focal length of the image/video (zoom; expected constant for video). For
  9804. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9805. range should be chosen when using that lens. Default 18.
  9806. @item aperture
  9807. The aperture of the image/video (expected constant for video). Note that
  9808. aperture is only used for vignetting correction. Default 3.5.
  9809. @item focus_distance
  9810. The focus distance of the image/video (expected constant for video). Note that
  9811. focus distance is only used for vignetting and only slightly affects the
  9812. vignetting correction process. If unknown, leave it at the default value (which
  9813. is 1000).
  9814. @item scale
  9815. The scale factor which is applied after transformation. After correction the
  9816. video is no longer necessarily rectangular. This parameter controls how much of
  9817. the resulting image is visible. The value 0 means that a value will be chosen
  9818. automatically such that there is little or no unmapped area in the output
  9819. image. 1.0 means that no additional scaling is done. Lower values may result
  9820. in more of the corrected image being visible, while higher values may avoid
  9821. unmapped areas in the output.
  9822. @item target_geometry
  9823. The target geometry of the output image/video. The following values are valid
  9824. options:
  9825. @table @samp
  9826. @item rectilinear (default)
  9827. @item fisheye
  9828. @item panoramic
  9829. @item equirectangular
  9830. @item fisheye_orthographic
  9831. @item fisheye_stereographic
  9832. @item fisheye_equisolid
  9833. @item fisheye_thoby
  9834. @end table
  9835. @item reverse
  9836. Apply the reverse of image correction (instead of correcting distortion, apply
  9837. it).
  9838. @item interpolation
  9839. The type of interpolation used when correcting distortion. The following values
  9840. are valid options:
  9841. @table @samp
  9842. @item nearest
  9843. @item linear (default)
  9844. @item lanczos
  9845. @end table
  9846. @end table
  9847. @subsection Examples
  9848. @itemize
  9849. @item
  9850. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9851. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9852. aperture of "8.0".
  9853. @example
  9854. 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
  9855. @end example
  9856. @item
  9857. Apply the same as before, but only for the first 5 seconds of video.
  9858. @example
  9859. 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
  9860. @end example
  9861. @end itemize
  9862. @section libvmaf
  9863. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9864. score between two input videos.
  9865. The obtained VMAF score is printed through the logging system.
  9866. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9867. After installing the library it can be enabled using:
  9868. @code{./configure --enable-libvmaf}.
  9869. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9870. The filter has following options:
  9871. @table @option
  9872. @item model_path
  9873. Set the model path which is to be used for SVM.
  9874. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  9875. @item log_path
  9876. Set the file path to be used to store logs.
  9877. @item log_fmt
  9878. Set the format of the log file (csv, json or xml).
  9879. @item enable_transform
  9880. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9881. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9882. Default value: @code{false}
  9883. @item phone_model
  9884. Invokes the phone model which will generate VMAF scores higher than in the
  9885. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9886. Default value: @code{false}
  9887. @item psnr
  9888. Enables computing psnr along with vmaf.
  9889. Default value: @code{false}
  9890. @item ssim
  9891. Enables computing ssim along with vmaf.
  9892. Default value: @code{false}
  9893. @item ms_ssim
  9894. Enables computing ms_ssim along with vmaf.
  9895. Default value: @code{false}
  9896. @item pool
  9897. Set the pool method to be used for computing vmaf.
  9898. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  9899. @item n_threads
  9900. Set number of threads to be used when computing vmaf.
  9901. Default value: @code{0}, which makes use of all available logical processors.
  9902. @item n_subsample
  9903. Set interval for frame subsampling used when computing vmaf.
  9904. Default value: @code{1}
  9905. @item enable_conf_interval
  9906. Enables confidence interval.
  9907. Default value: @code{false}
  9908. @end table
  9909. This filter also supports the @ref{framesync} options.
  9910. @subsection Examples
  9911. @itemize
  9912. @item
  9913. On the below examples the input file @file{main.mpg} being processed is
  9914. compared with the reference file @file{ref.mpg}.
  9915. @example
  9916. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9917. @end example
  9918. @item
  9919. Example with options:
  9920. @example
  9921. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9922. @end example
  9923. @item
  9924. Example with options and different containers:
  9925. @example
  9926. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]libvmaf=psnr=1:log_fmt=json" -f null -
  9927. @end example
  9928. @end itemize
  9929. @section limiter
  9930. Limits the pixel components values to the specified range [min, max].
  9931. The filter accepts the following options:
  9932. @table @option
  9933. @item min
  9934. Lower bound. Defaults to the lowest allowed value for the input.
  9935. @item max
  9936. Upper bound. Defaults to the highest allowed value for the input.
  9937. @item planes
  9938. Specify which planes will be processed. Defaults to all available.
  9939. @end table
  9940. @section loop
  9941. Loop video frames.
  9942. The filter accepts the following options:
  9943. @table @option
  9944. @item loop
  9945. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9946. Default is 0.
  9947. @item size
  9948. Set maximal size in number of frames. Default is 0.
  9949. @item start
  9950. Set first frame of loop. Default is 0.
  9951. @end table
  9952. @subsection Examples
  9953. @itemize
  9954. @item
  9955. Loop single first frame infinitely:
  9956. @example
  9957. loop=loop=-1:size=1:start=0
  9958. @end example
  9959. @item
  9960. Loop single first frame 10 times:
  9961. @example
  9962. loop=loop=10:size=1:start=0
  9963. @end example
  9964. @item
  9965. Loop 10 first frames 5 times:
  9966. @example
  9967. loop=loop=5:size=10:start=0
  9968. @end example
  9969. @end itemize
  9970. @section lut1d
  9971. Apply a 1D LUT to an input video.
  9972. The filter accepts the following options:
  9973. @table @option
  9974. @item file
  9975. Set the 1D LUT file name.
  9976. Currently supported formats:
  9977. @table @samp
  9978. @item cube
  9979. Iridas
  9980. @item csp
  9981. cineSpace
  9982. @end table
  9983. @item interp
  9984. Select interpolation mode.
  9985. Available values are:
  9986. @table @samp
  9987. @item nearest
  9988. Use values from the nearest defined point.
  9989. @item linear
  9990. Interpolate values using the linear interpolation.
  9991. @item cosine
  9992. Interpolate values using the cosine interpolation.
  9993. @item cubic
  9994. Interpolate values using the cubic interpolation.
  9995. @item spline
  9996. Interpolate values using the spline interpolation.
  9997. @end table
  9998. @end table
  9999. @anchor{lut3d}
  10000. @section lut3d
  10001. Apply a 3D LUT to an input video.
  10002. The filter accepts the following options:
  10003. @table @option
  10004. @item file
  10005. Set the 3D LUT file name.
  10006. Currently supported formats:
  10007. @table @samp
  10008. @item 3dl
  10009. AfterEffects
  10010. @item cube
  10011. Iridas
  10012. @item dat
  10013. DaVinci
  10014. @item m3d
  10015. Pandora
  10016. @item csp
  10017. cineSpace
  10018. @end table
  10019. @item interp
  10020. Select interpolation mode.
  10021. Available values are:
  10022. @table @samp
  10023. @item nearest
  10024. Use values from the nearest defined point.
  10025. @item trilinear
  10026. Interpolate values using the 8 points defining a cube.
  10027. @item tetrahedral
  10028. Interpolate values using a tetrahedron.
  10029. @end table
  10030. @end table
  10031. @section lumakey
  10032. Turn certain luma values into transparency.
  10033. The filter accepts the following options:
  10034. @table @option
  10035. @item threshold
  10036. Set the luma which will be used as base for transparency.
  10037. Default value is @code{0}.
  10038. @item tolerance
  10039. Set the range of luma values to be keyed out.
  10040. Default value is @code{0.01}.
  10041. @item softness
  10042. Set the range of softness. Default value is @code{0}.
  10043. Use this to control gradual transition from zero to full transparency.
  10044. @end table
  10045. @subsection Commands
  10046. This filter supports same @ref{commands} as options.
  10047. The command accepts the same syntax of the corresponding option.
  10048. If the specified expression is not valid, it is kept at its current
  10049. value.
  10050. @section lut, lutrgb, lutyuv
  10051. Compute a look-up table for binding each pixel component input value
  10052. to an output value, and apply it to the input video.
  10053. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  10054. to an RGB input video.
  10055. These filters accept the following parameters:
  10056. @table @option
  10057. @item c0
  10058. set first pixel component expression
  10059. @item c1
  10060. set second pixel component expression
  10061. @item c2
  10062. set third pixel component expression
  10063. @item c3
  10064. set fourth pixel component expression, corresponds to the alpha component
  10065. @item r
  10066. set red component expression
  10067. @item g
  10068. set green component expression
  10069. @item b
  10070. set blue component expression
  10071. @item a
  10072. alpha component expression
  10073. @item y
  10074. set Y/luminance component expression
  10075. @item u
  10076. set U/Cb component expression
  10077. @item v
  10078. set V/Cr component expression
  10079. @end table
  10080. Each of them specifies the expression to use for computing the lookup table for
  10081. the corresponding pixel component values.
  10082. The exact component associated to each of the @var{c*} options depends on the
  10083. format in input.
  10084. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  10085. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  10086. The expressions can contain the following constants and functions:
  10087. @table @option
  10088. @item w
  10089. @item h
  10090. The input width and height.
  10091. @item val
  10092. The input value for the pixel component.
  10093. @item clipval
  10094. The input value, clipped to the @var{minval}-@var{maxval} range.
  10095. @item maxval
  10096. The maximum value for the pixel component.
  10097. @item minval
  10098. The minimum value for the pixel component.
  10099. @item negval
  10100. The negated value for the pixel component value, clipped to the
  10101. @var{minval}-@var{maxval} range; it corresponds to the expression
  10102. "maxval-clipval+minval".
  10103. @item clip(val)
  10104. The computed value in @var{val}, clipped to the
  10105. @var{minval}-@var{maxval} range.
  10106. @item gammaval(gamma)
  10107. The computed gamma correction value of the pixel component value,
  10108. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  10109. expression
  10110. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  10111. @end table
  10112. All expressions default to "val".
  10113. @subsection Examples
  10114. @itemize
  10115. @item
  10116. Negate input video:
  10117. @example
  10118. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  10119. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  10120. @end example
  10121. The above is the same as:
  10122. @example
  10123. lutrgb="r=negval:g=negval:b=negval"
  10124. lutyuv="y=negval:u=negval:v=negval"
  10125. @end example
  10126. @item
  10127. Negate luminance:
  10128. @example
  10129. lutyuv=y=negval
  10130. @end example
  10131. @item
  10132. Remove chroma components, turning the video into a graytone image:
  10133. @example
  10134. lutyuv="u=128:v=128"
  10135. @end example
  10136. @item
  10137. Apply a luma burning effect:
  10138. @example
  10139. lutyuv="y=2*val"
  10140. @end example
  10141. @item
  10142. Remove green and blue components:
  10143. @example
  10144. lutrgb="g=0:b=0"
  10145. @end example
  10146. @item
  10147. Set a constant alpha channel value on input:
  10148. @example
  10149. format=rgba,lutrgb=a="maxval-minval/2"
  10150. @end example
  10151. @item
  10152. Correct luminance gamma by a factor of 0.5:
  10153. @example
  10154. lutyuv=y=gammaval(0.5)
  10155. @end example
  10156. @item
  10157. Discard least significant bits of luma:
  10158. @example
  10159. lutyuv=y='bitand(val, 128+64+32)'
  10160. @end example
  10161. @item
  10162. Technicolor like effect:
  10163. @example
  10164. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  10165. @end example
  10166. @end itemize
  10167. @section lut2, tlut2
  10168. The @code{lut2} filter takes two input streams and outputs one
  10169. stream.
  10170. The @code{tlut2} (time lut2) filter takes two consecutive frames
  10171. from one single stream.
  10172. This filter accepts the following parameters:
  10173. @table @option
  10174. @item c0
  10175. set first pixel component expression
  10176. @item c1
  10177. set second pixel component expression
  10178. @item c2
  10179. set third pixel component expression
  10180. @item c3
  10181. set fourth pixel component expression, corresponds to the alpha component
  10182. @item d
  10183. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10184. which means bit depth is automatically picked from first input format.
  10185. @end table
  10186. The @code{lut2} filter also supports the @ref{framesync} options.
  10187. Each of them specifies the expression to use for computing the lookup table for
  10188. the corresponding pixel component values.
  10189. The exact component associated to each of the @var{c*} options depends on the
  10190. format in inputs.
  10191. The expressions can contain the following constants:
  10192. @table @option
  10193. @item w
  10194. @item h
  10195. The input width and height.
  10196. @item x
  10197. The first input value for the pixel component.
  10198. @item y
  10199. The second input value for the pixel component.
  10200. @item bdx
  10201. The first input video bit depth.
  10202. @item bdy
  10203. The second input video bit depth.
  10204. @end table
  10205. All expressions default to "x".
  10206. @subsection Examples
  10207. @itemize
  10208. @item
  10209. Highlight differences between two RGB video streams:
  10210. @example
  10211. 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)'
  10212. @end example
  10213. @item
  10214. Highlight differences between two YUV video streams:
  10215. @example
  10216. 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)'
  10217. @end example
  10218. @item
  10219. Show max difference between two video streams:
  10220. @example
  10221. 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)))'
  10222. @end example
  10223. @end itemize
  10224. @section maskedclamp
  10225. Clamp the first input stream with the second input and third input stream.
  10226. Returns the value of first stream to be between second input
  10227. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10228. This filter accepts the following options:
  10229. @table @option
  10230. @item undershoot
  10231. Default value is @code{0}.
  10232. @item overshoot
  10233. Default value is @code{0}.
  10234. @item planes
  10235. Set which planes will be processed as bitmap, unprocessed planes will be
  10236. copied from first stream.
  10237. By default value 0xf, all planes will be processed.
  10238. @end table
  10239. @section maskedmax
  10240. Merge the second and third input stream into output stream using absolute differences
  10241. between second input stream and first input stream and absolute difference between
  10242. third input stream and first input stream. The picked value will be from second input
  10243. stream if second absolute difference is greater than first one or from third input stream
  10244. otherwise.
  10245. This filter accepts the following options:
  10246. @table @option
  10247. @item planes
  10248. Set which planes will be processed as bitmap, unprocessed planes will be
  10249. copied from first stream.
  10250. By default value 0xf, all planes will be processed.
  10251. @end table
  10252. @section maskedmerge
  10253. Merge the first input stream with the second input stream using per pixel
  10254. weights in the third input stream.
  10255. A value of 0 in the third stream pixel component means that pixel component
  10256. from first stream is returned unchanged, while maximum value (eg. 255 for
  10257. 8-bit videos) means that pixel component from second stream is returned
  10258. unchanged. Intermediate values define the amount of merging between both
  10259. input stream's pixel components.
  10260. This filter accepts the following options:
  10261. @table @option
  10262. @item planes
  10263. Set which planes will be processed as bitmap, unprocessed planes will be
  10264. copied from first stream.
  10265. By default value 0xf, all planes will be processed.
  10266. @end table
  10267. @section maskedmin
  10268. Merge the second and third input stream into output stream using absolute differences
  10269. between second input stream and first input stream and absolute difference between
  10270. third input stream and first input stream. The picked value will be from second input
  10271. stream if second absolute difference is less than first one or from third input stream
  10272. otherwise.
  10273. This filter accepts the following options:
  10274. @table @option
  10275. @item planes
  10276. Set which planes will be processed as bitmap, unprocessed planes will be
  10277. copied from first stream.
  10278. By default value 0xf, all planes will be processed.
  10279. @end table
  10280. @section maskedthreshold
  10281. Pick pixels comparing absolute difference of two video streams with fixed
  10282. threshold.
  10283. If absolute difference between pixel component of first and second video
  10284. stream is equal or lower than user supplied threshold than pixel component
  10285. from first video stream is picked, otherwise pixel component from second
  10286. video stream is picked.
  10287. This filter accepts the following options:
  10288. @table @option
  10289. @item threshold
  10290. Set threshold used when picking pixels from absolute difference from two input
  10291. video streams.
  10292. @item planes
  10293. Set which planes will be processed as bitmap, unprocessed planes will be
  10294. copied from second stream.
  10295. By default value 0xf, all planes will be processed.
  10296. @end table
  10297. @section maskfun
  10298. Create mask from input video.
  10299. For example it is useful to create motion masks after @code{tblend} filter.
  10300. This filter accepts the following options:
  10301. @table @option
  10302. @item low
  10303. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10304. @item high
  10305. Set high threshold. Any pixel component higher than this value will be set to max value
  10306. allowed for current pixel format.
  10307. @item planes
  10308. Set planes to filter, by default all available planes are filtered.
  10309. @item fill
  10310. Fill all frame pixels with this value.
  10311. @item sum
  10312. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10313. average, output frame will be completely filled with value set by @var{fill} option.
  10314. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10315. @end table
  10316. @section mcdeint
  10317. Apply motion-compensation deinterlacing.
  10318. It needs one field per frame as input and must thus be used together
  10319. with yadif=1/3 or equivalent.
  10320. This filter accepts the following options:
  10321. @table @option
  10322. @item mode
  10323. Set the deinterlacing mode.
  10324. It accepts one of the following values:
  10325. @table @samp
  10326. @item fast
  10327. @item medium
  10328. @item slow
  10329. use iterative motion estimation
  10330. @item extra_slow
  10331. like @samp{slow}, but use multiple reference frames.
  10332. @end table
  10333. Default value is @samp{fast}.
  10334. @item parity
  10335. Set the picture field parity assumed for the input video. It must be
  10336. one of the following values:
  10337. @table @samp
  10338. @item 0, tff
  10339. assume top field first
  10340. @item 1, bff
  10341. assume bottom field first
  10342. @end table
  10343. Default value is @samp{bff}.
  10344. @item qp
  10345. Set per-block quantization parameter (QP) used by the internal
  10346. encoder.
  10347. Higher values should result in a smoother motion vector field but less
  10348. optimal individual vectors. Default value is 1.
  10349. @end table
  10350. @section median
  10351. Pick median pixel from certain rectangle defined by radius.
  10352. This filter accepts the following options:
  10353. @table @option
  10354. @item radius
  10355. Set horizontal radius size. Default value is @code{1}.
  10356. Allowed range is integer from 1 to 127.
  10357. @item planes
  10358. Set which planes to process. Default is @code{15}, which is all available planes.
  10359. @item radiusV
  10360. Set vertical radius size. Default value is @code{0}.
  10361. Allowed range is integer from 0 to 127.
  10362. If it is 0, value will be picked from horizontal @code{radius} option.
  10363. @item percentile
  10364. Set median percentile. Default value is @code{0.5}.
  10365. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  10366. minimum values, and @code{1} maximum values.
  10367. @end table
  10368. @subsection Commands
  10369. This filter supports same @ref{commands} as options.
  10370. The command accepts the same syntax of the corresponding option.
  10371. If the specified expression is not valid, it is kept at its current
  10372. value.
  10373. @section mergeplanes
  10374. Merge color channel components from several video streams.
  10375. The filter accepts up to 4 input streams, and merge selected input
  10376. planes to the output video.
  10377. This filter accepts the following options:
  10378. @table @option
  10379. @item mapping
  10380. Set input to output plane mapping. Default is @code{0}.
  10381. The mappings is specified as a bitmap. It should be specified as a
  10382. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10383. mapping for the first plane of the output stream. 'A' sets the number of
  10384. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10385. corresponding input to use (from 0 to 3). The rest of the mappings is
  10386. similar, 'Bb' describes the mapping for the output stream second
  10387. plane, 'Cc' describes the mapping for the output stream third plane and
  10388. 'Dd' describes the mapping for the output stream fourth plane.
  10389. @item format
  10390. Set output pixel format. Default is @code{yuva444p}.
  10391. @end table
  10392. @subsection Examples
  10393. @itemize
  10394. @item
  10395. Merge three gray video streams of same width and height into single video stream:
  10396. @example
  10397. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10398. @end example
  10399. @item
  10400. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10401. @example
  10402. [a0][a1]mergeplanes=0x00010210:yuva444p
  10403. @end example
  10404. @item
  10405. Swap Y and A plane in yuva444p stream:
  10406. @example
  10407. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10408. @end example
  10409. @item
  10410. Swap U and V plane in yuv420p stream:
  10411. @example
  10412. format=yuv420p,mergeplanes=0x000201:yuv420p
  10413. @end example
  10414. @item
  10415. Cast a rgb24 clip to yuv444p:
  10416. @example
  10417. format=rgb24,mergeplanes=0x000102:yuv444p
  10418. @end example
  10419. @end itemize
  10420. @section mestimate
  10421. Estimate and export motion vectors using block matching algorithms.
  10422. Motion vectors are stored in frame side data to be used by other filters.
  10423. This filter accepts the following options:
  10424. @table @option
  10425. @item method
  10426. Specify the motion estimation method. Accepts one of the following values:
  10427. @table @samp
  10428. @item esa
  10429. Exhaustive search algorithm.
  10430. @item tss
  10431. Three step search algorithm.
  10432. @item tdls
  10433. Two dimensional logarithmic search algorithm.
  10434. @item ntss
  10435. New three step search algorithm.
  10436. @item fss
  10437. Four step search algorithm.
  10438. @item ds
  10439. Diamond search algorithm.
  10440. @item hexbs
  10441. Hexagon-based search algorithm.
  10442. @item epzs
  10443. Enhanced predictive zonal search algorithm.
  10444. @item umh
  10445. Uneven multi-hexagon search algorithm.
  10446. @end table
  10447. Default value is @samp{esa}.
  10448. @item mb_size
  10449. Macroblock size. Default @code{16}.
  10450. @item search_param
  10451. Search parameter. Default @code{7}.
  10452. @end table
  10453. @section midequalizer
  10454. Apply Midway Image Equalization effect using two video streams.
  10455. Midway Image Equalization adjusts a pair of images to have the same
  10456. histogram, while maintaining their dynamics as much as possible. It's
  10457. useful for e.g. matching exposures from a pair of stereo cameras.
  10458. This filter has two inputs and one output, which must be of same pixel format, but
  10459. may be of different sizes. The output of filter is first input adjusted with
  10460. midway histogram of both inputs.
  10461. This filter accepts the following option:
  10462. @table @option
  10463. @item planes
  10464. Set which planes to process. Default is @code{15}, which is all available planes.
  10465. @end table
  10466. @section minterpolate
  10467. Convert the video to specified frame rate using motion interpolation.
  10468. This filter accepts the following options:
  10469. @table @option
  10470. @item fps
  10471. 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}.
  10472. @item mi_mode
  10473. Motion interpolation mode. Following values are accepted:
  10474. @table @samp
  10475. @item dup
  10476. Duplicate previous or next frame for interpolating new ones.
  10477. @item blend
  10478. Blend source frames. Interpolated frame is mean of previous and next frames.
  10479. @item mci
  10480. Motion compensated interpolation. Following options are effective when this mode is selected:
  10481. @table @samp
  10482. @item mc_mode
  10483. Motion compensation mode. Following values are accepted:
  10484. @table @samp
  10485. @item obmc
  10486. Overlapped block motion compensation.
  10487. @item aobmc
  10488. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10489. @end table
  10490. Default mode is @samp{obmc}.
  10491. @item me_mode
  10492. Motion estimation mode. Following values are accepted:
  10493. @table @samp
  10494. @item bidir
  10495. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10496. @item bilat
  10497. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10498. @end table
  10499. Default mode is @samp{bilat}.
  10500. @item me
  10501. The algorithm to be used for motion estimation. Following values are accepted:
  10502. @table @samp
  10503. @item esa
  10504. Exhaustive search algorithm.
  10505. @item tss
  10506. Three step search algorithm.
  10507. @item tdls
  10508. Two dimensional logarithmic search algorithm.
  10509. @item ntss
  10510. New three step search algorithm.
  10511. @item fss
  10512. Four step search algorithm.
  10513. @item ds
  10514. Diamond search algorithm.
  10515. @item hexbs
  10516. Hexagon-based search algorithm.
  10517. @item epzs
  10518. Enhanced predictive zonal search algorithm.
  10519. @item umh
  10520. Uneven multi-hexagon search algorithm.
  10521. @end table
  10522. Default algorithm is @samp{epzs}.
  10523. @item mb_size
  10524. Macroblock size. Default @code{16}.
  10525. @item search_param
  10526. Motion estimation search parameter. Default @code{32}.
  10527. @item vsbmc
  10528. 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).
  10529. @end table
  10530. @end table
  10531. @item scd
  10532. 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:
  10533. @table @samp
  10534. @item none
  10535. Disable scene change detection.
  10536. @item fdiff
  10537. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10538. @end table
  10539. Default method is @samp{fdiff}.
  10540. @item scd_threshold
  10541. Scene change detection threshold. Default is @code{10.}.
  10542. @end table
  10543. @section mix
  10544. Mix several video input streams into one video stream.
  10545. A description of the accepted options follows.
  10546. @table @option
  10547. @item nb_inputs
  10548. The number of inputs. If unspecified, it defaults to 2.
  10549. @item weights
  10550. Specify weight of each input video stream as sequence.
  10551. Each weight is separated by space. If number of weights
  10552. is smaller than number of @var{frames} last specified
  10553. weight will be used for all remaining unset weights.
  10554. @item scale
  10555. Specify scale, if it is set it will be multiplied with sum
  10556. of each weight multiplied with pixel values to give final destination
  10557. pixel value. By default @var{scale} is auto scaled to sum of weights.
  10558. @item duration
  10559. Specify how end of stream is determined.
  10560. @table @samp
  10561. @item longest
  10562. The duration of the longest input. (default)
  10563. @item shortest
  10564. The duration of the shortest input.
  10565. @item first
  10566. The duration of the first input.
  10567. @end table
  10568. @end table
  10569. @section mpdecimate
  10570. Drop frames that do not differ greatly from the previous frame in
  10571. order to reduce frame rate.
  10572. The main use of this filter is for very-low-bitrate encoding
  10573. (e.g. streaming over dialup modem), but it could in theory be used for
  10574. fixing movies that were inverse-telecined incorrectly.
  10575. A description of the accepted options follows.
  10576. @table @option
  10577. @item max
  10578. Set the maximum number of consecutive frames which can be dropped (if
  10579. positive), or the minimum interval between dropped frames (if
  10580. negative). If the value is 0, the frame is dropped disregarding the
  10581. number of previous sequentially dropped frames.
  10582. Default value is 0.
  10583. @item hi
  10584. @item lo
  10585. @item frac
  10586. Set the dropping threshold values.
  10587. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10588. represent actual pixel value differences, so a threshold of 64
  10589. corresponds to 1 unit of difference for each pixel, or the same spread
  10590. out differently over the block.
  10591. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10592. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10593. meaning the whole image) differ by more than a threshold of @option{lo}.
  10594. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10595. 64*5, and default value for @option{frac} is 0.33.
  10596. @end table
  10597. @section negate
  10598. Negate (invert) the input video.
  10599. It accepts the following option:
  10600. @table @option
  10601. @item negate_alpha
  10602. With value 1, it negates the alpha component, if present. Default value is 0.
  10603. @end table
  10604. @anchor{nlmeans}
  10605. @section nlmeans
  10606. Denoise frames using Non-Local Means algorithm.
  10607. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10608. context similarity is defined by comparing their surrounding patches of size
  10609. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10610. around the pixel.
  10611. Note that the research area defines centers for patches, which means some
  10612. patches will be made of pixels outside that research area.
  10613. The filter accepts the following options.
  10614. @table @option
  10615. @item s
  10616. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10617. @item p
  10618. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10619. @item pc
  10620. Same as @option{p} but for chroma planes.
  10621. The default value is @var{0} and means automatic.
  10622. @item r
  10623. Set research size. Default is 15. Must be odd number in range [0, 99].
  10624. @item rc
  10625. Same as @option{r} but for chroma planes.
  10626. The default value is @var{0} and means automatic.
  10627. @end table
  10628. @section nnedi
  10629. Deinterlace video using neural network edge directed interpolation.
  10630. This filter accepts the following options:
  10631. @table @option
  10632. @item weights
  10633. Mandatory option, without binary file filter can not work.
  10634. Currently file can be found here:
  10635. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10636. @item deint
  10637. Set which frames to deinterlace, by default it is @code{all}.
  10638. Can be @code{all} or @code{interlaced}.
  10639. @item field
  10640. Set mode of operation.
  10641. Can be one of the following:
  10642. @table @samp
  10643. @item af
  10644. Use frame flags, both fields.
  10645. @item a
  10646. Use frame flags, single field.
  10647. @item t
  10648. Use top field only.
  10649. @item b
  10650. Use bottom field only.
  10651. @item tf
  10652. Use both fields, top first.
  10653. @item bf
  10654. Use both fields, bottom first.
  10655. @end table
  10656. @item planes
  10657. Set which planes to process, by default filter process all frames.
  10658. @item nsize
  10659. Set size of local neighborhood around each pixel, used by the predictor neural
  10660. network.
  10661. Can be one of the following:
  10662. @table @samp
  10663. @item s8x6
  10664. @item s16x6
  10665. @item s32x6
  10666. @item s48x6
  10667. @item s8x4
  10668. @item s16x4
  10669. @item s32x4
  10670. @end table
  10671. @item nns
  10672. Set the number of neurons in predictor neural network.
  10673. Can be one of the following:
  10674. @table @samp
  10675. @item n16
  10676. @item n32
  10677. @item n64
  10678. @item n128
  10679. @item n256
  10680. @end table
  10681. @item qual
  10682. Controls the number of different neural network predictions that are blended
  10683. together to compute the final output value. Can be @code{fast}, default or
  10684. @code{slow}.
  10685. @item etype
  10686. Set which set of weights to use in the predictor.
  10687. Can be one of the following:
  10688. @table @samp
  10689. @item a
  10690. weights trained to minimize absolute error
  10691. @item s
  10692. weights trained to minimize squared error
  10693. @end table
  10694. @item pscrn
  10695. Controls whether or not the prescreener neural network is used to decide
  10696. which pixels should be processed by the predictor neural network and which
  10697. can be handled by simple cubic interpolation.
  10698. The prescreener is trained to know whether cubic interpolation will be
  10699. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10700. The computational complexity of the prescreener nn is much less than that of
  10701. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10702. using the prescreener generally results in much faster processing.
  10703. The prescreener is pretty accurate, so the difference between using it and not
  10704. using it is almost always unnoticeable.
  10705. Can be one of the following:
  10706. @table @samp
  10707. @item none
  10708. @item original
  10709. @item new
  10710. @end table
  10711. Default is @code{new}.
  10712. @item fapprox
  10713. Set various debugging flags.
  10714. @end table
  10715. @section noformat
  10716. Force libavfilter not to use any of the specified pixel formats for the
  10717. input to the next filter.
  10718. It accepts the following parameters:
  10719. @table @option
  10720. @item pix_fmts
  10721. A '|'-separated list of pixel format names, such as
  10722. pix_fmts=yuv420p|monow|rgb24".
  10723. @end table
  10724. @subsection Examples
  10725. @itemize
  10726. @item
  10727. Force libavfilter to use a format different from @var{yuv420p} for the
  10728. input to the vflip filter:
  10729. @example
  10730. noformat=pix_fmts=yuv420p,vflip
  10731. @end example
  10732. @item
  10733. Convert the input video to any of the formats not contained in the list:
  10734. @example
  10735. noformat=yuv420p|yuv444p|yuv410p
  10736. @end example
  10737. @end itemize
  10738. @section noise
  10739. Add noise on video input frame.
  10740. The filter accepts the following options:
  10741. @table @option
  10742. @item all_seed
  10743. @item c0_seed
  10744. @item c1_seed
  10745. @item c2_seed
  10746. @item c3_seed
  10747. Set noise seed for specific pixel component or all pixel components in case
  10748. of @var{all_seed}. Default value is @code{123457}.
  10749. @item all_strength, alls
  10750. @item c0_strength, c0s
  10751. @item c1_strength, c1s
  10752. @item c2_strength, c2s
  10753. @item c3_strength, c3s
  10754. Set noise strength for specific pixel component or all pixel components in case
  10755. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10756. @item all_flags, allf
  10757. @item c0_flags, c0f
  10758. @item c1_flags, c1f
  10759. @item c2_flags, c2f
  10760. @item c3_flags, c3f
  10761. Set pixel component flags or set flags for all components if @var{all_flags}.
  10762. Available values for component flags are:
  10763. @table @samp
  10764. @item a
  10765. averaged temporal noise (smoother)
  10766. @item p
  10767. mix random noise with a (semi)regular pattern
  10768. @item t
  10769. temporal noise (noise pattern changes between frames)
  10770. @item u
  10771. uniform noise (gaussian otherwise)
  10772. @end table
  10773. @end table
  10774. @subsection Examples
  10775. Add temporal and uniform noise to input video:
  10776. @example
  10777. noise=alls=20:allf=t+u
  10778. @end example
  10779. @section normalize
  10780. Normalize RGB video (aka histogram stretching, contrast stretching).
  10781. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10782. For each channel of each frame, the filter computes the input range and maps
  10783. it linearly to the user-specified output range. The output range defaults
  10784. to the full dynamic range from pure black to pure white.
  10785. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10786. changes in brightness) caused when small dark or bright objects enter or leave
  10787. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10788. video camera, and, like a video camera, it may cause a period of over- or
  10789. under-exposure of the video.
  10790. The R,G,B channels can be normalized independently, which may cause some
  10791. color shifting, or linked together as a single channel, which prevents
  10792. color shifting. Linked normalization preserves hue. Independent normalization
  10793. does not, so it can be used to remove some color casts. Independent and linked
  10794. normalization can be combined in any ratio.
  10795. The normalize filter accepts the following options:
  10796. @table @option
  10797. @item blackpt
  10798. @item whitept
  10799. Colors which define the output range. The minimum input value is mapped to
  10800. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10801. The defaults are black and white respectively. Specifying white for
  10802. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10803. normalized video. Shades of grey can be used to reduce the dynamic range
  10804. (contrast). Specifying saturated colors here can create some interesting
  10805. effects.
  10806. @item smoothing
  10807. The number of previous frames to use for temporal smoothing. The input range
  10808. of each channel is smoothed using a rolling average over the current frame
  10809. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10810. smoothing).
  10811. @item independence
  10812. Controls the ratio of independent (color shifting) channel normalization to
  10813. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10814. independent. Defaults to 1.0 (fully independent).
  10815. @item strength
  10816. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10817. expensive no-op. Defaults to 1.0 (full strength).
  10818. @end table
  10819. @subsection Commands
  10820. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  10821. The command accepts the same syntax of the corresponding option.
  10822. If the specified expression is not valid, it is kept at its current
  10823. value.
  10824. @subsection Examples
  10825. Stretch video contrast to use the full dynamic range, with no temporal
  10826. smoothing; may flicker depending on the source content:
  10827. @example
  10828. normalize=blackpt=black:whitept=white:smoothing=0
  10829. @end example
  10830. As above, but with 50 frames of temporal smoothing; flicker should be
  10831. reduced, depending on the source content:
  10832. @example
  10833. normalize=blackpt=black:whitept=white:smoothing=50
  10834. @end example
  10835. As above, but with hue-preserving linked channel normalization:
  10836. @example
  10837. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10838. @end example
  10839. As above, but with half strength:
  10840. @example
  10841. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10842. @end example
  10843. Map the darkest input color to red, the brightest input color to cyan:
  10844. @example
  10845. normalize=blackpt=red:whitept=cyan
  10846. @end example
  10847. @section null
  10848. Pass the video source unchanged to the output.
  10849. @section ocr
  10850. Optical Character Recognition
  10851. This filter uses Tesseract for optical character recognition. To enable
  10852. compilation of this filter, you need to configure FFmpeg with
  10853. @code{--enable-libtesseract}.
  10854. It accepts the following options:
  10855. @table @option
  10856. @item datapath
  10857. Set datapath to tesseract data. Default is to use whatever was
  10858. set at installation.
  10859. @item language
  10860. Set language, default is "eng".
  10861. @item whitelist
  10862. Set character whitelist.
  10863. @item blacklist
  10864. Set character blacklist.
  10865. @end table
  10866. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10867. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10868. @section ocv
  10869. Apply a video transform using libopencv.
  10870. To enable this filter, install the libopencv library and headers and
  10871. configure FFmpeg with @code{--enable-libopencv}.
  10872. It accepts the following parameters:
  10873. @table @option
  10874. @item filter_name
  10875. The name of the libopencv filter to apply.
  10876. @item filter_params
  10877. The parameters to pass to the libopencv filter. If not specified, the default
  10878. values are assumed.
  10879. @end table
  10880. Refer to the official libopencv documentation for more precise
  10881. information:
  10882. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10883. Several libopencv filters are supported; see the following subsections.
  10884. @anchor{dilate}
  10885. @subsection dilate
  10886. Dilate an image by using a specific structuring element.
  10887. It corresponds to the libopencv function @code{cvDilate}.
  10888. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10889. @var{struct_el} represents a structuring element, and has the syntax:
  10890. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10891. @var{cols} and @var{rows} represent the number of columns and rows of
  10892. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10893. point, and @var{shape} the shape for the structuring element. @var{shape}
  10894. must be "rect", "cross", "ellipse", or "custom".
  10895. If the value for @var{shape} is "custom", it must be followed by a
  10896. string of the form "=@var{filename}". The file with name
  10897. @var{filename} is assumed to represent a binary image, with each
  10898. printable character corresponding to a bright pixel. When a custom
  10899. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10900. or columns and rows of the read file are assumed instead.
  10901. The default value for @var{struct_el} is "3x3+0x0/rect".
  10902. @var{nb_iterations} specifies the number of times the transform is
  10903. applied to the image, and defaults to 1.
  10904. Some examples:
  10905. @example
  10906. # Use the default values
  10907. ocv=dilate
  10908. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10909. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10910. # Read the shape from the file diamond.shape, iterating two times.
  10911. # The file diamond.shape may contain a pattern of characters like this
  10912. # *
  10913. # ***
  10914. # *****
  10915. # ***
  10916. # *
  10917. # The specified columns and rows are ignored
  10918. # but the anchor point coordinates are not
  10919. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10920. @end example
  10921. @subsection erode
  10922. Erode an image by using a specific structuring element.
  10923. It corresponds to the libopencv function @code{cvErode}.
  10924. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10925. with the same syntax and semantics as the @ref{dilate} filter.
  10926. @subsection smooth
  10927. Smooth the input video.
  10928. The filter takes the following parameters:
  10929. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10930. @var{type} is the type of smooth filter to apply, and must be one of
  10931. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10932. or "bilateral". The default value is "gaussian".
  10933. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10934. depends on the smooth type. @var{param1} and
  10935. @var{param2} accept integer positive values or 0. @var{param3} and
  10936. @var{param4} accept floating point values.
  10937. The default value for @var{param1} is 3. The default value for the
  10938. other parameters is 0.
  10939. These parameters correspond to the parameters assigned to the
  10940. libopencv function @code{cvSmooth}.
  10941. @section oscilloscope
  10942. 2D Video Oscilloscope.
  10943. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10944. It accepts the following parameters:
  10945. @table @option
  10946. @item x
  10947. Set scope center x position.
  10948. @item y
  10949. Set scope center y position.
  10950. @item s
  10951. Set scope size, relative to frame diagonal.
  10952. @item t
  10953. Set scope tilt/rotation.
  10954. @item o
  10955. Set trace opacity.
  10956. @item tx
  10957. Set trace center x position.
  10958. @item ty
  10959. Set trace center y position.
  10960. @item tw
  10961. Set trace width, relative to width of frame.
  10962. @item th
  10963. Set trace height, relative to height of frame.
  10964. @item c
  10965. Set which components to trace. By default it traces first three components.
  10966. @item g
  10967. Draw trace grid. By default is enabled.
  10968. @item st
  10969. Draw some statistics. By default is enabled.
  10970. @item sc
  10971. Draw scope. By default is enabled.
  10972. @end table
  10973. @subsection Commands
  10974. This filter supports same @ref{commands} as options.
  10975. The command accepts the same syntax of the corresponding option.
  10976. If the specified expression is not valid, it is kept at its current
  10977. value.
  10978. @subsection Examples
  10979. @itemize
  10980. @item
  10981. Inspect full first row of video frame.
  10982. @example
  10983. oscilloscope=x=0.5:y=0:s=1
  10984. @end example
  10985. @item
  10986. Inspect full last row of video frame.
  10987. @example
  10988. oscilloscope=x=0.5:y=1:s=1
  10989. @end example
  10990. @item
  10991. Inspect full 5th line of video frame of height 1080.
  10992. @example
  10993. oscilloscope=x=0.5:y=5/1080:s=1
  10994. @end example
  10995. @item
  10996. Inspect full last column of video frame.
  10997. @example
  10998. oscilloscope=x=1:y=0.5:s=1:t=1
  10999. @end example
  11000. @end itemize
  11001. @anchor{overlay}
  11002. @section overlay
  11003. Overlay one video on top of another.
  11004. It takes two inputs and has one output. The first input is the "main"
  11005. video on which the second input is overlaid.
  11006. It accepts the following parameters:
  11007. A description of the accepted options follows.
  11008. @table @option
  11009. @item x
  11010. @item y
  11011. Set the expression for the x and y coordinates of the overlaid video
  11012. on the main video. Default value is "0" for both expressions. In case
  11013. the expression is invalid, it is set to a huge value (meaning that the
  11014. overlay will not be displayed within the output visible area).
  11015. @item eof_action
  11016. See @ref{framesync}.
  11017. @item eval
  11018. Set when the expressions for @option{x}, and @option{y} are evaluated.
  11019. It accepts the following values:
  11020. @table @samp
  11021. @item init
  11022. only evaluate expressions once during the filter initialization or
  11023. when a command is processed
  11024. @item frame
  11025. evaluate expressions for each incoming frame
  11026. @end table
  11027. Default value is @samp{frame}.
  11028. @item shortest
  11029. See @ref{framesync}.
  11030. @item format
  11031. Set the format for the output video.
  11032. It accepts the following values:
  11033. @table @samp
  11034. @item yuv420
  11035. force YUV420 output
  11036. @item yuv420p10
  11037. force YUV420p10 output
  11038. @item yuv422
  11039. force YUV422 output
  11040. @item yuv422p10
  11041. force YUV422p10 output
  11042. @item yuv444
  11043. force YUV444 output
  11044. @item rgb
  11045. force packed RGB output
  11046. @item gbrp
  11047. force planar RGB output
  11048. @item auto
  11049. automatically pick format
  11050. @end table
  11051. Default value is @samp{yuv420}.
  11052. @item repeatlast
  11053. See @ref{framesync}.
  11054. @item alpha
  11055. Set format of alpha of the overlaid video, it can be @var{straight} or
  11056. @var{premultiplied}. Default is @var{straight}.
  11057. @end table
  11058. The @option{x}, and @option{y} expressions can contain the following
  11059. parameters.
  11060. @table @option
  11061. @item main_w, W
  11062. @item main_h, H
  11063. The main input width and height.
  11064. @item overlay_w, w
  11065. @item overlay_h, h
  11066. The overlay input width and height.
  11067. @item x
  11068. @item y
  11069. The computed values for @var{x} and @var{y}. They are evaluated for
  11070. each new frame.
  11071. @item hsub
  11072. @item vsub
  11073. horizontal and vertical chroma subsample values of the output
  11074. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  11075. @var{vsub} is 1.
  11076. @item n
  11077. the number of input frame, starting from 0
  11078. @item pos
  11079. the position in the file of the input frame, NAN if unknown
  11080. @item t
  11081. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  11082. @end table
  11083. This filter also supports the @ref{framesync} options.
  11084. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  11085. when evaluation is done @emph{per frame}, and will evaluate to NAN
  11086. when @option{eval} is set to @samp{init}.
  11087. Be aware that frames are taken from each input video in timestamp
  11088. order, hence, if their initial timestamps differ, it is a good idea
  11089. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  11090. have them begin in the same zero timestamp, as the example for
  11091. the @var{movie} filter does.
  11092. You can chain together more overlays but you should test the
  11093. efficiency of such approach.
  11094. @subsection Commands
  11095. This filter supports the following commands:
  11096. @table @option
  11097. @item x
  11098. @item y
  11099. Modify the x and y of the overlay input.
  11100. The command accepts the same syntax of the corresponding option.
  11101. If the specified expression is not valid, it is kept at its current
  11102. value.
  11103. @end table
  11104. @subsection Examples
  11105. @itemize
  11106. @item
  11107. Draw the overlay at 10 pixels from the bottom right corner of the main
  11108. video:
  11109. @example
  11110. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  11111. @end example
  11112. Using named options the example above becomes:
  11113. @example
  11114. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  11115. @end example
  11116. @item
  11117. Insert a transparent PNG logo in the bottom left corner of the input,
  11118. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  11119. @example
  11120. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  11121. @end example
  11122. @item
  11123. Insert 2 different transparent PNG logos (second logo on bottom
  11124. right corner) using the @command{ffmpeg} tool:
  11125. @example
  11126. 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
  11127. @end example
  11128. @item
  11129. Add a transparent color layer on top of the main video; @code{WxH}
  11130. must specify the size of the main input to the overlay filter:
  11131. @example
  11132. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  11133. @end example
  11134. @item
  11135. Play an original video and a filtered version (here with the deshake
  11136. filter) side by side using the @command{ffplay} tool:
  11137. @example
  11138. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  11139. @end example
  11140. The above command is the same as:
  11141. @example
  11142. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  11143. @end example
  11144. @item
  11145. Make a sliding overlay appearing from the left to the right top part of the
  11146. screen starting since time 2:
  11147. @example
  11148. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  11149. @end example
  11150. @item
  11151. Compose output by putting two input videos side to side:
  11152. @example
  11153. ffmpeg -i left.avi -i right.avi -filter_complex "
  11154. nullsrc=size=200x100 [background];
  11155. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  11156. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  11157. [background][left] overlay=shortest=1 [background+left];
  11158. [background+left][right] overlay=shortest=1:x=100 [left+right]
  11159. "
  11160. @end example
  11161. @item
  11162. Mask 10-20 seconds of a video by applying the delogo filter to a section
  11163. @example
  11164. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  11165. -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]'
  11166. masked.avi
  11167. @end example
  11168. @item
  11169. Chain several overlays in cascade:
  11170. @example
  11171. nullsrc=s=200x200 [bg];
  11172. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  11173. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  11174. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  11175. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  11176. [in3] null, [mid2] overlay=100:100 [out0]
  11177. @end example
  11178. @end itemize
  11179. @anchor{overlay_cuda}
  11180. @section overlay_cuda
  11181. Overlay one video on top of another.
  11182. This is the CUDA cariant of the @ref{overlay} filter.
  11183. It only accepts CUDA frames. The underlying input pixel formats have to match.
  11184. It takes two inputs and has one output. The first input is the "main"
  11185. video on which the second input is overlaid.
  11186. It accepts the following parameters:
  11187. @table @option
  11188. @item x
  11189. @item y
  11190. Set the x and y coordinates of the overlaid video on the main video.
  11191. Default value is "0" for both expressions.
  11192. @item eof_action
  11193. See @ref{framesync}.
  11194. @item shortest
  11195. See @ref{framesync}.
  11196. @item repeatlast
  11197. See @ref{framesync}.
  11198. @end table
  11199. This filter also supports the @ref{framesync} options.
  11200. @section owdenoise
  11201. Apply Overcomplete Wavelet denoiser.
  11202. The filter accepts the following options:
  11203. @table @option
  11204. @item depth
  11205. Set depth.
  11206. Larger depth values will denoise lower frequency components more, but
  11207. slow down filtering.
  11208. Must be an int in the range 8-16, default is @code{8}.
  11209. @item luma_strength, ls
  11210. Set luma strength.
  11211. Must be a double value in the range 0-1000, default is @code{1.0}.
  11212. @item chroma_strength, cs
  11213. Set chroma strength.
  11214. Must be a double value in the range 0-1000, default is @code{1.0}.
  11215. @end table
  11216. @anchor{pad}
  11217. @section pad
  11218. Add paddings to the input image, and place the original input at the
  11219. provided @var{x}, @var{y} coordinates.
  11220. It accepts the following parameters:
  11221. @table @option
  11222. @item width, w
  11223. @item height, h
  11224. Specify an expression for the size of the output image with the
  11225. paddings added. If the value for @var{width} or @var{height} is 0, the
  11226. corresponding input size is used for the output.
  11227. The @var{width} expression can reference the value set by the
  11228. @var{height} expression, and vice versa.
  11229. The default value of @var{width} and @var{height} is 0.
  11230. @item x
  11231. @item y
  11232. Specify the offsets to place the input image at within the padded area,
  11233. with respect to the top/left border of the output image.
  11234. The @var{x} expression can reference the value set by the @var{y}
  11235. expression, and vice versa.
  11236. The default value of @var{x} and @var{y} is 0.
  11237. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  11238. so the input image is centered on the padded area.
  11239. @item color
  11240. Specify the color of the padded area. For the syntax of this option,
  11241. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11242. manual,ffmpeg-utils}.
  11243. The default value of @var{color} is "black".
  11244. @item eval
  11245. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  11246. It accepts the following values:
  11247. @table @samp
  11248. @item init
  11249. Only evaluate expressions once during the filter initialization or when
  11250. a command is processed.
  11251. @item frame
  11252. Evaluate expressions for each incoming frame.
  11253. @end table
  11254. Default value is @samp{init}.
  11255. @item aspect
  11256. Pad to aspect instead to a resolution.
  11257. @end table
  11258. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  11259. options are expressions containing the following constants:
  11260. @table @option
  11261. @item in_w
  11262. @item in_h
  11263. The input video width and height.
  11264. @item iw
  11265. @item ih
  11266. These are the same as @var{in_w} and @var{in_h}.
  11267. @item out_w
  11268. @item out_h
  11269. The output width and height (the size of the padded area), as
  11270. specified by the @var{width} and @var{height} expressions.
  11271. @item ow
  11272. @item oh
  11273. These are the same as @var{out_w} and @var{out_h}.
  11274. @item x
  11275. @item y
  11276. The x and y offsets as specified by the @var{x} and @var{y}
  11277. expressions, or NAN if not yet specified.
  11278. @item a
  11279. same as @var{iw} / @var{ih}
  11280. @item sar
  11281. input sample aspect ratio
  11282. @item dar
  11283. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  11284. @item hsub
  11285. @item vsub
  11286. The horizontal and vertical chroma subsample values. For example for the
  11287. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11288. @end table
  11289. @subsection Examples
  11290. @itemize
  11291. @item
  11292. Add paddings with the color "violet" to the input video. The output video
  11293. size is 640x480, and the top-left corner of the input video is placed at
  11294. column 0, row 40
  11295. @example
  11296. pad=640:480:0:40:violet
  11297. @end example
  11298. The example above is equivalent to the following command:
  11299. @example
  11300. pad=width=640:height=480:x=0:y=40:color=violet
  11301. @end example
  11302. @item
  11303. Pad the input to get an output with dimensions increased by 3/2,
  11304. and put the input video at the center of the padded area:
  11305. @example
  11306. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  11307. @end example
  11308. @item
  11309. Pad the input to get a squared output with size equal to the maximum
  11310. value between the input width and height, and put the input video at
  11311. the center of the padded area:
  11312. @example
  11313. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  11314. @end example
  11315. @item
  11316. Pad the input to get a final w/h ratio of 16:9:
  11317. @example
  11318. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  11319. @end example
  11320. @item
  11321. In case of anamorphic video, in order to set the output display aspect
  11322. correctly, it is necessary to use @var{sar} in the expression,
  11323. according to the relation:
  11324. @example
  11325. (ih * X / ih) * sar = output_dar
  11326. X = output_dar / sar
  11327. @end example
  11328. Thus the previous example needs to be modified to:
  11329. @example
  11330. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  11331. @end example
  11332. @item
  11333. Double the output size and put the input video in the bottom-right
  11334. corner of the output padded area:
  11335. @example
  11336. pad="2*iw:2*ih:ow-iw:oh-ih"
  11337. @end example
  11338. @end itemize
  11339. @anchor{palettegen}
  11340. @section palettegen
  11341. Generate one palette for a whole video stream.
  11342. It accepts the following options:
  11343. @table @option
  11344. @item max_colors
  11345. Set the maximum number of colors to quantize in the palette.
  11346. Note: the palette will still contain 256 colors; the unused palette entries
  11347. will be black.
  11348. @item reserve_transparent
  11349. Create a palette of 255 colors maximum and reserve the last one for
  11350. transparency. Reserving the transparency color is useful for GIF optimization.
  11351. If not set, the maximum of colors in the palette will be 256. You probably want
  11352. to disable this option for a standalone image.
  11353. Set by default.
  11354. @item transparency_color
  11355. Set the color that will be used as background for transparency.
  11356. @item stats_mode
  11357. Set statistics mode.
  11358. It accepts the following values:
  11359. @table @samp
  11360. @item full
  11361. Compute full frame histograms.
  11362. @item diff
  11363. Compute histograms only for the part that differs from previous frame. This
  11364. might be relevant to give more importance to the moving part of your input if
  11365. the background is static.
  11366. @item single
  11367. Compute new histogram for each frame.
  11368. @end table
  11369. Default value is @var{full}.
  11370. @end table
  11371. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11372. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11373. color quantization of the palette. This information is also visible at
  11374. @var{info} logging level.
  11375. @subsection Examples
  11376. @itemize
  11377. @item
  11378. Generate a representative palette of a given video using @command{ffmpeg}:
  11379. @example
  11380. ffmpeg -i input.mkv -vf palettegen palette.png
  11381. @end example
  11382. @end itemize
  11383. @section paletteuse
  11384. Use a palette to downsample an input video stream.
  11385. The filter takes two inputs: one video stream and a palette. The palette must
  11386. be a 256 pixels image.
  11387. It accepts the following options:
  11388. @table @option
  11389. @item dither
  11390. Select dithering mode. Available algorithms are:
  11391. @table @samp
  11392. @item bayer
  11393. Ordered 8x8 bayer dithering (deterministic)
  11394. @item heckbert
  11395. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11396. Note: this dithering is sometimes considered "wrong" and is included as a
  11397. reference.
  11398. @item floyd_steinberg
  11399. Floyd and Steingberg dithering (error diffusion)
  11400. @item sierra2
  11401. Frankie Sierra dithering v2 (error diffusion)
  11402. @item sierra2_4a
  11403. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11404. @end table
  11405. Default is @var{sierra2_4a}.
  11406. @item bayer_scale
  11407. When @var{bayer} dithering is selected, this option defines the scale of the
  11408. pattern (how much the crosshatch pattern is visible). A low value means more
  11409. visible pattern for less banding, and higher value means less visible pattern
  11410. at the cost of more banding.
  11411. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11412. @item diff_mode
  11413. If set, define the zone to process
  11414. @table @samp
  11415. @item rectangle
  11416. Only the changing rectangle will be reprocessed. This is similar to GIF
  11417. cropping/offsetting compression mechanism. This option can be useful for speed
  11418. if only a part of the image is changing, and has use cases such as limiting the
  11419. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11420. moving scene (it leads to more deterministic output if the scene doesn't change
  11421. much, and as a result less moving noise and better GIF compression).
  11422. @end table
  11423. Default is @var{none}.
  11424. @item new
  11425. Take new palette for each output frame.
  11426. @item alpha_threshold
  11427. Sets the alpha threshold for transparency. Alpha values above this threshold
  11428. will be treated as completely opaque, and values below this threshold will be
  11429. treated as completely transparent.
  11430. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11431. @end table
  11432. @subsection Examples
  11433. @itemize
  11434. @item
  11435. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11436. using @command{ffmpeg}:
  11437. @example
  11438. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11439. @end example
  11440. @end itemize
  11441. @section perspective
  11442. Correct perspective of video not recorded perpendicular to the screen.
  11443. A description of the accepted parameters follows.
  11444. @table @option
  11445. @item x0
  11446. @item y0
  11447. @item x1
  11448. @item y1
  11449. @item x2
  11450. @item y2
  11451. @item x3
  11452. @item y3
  11453. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11454. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11455. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11456. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11457. then the corners of the source will be sent to the specified coordinates.
  11458. The expressions can use the following variables:
  11459. @table @option
  11460. @item W
  11461. @item H
  11462. the width and height of video frame.
  11463. @item in
  11464. Input frame count.
  11465. @item on
  11466. Output frame count.
  11467. @end table
  11468. @item interpolation
  11469. Set interpolation for perspective correction.
  11470. It accepts the following values:
  11471. @table @samp
  11472. @item linear
  11473. @item cubic
  11474. @end table
  11475. Default value is @samp{linear}.
  11476. @item sense
  11477. Set interpretation of coordinate options.
  11478. It accepts the following values:
  11479. @table @samp
  11480. @item 0, source
  11481. Send point in the source specified by the given coordinates to
  11482. the corners of the destination.
  11483. @item 1, destination
  11484. Send the corners of the source to the point in the destination specified
  11485. by the given coordinates.
  11486. Default value is @samp{source}.
  11487. @end table
  11488. @item eval
  11489. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11490. It accepts the following values:
  11491. @table @samp
  11492. @item init
  11493. only evaluate expressions once during the filter initialization or
  11494. when a command is processed
  11495. @item frame
  11496. evaluate expressions for each incoming frame
  11497. @end table
  11498. Default value is @samp{init}.
  11499. @end table
  11500. @section phase
  11501. Delay interlaced video by one field time so that the field order changes.
  11502. The intended use is to fix PAL movies that have been captured with the
  11503. opposite field order to the film-to-video transfer.
  11504. A description of the accepted parameters follows.
  11505. @table @option
  11506. @item mode
  11507. Set phase mode.
  11508. It accepts the following values:
  11509. @table @samp
  11510. @item t
  11511. Capture field order top-first, transfer bottom-first.
  11512. Filter will delay the bottom field.
  11513. @item b
  11514. Capture field order bottom-first, transfer top-first.
  11515. Filter will delay the top field.
  11516. @item p
  11517. Capture and transfer with the same field order. This mode only exists
  11518. for the documentation of the other options to refer to, but if you
  11519. actually select it, the filter will faithfully do nothing.
  11520. @item a
  11521. Capture field order determined automatically by field flags, transfer
  11522. opposite.
  11523. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11524. basis using field flags. If no field information is available,
  11525. then this works just like @samp{u}.
  11526. @item u
  11527. Capture unknown or varying, transfer opposite.
  11528. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11529. analyzing the images and selecting the alternative that produces best
  11530. match between the fields.
  11531. @item T
  11532. Capture top-first, transfer unknown or varying.
  11533. Filter selects among @samp{t} and @samp{p} using image analysis.
  11534. @item B
  11535. Capture bottom-first, transfer unknown or varying.
  11536. Filter selects among @samp{b} and @samp{p} using image analysis.
  11537. @item A
  11538. Capture determined by field flags, transfer unknown or varying.
  11539. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11540. image analysis. If no field information is available, then this works just
  11541. like @samp{U}. This is the default mode.
  11542. @item U
  11543. Both capture and transfer unknown or varying.
  11544. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11545. @end table
  11546. @end table
  11547. @section photosensitivity
  11548. Reduce various flashes in video, so to help users with epilepsy.
  11549. It accepts the following options:
  11550. @table @option
  11551. @item frames, f
  11552. Set how many frames to use when filtering. Default is 30.
  11553. @item threshold, t
  11554. Set detection threshold factor. Default is 1.
  11555. Lower is stricter.
  11556. @item skip
  11557. Set how many pixels to skip when sampling frames. Default is 1.
  11558. Allowed range is from 1 to 1024.
  11559. @item bypass
  11560. Leave frames unchanged. Default is disabled.
  11561. @end table
  11562. @section pixdesctest
  11563. Pixel format descriptor test filter, mainly useful for internal
  11564. testing. The output video should be equal to the input video.
  11565. For example:
  11566. @example
  11567. format=monow, pixdesctest
  11568. @end example
  11569. can be used to test the monowhite pixel format descriptor definition.
  11570. @section pixscope
  11571. Display sample values of color channels. Mainly useful for checking color
  11572. and levels. Minimum supported resolution is 640x480.
  11573. The filters accept the following options:
  11574. @table @option
  11575. @item x
  11576. Set scope X position, relative offset on X axis.
  11577. @item y
  11578. Set scope Y position, relative offset on Y axis.
  11579. @item w
  11580. Set scope width.
  11581. @item h
  11582. Set scope height.
  11583. @item o
  11584. Set window opacity. This window also holds statistics about pixel area.
  11585. @item wx
  11586. Set window X position, relative offset on X axis.
  11587. @item wy
  11588. Set window Y position, relative offset on Y axis.
  11589. @end table
  11590. @section pp
  11591. Enable the specified chain of postprocessing subfilters using libpostproc. This
  11592. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  11593. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  11594. Each subfilter and some options have a short and a long name that can be used
  11595. interchangeably, i.e. dr/dering are the same.
  11596. The filters accept the following options:
  11597. @table @option
  11598. @item subfilters
  11599. Set postprocessing subfilters string.
  11600. @end table
  11601. All subfilters share common options to determine their scope:
  11602. @table @option
  11603. @item a/autoq
  11604. Honor the quality commands for this subfilter.
  11605. @item c/chrom
  11606. Do chrominance filtering, too (default).
  11607. @item y/nochrom
  11608. Do luminance filtering only (no chrominance).
  11609. @item n/noluma
  11610. Do chrominance filtering only (no luminance).
  11611. @end table
  11612. These options can be appended after the subfilter name, separated by a '|'.
  11613. Available subfilters are:
  11614. @table @option
  11615. @item hb/hdeblock[|difference[|flatness]]
  11616. Horizontal deblocking filter
  11617. @table @option
  11618. @item difference
  11619. Difference factor where higher values mean more deblocking (default: @code{32}).
  11620. @item flatness
  11621. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11622. @end table
  11623. @item vb/vdeblock[|difference[|flatness]]
  11624. Vertical deblocking filter
  11625. @table @option
  11626. @item difference
  11627. Difference factor where higher values mean more deblocking (default: @code{32}).
  11628. @item flatness
  11629. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11630. @end table
  11631. @item ha/hadeblock[|difference[|flatness]]
  11632. Accurate horizontal deblocking filter
  11633. @table @option
  11634. @item difference
  11635. Difference factor where higher values mean more deblocking (default: @code{32}).
  11636. @item flatness
  11637. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11638. @end table
  11639. @item va/vadeblock[|difference[|flatness]]
  11640. Accurate vertical deblocking filter
  11641. @table @option
  11642. @item difference
  11643. Difference factor where higher values mean more deblocking (default: @code{32}).
  11644. @item flatness
  11645. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11646. @end table
  11647. @end table
  11648. The horizontal and vertical deblocking filters share the difference and
  11649. flatness values so you cannot set different horizontal and vertical
  11650. thresholds.
  11651. @table @option
  11652. @item h1/x1hdeblock
  11653. Experimental horizontal deblocking filter
  11654. @item v1/x1vdeblock
  11655. Experimental vertical deblocking filter
  11656. @item dr/dering
  11657. Deringing filter
  11658. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  11659. @table @option
  11660. @item threshold1
  11661. larger -> stronger filtering
  11662. @item threshold2
  11663. larger -> stronger filtering
  11664. @item threshold3
  11665. larger -> stronger filtering
  11666. @end table
  11667. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  11668. @table @option
  11669. @item f/fullyrange
  11670. Stretch luminance to @code{0-255}.
  11671. @end table
  11672. @item lb/linblenddeint
  11673. Linear blend deinterlacing filter that deinterlaces the given block by
  11674. filtering all lines with a @code{(1 2 1)} filter.
  11675. @item li/linipoldeint
  11676. Linear interpolating deinterlacing filter that deinterlaces the given block by
  11677. linearly interpolating every second line.
  11678. @item ci/cubicipoldeint
  11679. Cubic interpolating deinterlacing filter deinterlaces the given block by
  11680. cubically interpolating every second line.
  11681. @item md/mediandeint
  11682. Median deinterlacing filter that deinterlaces the given block by applying a
  11683. median filter to every second line.
  11684. @item fd/ffmpegdeint
  11685. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  11686. second line with a @code{(-1 4 2 4 -1)} filter.
  11687. @item l5/lowpass5
  11688. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  11689. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  11690. @item fq/forceQuant[|quantizer]
  11691. Overrides the quantizer table from the input with the constant quantizer you
  11692. specify.
  11693. @table @option
  11694. @item quantizer
  11695. Quantizer to use
  11696. @end table
  11697. @item de/default
  11698. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  11699. @item fa/fast
  11700. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  11701. @item ac
  11702. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11703. @end table
  11704. @subsection Examples
  11705. @itemize
  11706. @item
  11707. Apply horizontal and vertical deblocking, deringing and automatic
  11708. brightness/contrast:
  11709. @example
  11710. pp=hb/vb/dr/al
  11711. @end example
  11712. @item
  11713. Apply default filters without brightness/contrast correction:
  11714. @example
  11715. pp=de/-al
  11716. @end example
  11717. @item
  11718. Apply default filters and temporal denoiser:
  11719. @example
  11720. pp=default/tmpnoise|1|2|3
  11721. @end example
  11722. @item
  11723. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11724. automatically depending on available CPU time:
  11725. @example
  11726. pp=hb|y/vb|a
  11727. @end example
  11728. @end itemize
  11729. @section pp7
  11730. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11731. similar to spp = 6 with 7 point DCT, where only the center sample is
  11732. used after IDCT.
  11733. The filter accepts the following options:
  11734. @table @option
  11735. @item qp
  11736. Force a constant quantization parameter. It accepts an integer in range
  11737. 0 to 63. If not set, the filter will use the QP from the video stream
  11738. (if available).
  11739. @item mode
  11740. Set thresholding mode. Available modes are:
  11741. @table @samp
  11742. @item hard
  11743. Set hard thresholding.
  11744. @item soft
  11745. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11746. @item medium
  11747. Set medium thresholding (good results, default).
  11748. @end table
  11749. @end table
  11750. @section premultiply
  11751. Apply alpha premultiply effect to input video stream using first plane
  11752. of second stream as alpha.
  11753. Both streams must have same dimensions and same pixel format.
  11754. The filter accepts the following option:
  11755. @table @option
  11756. @item planes
  11757. Set which planes will be processed, unprocessed planes will be copied.
  11758. By default value 0xf, all planes will be processed.
  11759. @item inplace
  11760. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11761. @end table
  11762. @section prewitt
  11763. Apply prewitt operator to input video stream.
  11764. The filter accepts the following option:
  11765. @table @option
  11766. @item planes
  11767. Set which planes will be processed, unprocessed planes will be copied.
  11768. By default value 0xf, all planes will be processed.
  11769. @item scale
  11770. Set value which will be multiplied with filtered result.
  11771. @item delta
  11772. Set value which will be added to filtered result.
  11773. @end table
  11774. @section pseudocolor
  11775. Alter frame colors in video with pseudocolors.
  11776. This filter accepts the following options:
  11777. @table @option
  11778. @item c0
  11779. set pixel first component expression
  11780. @item c1
  11781. set pixel second component expression
  11782. @item c2
  11783. set pixel third component expression
  11784. @item c3
  11785. set pixel fourth component expression, corresponds to the alpha component
  11786. @item i
  11787. set component to use as base for altering colors
  11788. @end table
  11789. Each of them specifies the expression to use for computing the lookup table for
  11790. the corresponding pixel component values.
  11791. The expressions can contain the following constants and functions:
  11792. @table @option
  11793. @item w
  11794. @item h
  11795. The input width and height.
  11796. @item val
  11797. The input value for the pixel component.
  11798. @item ymin, umin, vmin, amin
  11799. The minimum allowed component value.
  11800. @item ymax, umax, vmax, amax
  11801. The maximum allowed component value.
  11802. @end table
  11803. All expressions default to "val".
  11804. @subsection Examples
  11805. @itemize
  11806. @item
  11807. Change too high luma values to gradient:
  11808. @example
  11809. 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'"
  11810. @end example
  11811. @end itemize
  11812. @section psnr
  11813. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11814. Ratio) between two input videos.
  11815. This filter takes in input two input videos, the first input is
  11816. considered the "main" source and is passed unchanged to the
  11817. output. The second input is used as a "reference" video for computing
  11818. the PSNR.
  11819. Both video inputs must have the same resolution and pixel format for
  11820. this filter to work correctly. Also it assumes that both inputs
  11821. have the same number of frames, which are compared one by one.
  11822. The obtained average PSNR is printed through the logging system.
  11823. The filter stores the accumulated MSE (mean squared error) of each
  11824. frame, and at the end of the processing it is averaged across all frames
  11825. equally, and the following formula is applied to obtain the PSNR:
  11826. @example
  11827. PSNR = 10*log10(MAX^2/MSE)
  11828. @end example
  11829. Where MAX is the average of the maximum values of each component of the
  11830. image.
  11831. The description of the accepted parameters follows.
  11832. @table @option
  11833. @item stats_file, f
  11834. If specified the filter will use the named file to save the PSNR of
  11835. each individual frame. When filename equals "-" the data is sent to
  11836. standard output.
  11837. @item stats_version
  11838. Specifies which version of the stats file format to use. Details of
  11839. each format are written below.
  11840. Default value is 1.
  11841. @item stats_add_max
  11842. Determines whether the max value is output to the stats log.
  11843. Default value is 0.
  11844. Requires stats_version >= 2. If this is set and stats_version < 2,
  11845. the filter will return an error.
  11846. @end table
  11847. This filter also supports the @ref{framesync} options.
  11848. The file printed if @var{stats_file} is selected, contains a sequence of
  11849. key/value pairs of the form @var{key}:@var{value} for each compared
  11850. couple of frames.
  11851. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11852. the list of per-frame-pair stats, with key value pairs following the frame
  11853. format with the following parameters:
  11854. @table @option
  11855. @item psnr_log_version
  11856. The version of the log file format. Will match @var{stats_version}.
  11857. @item fields
  11858. A comma separated list of the per-frame-pair parameters included in
  11859. the log.
  11860. @end table
  11861. A description of each shown per-frame-pair parameter follows:
  11862. @table @option
  11863. @item n
  11864. sequential number of the input frame, starting from 1
  11865. @item mse_avg
  11866. Mean Square Error pixel-by-pixel average difference of the compared
  11867. frames, averaged over all the image components.
  11868. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11869. Mean Square Error pixel-by-pixel average difference of the compared
  11870. frames for the component specified by the suffix.
  11871. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11872. Peak Signal to Noise ratio of the compared frames for the component
  11873. specified by the suffix.
  11874. @item max_avg, max_y, max_u, max_v
  11875. Maximum allowed value for each channel, and average over all
  11876. channels.
  11877. @end table
  11878. @subsection Examples
  11879. @itemize
  11880. @item
  11881. For example:
  11882. @example
  11883. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11884. [main][ref] psnr="stats_file=stats.log" [out]
  11885. @end example
  11886. On this example the input file being processed is compared with the
  11887. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11888. is stored in @file{stats.log}.
  11889. @item
  11890. Another example with different containers:
  11891. @example
  11892. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]psnr" -f null -
  11893. @end example
  11894. @end itemize
  11895. @anchor{pullup}
  11896. @section pullup
  11897. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11898. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11899. content.
  11900. The pullup filter is designed to take advantage of future context in making
  11901. its decisions. This filter is stateless in the sense that it does not lock
  11902. onto a pattern to follow, but it instead looks forward to the following
  11903. fields in order to identify matches and rebuild progressive frames.
  11904. To produce content with an even framerate, insert the fps filter after
  11905. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11906. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11907. The filter accepts the following options:
  11908. @table @option
  11909. @item jl
  11910. @item jr
  11911. @item jt
  11912. @item jb
  11913. These options set the amount of "junk" to ignore at the left, right, top, and
  11914. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11915. while top and bottom are in units of 2 lines.
  11916. The default is 8 pixels on each side.
  11917. @item sb
  11918. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11919. filter generating an occasional mismatched frame, but it may also cause an
  11920. excessive number of frames to be dropped during high motion sequences.
  11921. Conversely, setting it to -1 will make filter match fields more easily.
  11922. This may help processing of video where there is slight blurring between
  11923. the fields, but may also cause there to be interlaced frames in the output.
  11924. Default value is @code{0}.
  11925. @item mp
  11926. Set the metric plane to use. It accepts the following values:
  11927. @table @samp
  11928. @item l
  11929. Use luma plane.
  11930. @item u
  11931. Use chroma blue plane.
  11932. @item v
  11933. Use chroma red plane.
  11934. @end table
  11935. This option may be set to use chroma plane instead of the default luma plane
  11936. for doing filter's computations. This may improve accuracy on very clean
  11937. source material, but more likely will decrease accuracy, especially if there
  11938. is chroma noise (rainbow effect) or any grayscale video.
  11939. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11940. load and make pullup usable in realtime on slow machines.
  11941. @end table
  11942. For best results (without duplicated frames in the output file) it is
  11943. necessary to change the output frame rate. For example, to inverse
  11944. telecine NTSC input:
  11945. @example
  11946. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11947. @end example
  11948. @section qp
  11949. Change video quantization parameters (QP).
  11950. The filter accepts the following option:
  11951. @table @option
  11952. @item qp
  11953. Set expression for quantization parameter.
  11954. @end table
  11955. The expression is evaluated through the eval API and can contain, among others,
  11956. the following constants:
  11957. @table @var
  11958. @item known
  11959. 1 if index is not 129, 0 otherwise.
  11960. @item qp
  11961. Sequential index starting from -129 to 128.
  11962. @end table
  11963. @subsection Examples
  11964. @itemize
  11965. @item
  11966. Some equation like:
  11967. @example
  11968. qp=2+2*sin(PI*qp)
  11969. @end example
  11970. @end itemize
  11971. @section random
  11972. Flush video frames from internal cache of frames into a random order.
  11973. No frame is discarded.
  11974. Inspired by @ref{frei0r} nervous filter.
  11975. @table @option
  11976. @item frames
  11977. Set size in number of frames of internal cache, in range from @code{2} to
  11978. @code{512}. Default is @code{30}.
  11979. @item seed
  11980. Set seed for random number generator, must be an integer included between
  11981. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11982. less than @code{0}, the filter will try to use a good random seed on a
  11983. best effort basis.
  11984. @end table
  11985. @section readeia608
  11986. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11987. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11988. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11989. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11990. @table @option
  11991. @item lavfi.readeia608.X.cc
  11992. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11993. @item lavfi.readeia608.X.line
  11994. The number of the line on which the EIA-608 data was identified and read.
  11995. @end table
  11996. This filter accepts the following options:
  11997. @table @option
  11998. @item scan_min
  11999. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  12000. @item scan_max
  12001. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  12002. @item spw
  12003. Set the ratio of width reserved for sync code detection.
  12004. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  12005. @item chp
  12006. Enable checking the parity bit. In the event of a parity error, the filter will output
  12007. @code{0x00} for that character. Default is false.
  12008. @item lp
  12009. Lowpass lines prior to further processing. Default is enabled.
  12010. @end table
  12011. @subsection Examples
  12012. @itemize
  12013. @item
  12014. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  12015. @example
  12016. 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
  12017. @end example
  12018. @end itemize
  12019. @section readvitc
  12020. Read vertical interval timecode (VITC) information from the top lines of a
  12021. video frame.
  12022. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  12023. timecode value, if a valid timecode has been detected. Further metadata key
  12024. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  12025. timecode data has been found or not.
  12026. This filter accepts the following options:
  12027. @table @option
  12028. @item scan_max
  12029. Set the maximum number of lines to scan for VITC data. If the value is set to
  12030. @code{-1} the full video frame is scanned. Default is @code{45}.
  12031. @item thr_b
  12032. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  12033. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  12034. @item thr_w
  12035. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  12036. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  12037. @end table
  12038. @subsection Examples
  12039. @itemize
  12040. @item
  12041. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  12042. draw @code{--:--:--:--} as a placeholder:
  12043. @example
  12044. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  12045. @end example
  12046. @end itemize
  12047. @section remap
  12048. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  12049. Destination pixel at position (X, Y) will be picked from source (x, y) position
  12050. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  12051. value for pixel will be used for destination pixel.
  12052. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  12053. will have Xmap/Ymap video stream dimensions.
  12054. Xmap and Ymap input video streams are 16bit depth, single channel.
  12055. @table @option
  12056. @item format
  12057. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  12058. Default is @code{color}.
  12059. @item fill
  12060. Specify the color of the unmapped pixels. For the syntax of this option,
  12061. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12062. manual,ffmpeg-utils}. Default color is @code{black}.
  12063. @end table
  12064. @section removegrain
  12065. The removegrain filter is a spatial denoiser for progressive video.
  12066. @table @option
  12067. @item m0
  12068. Set mode for the first plane.
  12069. @item m1
  12070. Set mode for the second plane.
  12071. @item m2
  12072. Set mode for the third plane.
  12073. @item m3
  12074. Set mode for the fourth plane.
  12075. @end table
  12076. Range of mode is from 0 to 24. Description of each mode follows:
  12077. @table @var
  12078. @item 0
  12079. Leave input plane unchanged. Default.
  12080. @item 1
  12081. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  12082. @item 2
  12083. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  12084. @item 3
  12085. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  12086. @item 4
  12087. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  12088. This is equivalent to a median filter.
  12089. @item 5
  12090. Line-sensitive clipping giving the minimal change.
  12091. @item 6
  12092. Line-sensitive clipping, intermediate.
  12093. @item 7
  12094. Line-sensitive clipping, intermediate.
  12095. @item 8
  12096. Line-sensitive clipping, intermediate.
  12097. @item 9
  12098. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  12099. @item 10
  12100. Replaces the target pixel with the closest neighbour.
  12101. @item 11
  12102. [1 2 1] horizontal and vertical kernel blur.
  12103. @item 12
  12104. Same as mode 11.
  12105. @item 13
  12106. Bob mode, interpolates top field from the line where the neighbours
  12107. pixels are the closest.
  12108. @item 14
  12109. Bob mode, interpolates bottom field from the line where the neighbours
  12110. pixels are the closest.
  12111. @item 15
  12112. Bob mode, interpolates top field. Same as 13 but with a more complicated
  12113. interpolation formula.
  12114. @item 16
  12115. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  12116. interpolation formula.
  12117. @item 17
  12118. Clips the pixel with the minimum and maximum of respectively the maximum and
  12119. minimum of each pair of opposite neighbour pixels.
  12120. @item 18
  12121. Line-sensitive clipping using opposite neighbours whose greatest distance from
  12122. the current pixel is minimal.
  12123. @item 19
  12124. Replaces the pixel with the average of its 8 neighbours.
  12125. @item 20
  12126. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  12127. @item 21
  12128. Clips pixels using the averages of opposite neighbour.
  12129. @item 22
  12130. Same as mode 21 but simpler and faster.
  12131. @item 23
  12132. Small edge and halo removal, but reputed useless.
  12133. @item 24
  12134. Similar as 23.
  12135. @end table
  12136. @section removelogo
  12137. Suppress a TV station logo, using an image file to determine which
  12138. pixels comprise the logo. It works by filling in the pixels that
  12139. comprise the logo with neighboring pixels.
  12140. The filter accepts the following options:
  12141. @table @option
  12142. @item filename, f
  12143. Set the filter bitmap file, which can be any image format supported by
  12144. libavformat. The width and height of the image file must match those of the
  12145. video stream being processed.
  12146. @end table
  12147. Pixels in the provided bitmap image with a value of zero are not
  12148. considered part of the logo, non-zero pixels are considered part of
  12149. the logo. If you use white (255) for the logo and black (0) for the
  12150. rest, you will be safe. For making the filter bitmap, it is
  12151. recommended to take a screen capture of a black frame with the logo
  12152. visible, and then using a threshold filter followed by the erode
  12153. filter once or twice.
  12154. If needed, little splotches can be fixed manually. Remember that if
  12155. logo pixels are not covered, the filter quality will be much
  12156. reduced. Marking too many pixels as part of the logo does not hurt as
  12157. much, but it will increase the amount of blurring needed to cover over
  12158. the image and will destroy more information than necessary, and extra
  12159. pixels will slow things down on a large logo.
  12160. @section repeatfields
  12161. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  12162. fields based on its value.
  12163. @section reverse
  12164. Reverse a video clip.
  12165. Warning: This filter requires memory to buffer the entire clip, so trimming
  12166. is suggested.
  12167. @subsection Examples
  12168. @itemize
  12169. @item
  12170. Take the first 5 seconds of a clip, and reverse it.
  12171. @example
  12172. trim=end=5,reverse
  12173. @end example
  12174. @end itemize
  12175. @section rgbashift
  12176. Shift R/G/B/A pixels horizontally and/or vertically.
  12177. The filter accepts the following options:
  12178. @table @option
  12179. @item rh
  12180. Set amount to shift red horizontally.
  12181. @item rv
  12182. Set amount to shift red vertically.
  12183. @item gh
  12184. Set amount to shift green horizontally.
  12185. @item gv
  12186. Set amount to shift green vertically.
  12187. @item bh
  12188. Set amount to shift blue horizontally.
  12189. @item bv
  12190. Set amount to shift blue vertically.
  12191. @item ah
  12192. Set amount to shift alpha horizontally.
  12193. @item av
  12194. Set amount to shift alpha vertically.
  12195. @item edge
  12196. Set edge mode, can be @var{smear}, default, or @var{warp}.
  12197. @end table
  12198. @subsection Commands
  12199. This filter supports the all above options as @ref{commands}.
  12200. @section roberts
  12201. Apply roberts cross operator to input video stream.
  12202. The filter accepts the following option:
  12203. @table @option
  12204. @item planes
  12205. Set which planes will be processed, unprocessed planes will be copied.
  12206. By default value 0xf, all planes will be processed.
  12207. @item scale
  12208. Set value which will be multiplied with filtered result.
  12209. @item delta
  12210. Set value which will be added to filtered result.
  12211. @end table
  12212. @section rotate
  12213. Rotate video by an arbitrary angle expressed in radians.
  12214. The filter accepts the following options:
  12215. A description of the optional parameters follows.
  12216. @table @option
  12217. @item angle, a
  12218. Set an expression for the angle by which to rotate the input video
  12219. clockwise, expressed as a number of radians. A negative value will
  12220. result in a counter-clockwise rotation. By default it is set to "0".
  12221. This expression is evaluated for each frame.
  12222. @item out_w, ow
  12223. Set the output width expression, default value is "iw".
  12224. This expression is evaluated just once during configuration.
  12225. @item out_h, oh
  12226. Set the output height expression, default value is "ih".
  12227. This expression is evaluated just once during configuration.
  12228. @item bilinear
  12229. Enable bilinear interpolation if set to 1, a value of 0 disables
  12230. it. Default value is 1.
  12231. @item fillcolor, c
  12232. Set the color used to fill the output area not covered by the rotated
  12233. image. For the general syntax of this option, check the
  12234. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12235. If the special value "none" is selected then no
  12236. background is printed (useful for example if the background is never shown).
  12237. Default value is "black".
  12238. @end table
  12239. The expressions for the angle and the output size can contain the
  12240. following constants and functions:
  12241. @table @option
  12242. @item n
  12243. sequential number of the input frame, starting from 0. It is always NAN
  12244. before the first frame is filtered.
  12245. @item t
  12246. time in seconds of the input frame, it is set to 0 when the filter is
  12247. configured. It is always NAN before the first frame is filtered.
  12248. @item hsub
  12249. @item vsub
  12250. horizontal and vertical chroma subsample values. For example for the
  12251. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12252. @item in_w, iw
  12253. @item in_h, ih
  12254. the input video width and height
  12255. @item out_w, ow
  12256. @item out_h, oh
  12257. the output width and height, that is the size of the padded area as
  12258. specified by the @var{width} and @var{height} expressions
  12259. @item rotw(a)
  12260. @item roth(a)
  12261. the minimal width/height required for completely containing the input
  12262. video rotated by @var{a} radians.
  12263. These are only available when computing the @option{out_w} and
  12264. @option{out_h} expressions.
  12265. @end table
  12266. @subsection Examples
  12267. @itemize
  12268. @item
  12269. Rotate the input by PI/6 radians clockwise:
  12270. @example
  12271. rotate=PI/6
  12272. @end example
  12273. @item
  12274. Rotate the input by PI/6 radians counter-clockwise:
  12275. @example
  12276. rotate=-PI/6
  12277. @end example
  12278. @item
  12279. Rotate the input by 45 degrees clockwise:
  12280. @example
  12281. rotate=45*PI/180
  12282. @end example
  12283. @item
  12284. Apply a constant rotation with period T, starting from an angle of PI/3:
  12285. @example
  12286. rotate=PI/3+2*PI*t/T
  12287. @end example
  12288. @item
  12289. Make the input video rotation oscillating with a period of T
  12290. seconds and an amplitude of A radians:
  12291. @example
  12292. rotate=A*sin(2*PI/T*t)
  12293. @end example
  12294. @item
  12295. Rotate the video, output size is chosen so that the whole rotating
  12296. input video is always completely contained in the output:
  12297. @example
  12298. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12299. @end example
  12300. @item
  12301. Rotate the video, reduce the output size so that no background is ever
  12302. shown:
  12303. @example
  12304. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12305. @end example
  12306. @end itemize
  12307. @subsection Commands
  12308. The filter supports the following commands:
  12309. @table @option
  12310. @item a, angle
  12311. Set the angle expression.
  12312. The command accepts the same syntax of the corresponding option.
  12313. If the specified expression is not valid, it is kept at its current
  12314. value.
  12315. @end table
  12316. @section sab
  12317. Apply Shape Adaptive Blur.
  12318. The filter accepts the following options:
  12319. @table @option
  12320. @item luma_radius, lr
  12321. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12322. value is 1.0. A greater value will result in a more blurred image, and
  12323. in slower processing.
  12324. @item luma_pre_filter_radius, lpfr
  12325. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12326. value is 1.0.
  12327. @item luma_strength, ls
  12328. Set luma maximum difference between pixels to still be considered, must
  12329. be a value in the 0.1-100.0 range, default value is 1.0.
  12330. @item chroma_radius, cr
  12331. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12332. greater value will result in a more blurred image, and in slower
  12333. processing.
  12334. @item chroma_pre_filter_radius, cpfr
  12335. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12336. @item chroma_strength, cs
  12337. Set chroma maximum difference between pixels to still be considered,
  12338. must be a value in the -0.9-100.0 range.
  12339. @end table
  12340. Each chroma option value, if not explicitly specified, is set to the
  12341. corresponding luma option value.
  12342. @anchor{scale}
  12343. @section scale
  12344. Scale (resize) the input video, using the libswscale library.
  12345. The scale filter forces the output display aspect ratio to be the same
  12346. of the input, by changing the output sample aspect ratio.
  12347. If the input image format is different from the format requested by
  12348. the next filter, the scale filter will convert the input to the
  12349. requested format.
  12350. @subsection Options
  12351. The filter accepts the following options, or any of the options
  12352. supported by the libswscale scaler.
  12353. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12354. the complete list of scaler options.
  12355. @table @option
  12356. @item width, w
  12357. @item height, h
  12358. Set the output video dimension expression. Default value is the input
  12359. dimension.
  12360. If the @var{width} or @var{w} value is 0, the input width is used for
  12361. the output. If the @var{height} or @var{h} value is 0, the input height
  12362. is used for the output.
  12363. If one and only one of the values is -n with n >= 1, the scale filter
  12364. will use a value that maintains the aspect ratio of the input image,
  12365. calculated from the other specified dimension. After that it will,
  12366. however, make sure that the calculated dimension is divisible by n and
  12367. adjust the value if necessary.
  12368. If both values are -n with n >= 1, the behavior will be identical to
  12369. both values being set to 0 as previously detailed.
  12370. See below for the list of accepted constants for use in the dimension
  12371. expression.
  12372. @item eval
  12373. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12374. @table @samp
  12375. @item init
  12376. Only evaluate expressions once during the filter initialization or when a command is processed.
  12377. @item frame
  12378. Evaluate expressions for each incoming frame.
  12379. @end table
  12380. Default value is @samp{init}.
  12381. @item interl
  12382. Set the interlacing mode. It accepts the following values:
  12383. @table @samp
  12384. @item 1
  12385. Force interlaced aware scaling.
  12386. @item 0
  12387. Do not apply interlaced scaling.
  12388. @item -1
  12389. Select interlaced aware scaling depending on whether the source frames
  12390. are flagged as interlaced or not.
  12391. @end table
  12392. Default value is @samp{0}.
  12393. @item flags
  12394. Set libswscale scaling flags. See
  12395. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12396. complete list of values. If not explicitly specified the filter applies
  12397. the default flags.
  12398. @item param0, param1
  12399. Set libswscale input parameters for scaling algorithms that need them. See
  12400. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12401. complete documentation. If not explicitly specified the filter applies
  12402. empty parameters.
  12403. @item size, s
  12404. Set the video size. For the syntax of this option, check the
  12405. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12406. @item in_color_matrix
  12407. @item out_color_matrix
  12408. Set in/output YCbCr color space type.
  12409. This allows the autodetected value to be overridden as well as allows forcing
  12410. a specific value used for the output and encoder.
  12411. If not specified, the color space type depends on the pixel format.
  12412. Possible values:
  12413. @table @samp
  12414. @item auto
  12415. Choose automatically.
  12416. @item bt709
  12417. Format conforming to International Telecommunication Union (ITU)
  12418. Recommendation BT.709.
  12419. @item fcc
  12420. Set color space conforming to the United States Federal Communications
  12421. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12422. @item bt601
  12423. @item bt470
  12424. @item smpte170m
  12425. Set color space conforming to:
  12426. @itemize
  12427. @item
  12428. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12429. @item
  12430. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12431. @item
  12432. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12433. @end itemize
  12434. @item smpte240m
  12435. Set color space conforming to SMPTE ST 240:1999.
  12436. @item bt2020
  12437. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12438. @end table
  12439. @item in_range
  12440. @item out_range
  12441. Set in/output YCbCr sample range.
  12442. This allows the autodetected value to be overridden as well as allows forcing
  12443. a specific value used for the output and encoder. If not specified, the
  12444. range depends on the pixel format. Possible values:
  12445. @table @samp
  12446. @item auto/unknown
  12447. Choose automatically.
  12448. @item jpeg/full/pc
  12449. Set full range (0-255 in case of 8-bit luma).
  12450. @item mpeg/limited/tv
  12451. Set "MPEG" range (16-235 in case of 8-bit luma).
  12452. @end table
  12453. @item force_original_aspect_ratio
  12454. Enable decreasing or increasing output video width or height if necessary to
  12455. keep the original aspect ratio. Possible values:
  12456. @table @samp
  12457. @item disable
  12458. Scale the video as specified and disable this feature.
  12459. @item decrease
  12460. The output video dimensions will automatically be decreased if needed.
  12461. @item increase
  12462. The output video dimensions will automatically be increased if needed.
  12463. @end table
  12464. One useful instance of this option is that when you know a specific device's
  12465. maximum allowed resolution, you can use this to limit the output video to
  12466. that, while retaining the aspect ratio. For example, device A allows
  12467. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12468. decrease) and specifying 1280x720 to the command line makes the output
  12469. 1280x533.
  12470. Please note that this is a different thing than specifying -1 for @option{w}
  12471. or @option{h}, you still need to specify the output resolution for this option
  12472. to work.
  12473. @item force_divisible_by
  12474. Ensures that both the output dimensions, width and height, are divisible by the
  12475. given integer when used together with @option{force_original_aspect_ratio}. This
  12476. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12477. This option respects the value set for @option{force_original_aspect_ratio},
  12478. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12479. may be slightly modified.
  12480. This option can be handy if you need to have a video fit within or exceed
  12481. a defined resolution using @option{force_original_aspect_ratio} but also have
  12482. encoder restrictions on width or height divisibility.
  12483. @end table
  12484. The values of the @option{w} and @option{h} options are expressions
  12485. containing the following constants:
  12486. @table @var
  12487. @item in_w
  12488. @item in_h
  12489. The input width and height
  12490. @item iw
  12491. @item ih
  12492. These are the same as @var{in_w} and @var{in_h}.
  12493. @item out_w
  12494. @item out_h
  12495. The output (scaled) width and height
  12496. @item ow
  12497. @item oh
  12498. These are the same as @var{out_w} and @var{out_h}
  12499. @item a
  12500. The same as @var{iw} / @var{ih}
  12501. @item sar
  12502. input sample aspect ratio
  12503. @item dar
  12504. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12505. @item hsub
  12506. @item vsub
  12507. horizontal and vertical input chroma subsample values. For example for the
  12508. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12509. @item ohsub
  12510. @item ovsub
  12511. horizontal and vertical output chroma subsample values. For example for the
  12512. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12513. @item n
  12514. The (sequential) number of the input frame, starting from 0.
  12515. Only available with @code{eval=frame}.
  12516. @item t
  12517. The presentation timestamp of the input frame, expressed as a number of
  12518. seconds. Only available with @code{eval=frame}.
  12519. @item pos
  12520. The position (byte offset) of the frame in the input stream, or NaN if
  12521. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12522. Only available with @code{eval=frame}.
  12523. @end table
  12524. @subsection Examples
  12525. @itemize
  12526. @item
  12527. Scale the input video to a size of 200x100
  12528. @example
  12529. scale=w=200:h=100
  12530. @end example
  12531. This is equivalent to:
  12532. @example
  12533. scale=200:100
  12534. @end example
  12535. or:
  12536. @example
  12537. scale=200x100
  12538. @end example
  12539. @item
  12540. Specify a size abbreviation for the output size:
  12541. @example
  12542. scale=qcif
  12543. @end example
  12544. which can also be written as:
  12545. @example
  12546. scale=size=qcif
  12547. @end example
  12548. @item
  12549. Scale the input to 2x:
  12550. @example
  12551. scale=w=2*iw:h=2*ih
  12552. @end example
  12553. @item
  12554. The above is the same as:
  12555. @example
  12556. scale=2*in_w:2*in_h
  12557. @end example
  12558. @item
  12559. Scale the input to 2x with forced interlaced scaling:
  12560. @example
  12561. scale=2*iw:2*ih:interl=1
  12562. @end example
  12563. @item
  12564. Scale the input to half size:
  12565. @example
  12566. scale=w=iw/2:h=ih/2
  12567. @end example
  12568. @item
  12569. Increase the width, and set the height to the same size:
  12570. @example
  12571. scale=3/2*iw:ow
  12572. @end example
  12573. @item
  12574. Seek Greek harmony:
  12575. @example
  12576. scale=iw:1/PHI*iw
  12577. scale=ih*PHI:ih
  12578. @end example
  12579. @item
  12580. Increase the height, and set the width to 3/2 of the height:
  12581. @example
  12582. scale=w=3/2*oh:h=3/5*ih
  12583. @end example
  12584. @item
  12585. Increase the size, making the size a multiple of the chroma
  12586. subsample values:
  12587. @example
  12588. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12589. @end example
  12590. @item
  12591. Increase the width to a maximum of 500 pixels,
  12592. keeping the same aspect ratio as the input:
  12593. @example
  12594. scale=w='min(500\, iw*3/2):h=-1'
  12595. @end example
  12596. @item
  12597. Make pixels square by combining scale and setsar:
  12598. @example
  12599. scale='trunc(ih*dar):ih',setsar=1/1
  12600. @end example
  12601. @item
  12602. Make pixels square by combining scale and setsar,
  12603. making sure the resulting resolution is even (required by some codecs):
  12604. @example
  12605. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12606. @end example
  12607. @end itemize
  12608. @subsection Commands
  12609. This filter supports the following commands:
  12610. @table @option
  12611. @item width, w
  12612. @item height, h
  12613. Set the output video dimension expression.
  12614. The command accepts the same syntax of the corresponding option.
  12615. If the specified expression is not valid, it is kept at its current
  12616. value.
  12617. @end table
  12618. @section scale_npp
  12619. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12620. format conversion on CUDA video frames. Setting the output width and height
  12621. works in the same way as for the @var{scale} filter.
  12622. The following additional options are accepted:
  12623. @table @option
  12624. @item format
  12625. The pixel format of the output CUDA frames. If set to the string "same" (the
  12626. default), the input format will be kept. Note that automatic format negotiation
  12627. and conversion is not yet supported for hardware frames
  12628. @item interp_algo
  12629. The interpolation algorithm used for resizing. One of the following:
  12630. @table @option
  12631. @item nn
  12632. Nearest neighbour.
  12633. @item linear
  12634. @item cubic
  12635. @item cubic2p_bspline
  12636. 2-parameter cubic (B=1, C=0)
  12637. @item cubic2p_catmullrom
  12638. 2-parameter cubic (B=0, C=1/2)
  12639. @item cubic2p_b05c03
  12640. 2-parameter cubic (B=1/2, C=3/10)
  12641. @item super
  12642. Supersampling
  12643. @item lanczos
  12644. @end table
  12645. @item force_original_aspect_ratio
  12646. Enable decreasing or increasing output video width or height if necessary to
  12647. keep the original aspect ratio. Possible values:
  12648. @table @samp
  12649. @item disable
  12650. Scale the video as specified and disable this feature.
  12651. @item decrease
  12652. The output video dimensions will automatically be decreased if needed.
  12653. @item increase
  12654. The output video dimensions will automatically be increased if needed.
  12655. @end table
  12656. One useful instance of this option is that when you know a specific device's
  12657. maximum allowed resolution, you can use this to limit the output video to
  12658. that, while retaining the aspect ratio. For example, device A allows
  12659. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12660. decrease) and specifying 1280x720 to the command line makes the output
  12661. 1280x533.
  12662. Please note that this is a different thing than specifying -1 for @option{w}
  12663. or @option{h}, you still need to specify the output resolution for this option
  12664. to work.
  12665. @item force_divisible_by
  12666. Ensures that both the output dimensions, width and height, are divisible by the
  12667. given integer when used together with @option{force_original_aspect_ratio}. This
  12668. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12669. This option respects the value set for @option{force_original_aspect_ratio},
  12670. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12671. may be slightly modified.
  12672. This option can be handy if you need to have a video fit within or exceed
  12673. a defined resolution using @option{force_original_aspect_ratio} but also have
  12674. encoder restrictions on width or height divisibility.
  12675. @end table
  12676. @section scale2ref
  12677. Scale (resize) the input video, based on a reference video.
  12678. See the scale filter for available options, scale2ref supports the same but
  12679. uses the reference video instead of the main input as basis. scale2ref also
  12680. supports the following additional constants for the @option{w} and
  12681. @option{h} options:
  12682. @table @var
  12683. @item main_w
  12684. @item main_h
  12685. The main input video's width and height
  12686. @item main_a
  12687. The same as @var{main_w} / @var{main_h}
  12688. @item main_sar
  12689. The main input video's sample aspect ratio
  12690. @item main_dar, mdar
  12691. The main input video's display aspect ratio. Calculated from
  12692. @code{(main_w / main_h) * main_sar}.
  12693. @item main_hsub
  12694. @item main_vsub
  12695. The main input video's horizontal and vertical chroma subsample values.
  12696. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12697. is 1.
  12698. @item main_n
  12699. The (sequential) number of the main input frame, starting from 0.
  12700. Only available with @code{eval=frame}.
  12701. @item main_t
  12702. The presentation timestamp of the main input frame, expressed as a number of
  12703. seconds. Only available with @code{eval=frame}.
  12704. @item main_pos
  12705. The position (byte offset) of the frame in the main input stream, or NaN if
  12706. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12707. Only available with @code{eval=frame}.
  12708. @end table
  12709. @subsection Examples
  12710. @itemize
  12711. @item
  12712. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12713. @example
  12714. 'scale2ref[b][a];[a][b]overlay'
  12715. @end example
  12716. @item
  12717. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12718. @example
  12719. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12720. @end example
  12721. @end itemize
  12722. @subsection Commands
  12723. This filter supports the following commands:
  12724. @table @option
  12725. @item width, w
  12726. @item height, h
  12727. Set the output video dimension expression.
  12728. The command accepts the same syntax of the corresponding option.
  12729. If the specified expression is not valid, it is kept at its current
  12730. value.
  12731. @end table
  12732. @section scroll
  12733. Scroll input video horizontally and/or vertically by constant speed.
  12734. The filter accepts the following options:
  12735. @table @option
  12736. @item horizontal, h
  12737. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12738. Negative values changes scrolling direction.
  12739. @item vertical, v
  12740. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12741. Negative values changes scrolling direction.
  12742. @item hpos
  12743. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12744. @item vpos
  12745. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12746. @end table
  12747. @subsection Commands
  12748. This filter supports the following @ref{commands}:
  12749. @table @option
  12750. @item horizontal, h
  12751. Set the horizontal scrolling speed.
  12752. @item vertical, v
  12753. Set the vertical scrolling speed.
  12754. @end table
  12755. @anchor{scdet}
  12756. @section scdet
  12757. Detect video scene change.
  12758. This filter sets frame metadata with mafd between frame, the scene score, and
  12759. forward the frame to the next filter, so they can use these metadata to detect
  12760. scene change or others.
  12761. In addition, this filter logs a message and sets frame metadata when it detects
  12762. a scene change by @option{threshold}.
  12763. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  12764. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  12765. to detect scene change.
  12766. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  12767. detect scene change with @option{threshold}.
  12768. The filter accepts the following options:
  12769. @table @option
  12770. @item threshold, t
  12771. Set the scene change detection threshold as a percentage of maximum change. Good
  12772. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  12773. @code{[0., 100.]}.
  12774. Default value is @code{10.}.
  12775. @item sc_pass, s
  12776. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  12777. You can enable it if you want to get snapshot of scene change frames only.
  12778. @end table
  12779. @anchor{selectivecolor}
  12780. @section selectivecolor
  12781. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12782. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12783. by the "purity" of the color (that is, how saturated it already is).
  12784. This filter is similar to the Adobe Photoshop Selective Color tool.
  12785. The filter accepts the following options:
  12786. @table @option
  12787. @item correction_method
  12788. Select color correction method.
  12789. Available values are:
  12790. @table @samp
  12791. @item absolute
  12792. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12793. component value).
  12794. @item relative
  12795. Specified adjustments are relative to the original component value.
  12796. @end table
  12797. Default is @code{absolute}.
  12798. @item reds
  12799. Adjustments for red pixels (pixels where the red component is the maximum)
  12800. @item yellows
  12801. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12802. @item greens
  12803. Adjustments for green pixels (pixels where the green component is the maximum)
  12804. @item cyans
  12805. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12806. @item blues
  12807. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12808. @item magentas
  12809. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12810. @item whites
  12811. Adjustments for white pixels (pixels where all components are greater than 128)
  12812. @item neutrals
  12813. Adjustments for all pixels except pure black and pure white
  12814. @item blacks
  12815. Adjustments for black pixels (pixels where all components are lesser than 128)
  12816. @item psfile
  12817. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12818. @end table
  12819. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12820. 4 space separated floating point adjustment values in the [-1,1] range,
  12821. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12822. pixels of its range.
  12823. @subsection Examples
  12824. @itemize
  12825. @item
  12826. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12827. increase magenta by 27% in blue areas:
  12828. @example
  12829. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12830. @end example
  12831. @item
  12832. Use a Photoshop selective color preset:
  12833. @example
  12834. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12835. @end example
  12836. @end itemize
  12837. @anchor{separatefields}
  12838. @section separatefields
  12839. The @code{separatefields} takes a frame-based video input and splits
  12840. each frame into its components fields, producing a new half height clip
  12841. with twice the frame rate and twice the frame count.
  12842. This filter use field-dominance information in frame to decide which
  12843. of each pair of fields to place first in the output.
  12844. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12845. @section setdar, setsar
  12846. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12847. output video.
  12848. This is done by changing the specified Sample (aka Pixel) Aspect
  12849. Ratio, according to the following equation:
  12850. @example
  12851. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12852. @end example
  12853. Keep in mind that the @code{setdar} filter does not modify the pixel
  12854. dimensions of the video frame. Also, the display aspect ratio set by
  12855. this filter may be changed by later filters in the filterchain,
  12856. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12857. applied.
  12858. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12859. the filter output video.
  12860. Note that as a consequence of the application of this filter, the
  12861. output display aspect ratio will change according to the equation
  12862. above.
  12863. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12864. filter may be changed by later filters in the filterchain, e.g. if
  12865. another "setsar" or a "setdar" filter is applied.
  12866. It accepts the following parameters:
  12867. @table @option
  12868. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12869. Set the aspect ratio used by the filter.
  12870. The parameter can be a floating point number string, an expression, or
  12871. a string of the form @var{num}:@var{den}, where @var{num} and
  12872. @var{den} are the numerator and denominator of the aspect ratio. If
  12873. the parameter is not specified, it is assumed the value "0".
  12874. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12875. should be escaped.
  12876. @item max
  12877. Set the maximum integer value to use for expressing numerator and
  12878. denominator when reducing the expressed aspect ratio to a rational.
  12879. Default value is @code{100}.
  12880. @end table
  12881. The parameter @var{sar} is an expression containing
  12882. the following constants:
  12883. @table @option
  12884. @item E, PI, PHI
  12885. These are approximated values for the mathematical constants e
  12886. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12887. @item w, h
  12888. The input width and height.
  12889. @item a
  12890. These are the same as @var{w} / @var{h}.
  12891. @item sar
  12892. The input sample aspect ratio.
  12893. @item dar
  12894. The input display aspect ratio. It is the same as
  12895. (@var{w} / @var{h}) * @var{sar}.
  12896. @item hsub, vsub
  12897. Horizontal and vertical chroma subsample values. For example, for the
  12898. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12899. @end table
  12900. @subsection Examples
  12901. @itemize
  12902. @item
  12903. To change the display aspect ratio to 16:9, specify one of the following:
  12904. @example
  12905. setdar=dar=1.77777
  12906. setdar=dar=16/9
  12907. @end example
  12908. @item
  12909. To change the sample aspect ratio to 10:11, specify:
  12910. @example
  12911. setsar=sar=10/11
  12912. @end example
  12913. @item
  12914. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12915. 1000 in the aspect ratio reduction, use the command:
  12916. @example
  12917. setdar=ratio=16/9:max=1000
  12918. @end example
  12919. @end itemize
  12920. @anchor{setfield}
  12921. @section setfield
  12922. Force field for the output video frame.
  12923. The @code{setfield} filter marks the interlace type field for the
  12924. output frames. It does not change the input frame, but only sets the
  12925. corresponding property, which affects how the frame is treated by
  12926. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12927. The filter accepts the following options:
  12928. @table @option
  12929. @item mode
  12930. Available values are:
  12931. @table @samp
  12932. @item auto
  12933. Keep the same field property.
  12934. @item bff
  12935. Mark the frame as bottom-field-first.
  12936. @item tff
  12937. Mark the frame as top-field-first.
  12938. @item prog
  12939. Mark the frame as progressive.
  12940. @end table
  12941. @end table
  12942. @anchor{setparams}
  12943. @section setparams
  12944. Force frame parameter for the output video frame.
  12945. The @code{setparams} filter marks interlace and color range for the
  12946. output frames. It does not change the input frame, but only sets the
  12947. corresponding property, which affects how the frame is treated by
  12948. filters/encoders.
  12949. @table @option
  12950. @item field_mode
  12951. Available values are:
  12952. @table @samp
  12953. @item auto
  12954. Keep the same field property (default).
  12955. @item bff
  12956. Mark the frame as bottom-field-first.
  12957. @item tff
  12958. Mark the frame as top-field-first.
  12959. @item prog
  12960. Mark the frame as progressive.
  12961. @end table
  12962. @item range
  12963. Available values are:
  12964. @table @samp
  12965. @item auto
  12966. Keep the same color range property (default).
  12967. @item unspecified, unknown
  12968. Mark the frame as unspecified color range.
  12969. @item limited, tv, mpeg
  12970. Mark the frame as limited range.
  12971. @item full, pc, jpeg
  12972. Mark the frame as full range.
  12973. @end table
  12974. @item color_primaries
  12975. Set the color primaries.
  12976. Available values are:
  12977. @table @samp
  12978. @item auto
  12979. Keep the same color primaries property (default).
  12980. @item bt709
  12981. @item unknown
  12982. @item bt470m
  12983. @item bt470bg
  12984. @item smpte170m
  12985. @item smpte240m
  12986. @item film
  12987. @item bt2020
  12988. @item smpte428
  12989. @item smpte431
  12990. @item smpte432
  12991. @item jedec-p22
  12992. @end table
  12993. @item color_trc
  12994. Set the color transfer.
  12995. Available values are:
  12996. @table @samp
  12997. @item auto
  12998. Keep the same color trc property (default).
  12999. @item bt709
  13000. @item unknown
  13001. @item bt470m
  13002. @item bt470bg
  13003. @item smpte170m
  13004. @item smpte240m
  13005. @item linear
  13006. @item log100
  13007. @item log316
  13008. @item iec61966-2-4
  13009. @item bt1361e
  13010. @item iec61966-2-1
  13011. @item bt2020-10
  13012. @item bt2020-12
  13013. @item smpte2084
  13014. @item smpte428
  13015. @item arib-std-b67
  13016. @end table
  13017. @item colorspace
  13018. Set the colorspace.
  13019. Available values are:
  13020. @table @samp
  13021. @item auto
  13022. Keep the same colorspace property (default).
  13023. @item gbr
  13024. @item bt709
  13025. @item unknown
  13026. @item fcc
  13027. @item bt470bg
  13028. @item smpte170m
  13029. @item smpte240m
  13030. @item ycgco
  13031. @item bt2020nc
  13032. @item bt2020c
  13033. @item smpte2085
  13034. @item chroma-derived-nc
  13035. @item chroma-derived-c
  13036. @item ictcp
  13037. @end table
  13038. @end table
  13039. @section showinfo
  13040. Show a line containing various information for each input video frame.
  13041. The input video is not modified.
  13042. This filter supports the following options:
  13043. @table @option
  13044. @item checksum
  13045. Calculate checksums of each plane. By default enabled.
  13046. @end table
  13047. The shown line contains a sequence of key/value pairs of the form
  13048. @var{key}:@var{value}.
  13049. The following values are shown in the output:
  13050. @table @option
  13051. @item n
  13052. The (sequential) number of the input frame, starting from 0.
  13053. @item pts
  13054. The Presentation TimeStamp of the input frame, expressed as a number of
  13055. time base units. The time base unit depends on the filter input pad.
  13056. @item pts_time
  13057. The Presentation TimeStamp of the input frame, expressed as a number of
  13058. seconds.
  13059. @item pos
  13060. The position of the frame in the input stream, or -1 if this information is
  13061. unavailable and/or meaningless (for example in case of synthetic video).
  13062. @item fmt
  13063. The pixel format name.
  13064. @item sar
  13065. The sample aspect ratio of the input frame, expressed in the form
  13066. @var{num}/@var{den}.
  13067. @item s
  13068. The size of the input frame. For the syntax of this option, check the
  13069. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13070. @item i
  13071. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  13072. for bottom field first).
  13073. @item iskey
  13074. This is 1 if the frame is a key frame, 0 otherwise.
  13075. @item type
  13076. The picture type of the input frame ("I" for an I-frame, "P" for a
  13077. P-frame, "B" for a B-frame, or "?" for an unknown type).
  13078. Also refer to the documentation of the @code{AVPictureType} enum and of
  13079. the @code{av_get_picture_type_char} function defined in
  13080. @file{libavutil/avutil.h}.
  13081. @item checksum
  13082. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  13083. @item plane_checksum
  13084. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  13085. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  13086. @item mean
  13087. The mean value of pixels in each plane of the input frame, expressed in the form
  13088. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  13089. @item stdev
  13090. The standard deviation of pixel values in each plane of the input frame, expressed
  13091. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  13092. @end table
  13093. @section showpalette
  13094. Displays the 256 colors palette of each frame. This filter is only relevant for
  13095. @var{pal8} pixel format frames.
  13096. It accepts the following option:
  13097. @table @option
  13098. @item s
  13099. Set the size of the box used to represent one palette color entry. Default is
  13100. @code{30} (for a @code{30x30} pixel box).
  13101. @end table
  13102. @section shuffleframes
  13103. Reorder and/or duplicate and/or drop video frames.
  13104. It accepts the following parameters:
  13105. @table @option
  13106. @item mapping
  13107. Set the destination indexes of input frames.
  13108. This is space or '|' separated list of indexes that maps input frames to output
  13109. frames. Number of indexes also sets maximal value that each index may have.
  13110. '-1' index have special meaning and that is to drop frame.
  13111. @end table
  13112. The first frame has the index 0. The default is to keep the input unchanged.
  13113. @subsection Examples
  13114. @itemize
  13115. @item
  13116. Swap second and third frame of every three frames of the input:
  13117. @example
  13118. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  13119. @end example
  13120. @item
  13121. Swap 10th and 1st frame of every ten frames of the input:
  13122. @example
  13123. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  13124. @end example
  13125. @end itemize
  13126. @section shuffleplanes
  13127. Reorder and/or duplicate video planes.
  13128. It accepts the following parameters:
  13129. @table @option
  13130. @item map0
  13131. The index of the input plane to be used as the first output plane.
  13132. @item map1
  13133. The index of the input plane to be used as the second output plane.
  13134. @item map2
  13135. The index of the input plane to be used as the third output plane.
  13136. @item map3
  13137. The index of the input plane to be used as the fourth output plane.
  13138. @end table
  13139. The first plane has the index 0. The default is to keep the input unchanged.
  13140. @subsection Examples
  13141. @itemize
  13142. @item
  13143. Swap the second and third planes of the input:
  13144. @example
  13145. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  13146. @end example
  13147. @end itemize
  13148. @anchor{signalstats}
  13149. @section signalstats
  13150. Evaluate various visual metrics that assist in determining issues associated
  13151. with the digitization of analog video media.
  13152. By default the filter will log these metadata values:
  13153. @table @option
  13154. @item YMIN
  13155. Display the minimal Y value contained within the input frame. Expressed in
  13156. range of [0-255].
  13157. @item YLOW
  13158. Display the Y value at the 10% percentile within the input frame. Expressed in
  13159. range of [0-255].
  13160. @item YAVG
  13161. Display the average Y value within the input frame. Expressed in range of
  13162. [0-255].
  13163. @item YHIGH
  13164. Display the Y value at the 90% percentile within the input frame. Expressed in
  13165. range of [0-255].
  13166. @item YMAX
  13167. Display the maximum Y value contained within the input frame. Expressed in
  13168. range of [0-255].
  13169. @item UMIN
  13170. Display the minimal U value contained within the input frame. Expressed in
  13171. range of [0-255].
  13172. @item ULOW
  13173. Display the U value at the 10% percentile within the input frame. Expressed in
  13174. range of [0-255].
  13175. @item UAVG
  13176. Display the average U value within the input frame. Expressed in range of
  13177. [0-255].
  13178. @item UHIGH
  13179. Display the U value at the 90% percentile within the input frame. Expressed in
  13180. range of [0-255].
  13181. @item UMAX
  13182. Display the maximum U value contained within the input frame. Expressed in
  13183. range of [0-255].
  13184. @item VMIN
  13185. Display the minimal V value contained within the input frame. Expressed in
  13186. range of [0-255].
  13187. @item VLOW
  13188. Display the V value at the 10% percentile within the input frame. Expressed in
  13189. range of [0-255].
  13190. @item VAVG
  13191. Display the average V value within the input frame. Expressed in range of
  13192. [0-255].
  13193. @item VHIGH
  13194. Display the V value at the 90% percentile within the input frame. Expressed in
  13195. range of [0-255].
  13196. @item VMAX
  13197. Display the maximum V value contained within the input frame. Expressed in
  13198. range of [0-255].
  13199. @item SATMIN
  13200. Display the minimal saturation value contained within the input frame.
  13201. Expressed in range of [0-~181.02].
  13202. @item SATLOW
  13203. Display the saturation value at the 10% percentile within the input frame.
  13204. Expressed in range of [0-~181.02].
  13205. @item SATAVG
  13206. Display the average saturation value within the input frame. Expressed in range
  13207. of [0-~181.02].
  13208. @item SATHIGH
  13209. Display the saturation value at the 90% percentile within the input frame.
  13210. Expressed in range of [0-~181.02].
  13211. @item SATMAX
  13212. Display the maximum saturation value contained within the input frame.
  13213. Expressed in range of [0-~181.02].
  13214. @item HUEMED
  13215. Display the median value for hue within the input frame. Expressed in range of
  13216. [0-360].
  13217. @item HUEAVG
  13218. Display the average value for hue within the input frame. Expressed in range of
  13219. [0-360].
  13220. @item YDIF
  13221. Display the average of sample value difference between all values of the Y
  13222. plane in the current frame and corresponding values of the previous input frame.
  13223. Expressed in range of [0-255].
  13224. @item UDIF
  13225. Display the average of sample value difference between all values of the U
  13226. plane in the current frame and corresponding values of the previous input frame.
  13227. Expressed in range of [0-255].
  13228. @item VDIF
  13229. Display the average of sample value difference between all values of the V
  13230. plane in the current frame and corresponding values of the previous input frame.
  13231. Expressed in range of [0-255].
  13232. @item YBITDEPTH
  13233. Display bit depth of Y plane in current frame.
  13234. Expressed in range of [0-16].
  13235. @item UBITDEPTH
  13236. Display bit depth of U plane in current frame.
  13237. Expressed in range of [0-16].
  13238. @item VBITDEPTH
  13239. Display bit depth of V plane in current frame.
  13240. Expressed in range of [0-16].
  13241. @end table
  13242. The filter accepts the following options:
  13243. @table @option
  13244. @item stat
  13245. @item out
  13246. @option{stat} specify an additional form of image analysis.
  13247. @option{out} output video with the specified type of pixel highlighted.
  13248. Both options accept the following values:
  13249. @table @samp
  13250. @item tout
  13251. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  13252. unlike the neighboring pixels of the same field. Examples of temporal outliers
  13253. include the results of video dropouts, head clogs, or tape tracking issues.
  13254. @item vrep
  13255. Identify @var{vertical line repetition}. Vertical line repetition includes
  13256. similar rows of pixels within a frame. In born-digital video vertical line
  13257. repetition is common, but this pattern is uncommon in video digitized from an
  13258. analog source. When it occurs in video that results from the digitization of an
  13259. analog source it can indicate concealment from a dropout compensator.
  13260. @item brng
  13261. Identify pixels that fall outside of legal broadcast range.
  13262. @end table
  13263. @item color, c
  13264. Set the highlight color for the @option{out} option. The default color is
  13265. yellow.
  13266. @end table
  13267. @subsection Examples
  13268. @itemize
  13269. @item
  13270. Output data of various video metrics:
  13271. @example
  13272. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  13273. @end example
  13274. @item
  13275. Output specific data about the minimum and maximum values of the Y plane per frame:
  13276. @example
  13277. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  13278. @end example
  13279. @item
  13280. Playback video while highlighting pixels that are outside of broadcast range in red.
  13281. @example
  13282. ffplay example.mov -vf signalstats="out=brng:color=red"
  13283. @end example
  13284. @item
  13285. Playback video with signalstats metadata drawn over the frame.
  13286. @example
  13287. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  13288. @end example
  13289. The contents of signalstat_drawtext.txt used in the command are:
  13290. @example
  13291. time %@{pts:hms@}
  13292. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  13293. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  13294. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  13295. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  13296. @end example
  13297. @end itemize
  13298. @anchor{signature}
  13299. @section signature
  13300. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  13301. input. In this case the matching between the inputs can be calculated additionally.
  13302. The filter always passes through the first input. The signature of each stream can
  13303. be written into a file.
  13304. It accepts the following options:
  13305. @table @option
  13306. @item detectmode
  13307. Enable or disable the matching process.
  13308. Available values are:
  13309. @table @samp
  13310. @item off
  13311. Disable the calculation of a matching (default).
  13312. @item full
  13313. Calculate the matching for the whole video and output whether the whole video
  13314. matches or only parts.
  13315. @item fast
  13316. Calculate only until a matching is found or the video ends. Should be faster in
  13317. some cases.
  13318. @end table
  13319. @item nb_inputs
  13320. Set the number of inputs. The option value must be a non negative integer.
  13321. Default value is 1.
  13322. @item filename
  13323. Set the path to which the output is written. If there is more than one input,
  13324. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  13325. integer), that will be replaced with the input number. If no filename is
  13326. specified, no output will be written. This is the default.
  13327. @item format
  13328. Choose the output format.
  13329. Available values are:
  13330. @table @samp
  13331. @item binary
  13332. Use the specified binary representation (default).
  13333. @item xml
  13334. Use the specified xml representation.
  13335. @end table
  13336. @item th_d
  13337. Set threshold to detect one word as similar. The option value must be an integer
  13338. greater than zero. The default value is 9000.
  13339. @item th_dc
  13340. Set threshold to detect all words as similar. The option value must be an integer
  13341. greater than zero. The default value is 60000.
  13342. @item th_xh
  13343. Set threshold to detect frames as similar. The option value must be an integer
  13344. greater than zero. The default value is 116.
  13345. @item th_di
  13346. Set the minimum length of a sequence in frames to recognize it as matching
  13347. sequence. The option value must be a non negative integer value.
  13348. The default value is 0.
  13349. @item th_it
  13350. Set the minimum relation, that matching frames to all frames must have.
  13351. The option value must be a double value between 0 and 1. The default value is 0.5.
  13352. @end table
  13353. @subsection Examples
  13354. @itemize
  13355. @item
  13356. To calculate the signature of an input video and store it in signature.bin:
  13357. @example
  13358. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13359. @end example
  13360. @item
  13361. To detect whether two videos match and store the signatures in XML format in
  13362. signature0.xml and signature1.xml:
  13363. @example
  13364. 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 -
  13365. @end example
  13366. @end itemize
  13367. @anchor{smartblur}
  13368. @section smartblur
  13369. Blur the input video without impacting the outlines.
  13370. It accepts the following options:
  13371. @table @option
  13372. @item luma_radius, lr
  13373. Set the luma radius. The option value must be a float number in
  13374. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13375. used to blur the image (slower if larger). Default value is 1.0.
  13376. @item luma_strength, ls
  13377. Set the luma strength. The option value must be a float number
  13378. in the range [-1.0,1.0] that configures the blurring. A value included
  13379. in [0.0,1.0] will blur the image whereas a value included in
  13380. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13381. @item luma_threshold, lt
  13382. Set the luma threshold used as a coefficient to determine
  13383. whether a pixel should be blurred or not. The option value must be an
  13384. integer in the range [-30,30]. A value of 0 will filter all the image,
  13385. a value included in [0,30] will filter flat areas and a value included
  13386. in [-30,0] will filter edges. Default value is 0.
  13387. @item chroma_radius, cr
  13388. Set the chroma radius. The option value must be a float number in
  13389. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13390. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13391. @item chroma_strength, cs
  13392. Set the chroma strength. The option value must be a float number
  13393. in the range [-1.0,1.0] that configures the blurring. A value included
  13394. in [0.0,1.0] will blur the image whereas a value included in
  13395. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13396. @item chroma_threshold, ct
  13397. Set the chroma threshold used as a coefficient to determine
  13398. whether a pixel should be blurred or not. The option value must be an
  13399. integer in the range [-30,30]. A value of 0 will filter all the image,
  13400. a value included in [0,30] will filter flat areas and a value included
  13401. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13402. @end table
  13403. If a chroma option is not explicitly set, the corresponding luma value
  13404. is set.
  13405. @section sobel
  13406. Apply sobel operator to input video stream.
  13407. The filter accepts the following option:
  13408. @table @option
  13409. @item planes
  13410. Set which planes will be processed, unprocessed planes will be copied.
  13411. By default value 0xf, all planes will be processed.
  13412. @item scale
  13413. Set value which will be multiplied with filtered result.
  13414. @item delta
  13415. Set value which will be added to filtered result.
  13416. @end table
  13417. @anchor{spp}
  13418. @section spp
  13419. Apply a simple postprocessing filter that compresses and decompresses the image
  13420. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13421. and average the results.
  13422. The filter accepts the following options:
  13423. @table @option
  13424. @item quality
  13425. Set quality. This option defines the number of levels for averaging. It accepts
  13426. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13427. effect. A value of @code{6} means the higher quality. For each increment of
  13428. that value the speed drops by a factor of approximately 2. Default value is
  13429. @code{3}.
  13430. @item qp
  13431. Force a constant quantization parameter. If not set, the filter will use the QP
  13432. from the video stream (if available).
  13433. @item mode
  13434. Set thresholding mode. Available modes are:
  13435. @table @samp
  13436. @item hard
  13437. Set hard thresholding (default).
  13438. @item soft
  13439. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13440. @end table
  13441. @item use_bframe_qp
  13442. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13443. option may cause flicker since the B-Frames have often larger QP. Default is
  13444. @code{0} (not enabled).
  13445. @end table
  13446. @subsection Commands
  13447. This filter supports the following commands:
  13448. @table @option
  13449. @item quality, level
  13450. Set quality level. The value @code{max} can be used to set the maximum level,
  13451. currently @code{6}.
  13452. @end table
  13453. @anchor{sr}
  13454. @section sr
  13455. Scale the input by applying one of the super-resolution methods based on
  13456. convolutional neural networks. Supported models:
  13457. @itemize
  13458. @item
  13459. Super-Resolution Convolutional Neural Network model (SRCNN).
  13460. See @url{https://arxiv.org/abs/1501.00092}.
  13461. @item
  13462. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13463. See @url{https://arxiv.org/abs/1609.05158}.
  13464. @end itemize
  13465. Training scripts as well as scripts for model file (.pb) saving can be found at
  13466. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13467. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13468. Native model files (.model) can be generated from TensorFlow model
  13469. files (.pb) by using tools/python/convert.py
  13470. The filter accepts the following options:
  13471. @table @option
  13472. @item dnn_backend
  13473. Specify which DNN backend to use for model loading and execution. This option accepts
  13474. the following values:
  13475. @table @samp
  13476. @item native
  13477. Native implementation of DNN loading and execution.
  13478. @item tensorflow
  13479. TensorFlow backend. To enable this backend you
  13480. need to install the TensorFlow for C library (see
  13481. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13482. @code{--enable-libtensorflow}
  13483. @end table
  13484. Default value is @samp{native}.
  13485. @item model
  13486. Set path to model file specifying network architecture and its parameters.
  13487. Note that different backends use different file formats. TensorFlow backend
  13488. can load files for both formats, while native backend can load files for only
  13489. its format.
  13490. @item scale_factor
  13491. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13492. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13493. input upscaled using bicubic upscaling with proper scale factor.
  13494. @end table
  13495. This feature can also be finished with @ref{dnn_processing} filter.
  13496. @section ssim
  13497. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13498. This filter takes in input two input videos, the first input is
  13499. considered the "main" source and is passed unchanged to the
  13500. output. The second input is used as a "reference" video for computing
  13501. the SSIM.
  13502. Both video inputs must have the same resolution and pixel format for
  13503. this filter to work correctly. Also it assumes that both inputs
  13504. have the same number of frames, which are compared one by one.
  13505. The filter stores the calculated SSIM of each frame.
  13506. The description of the accepted parameters follows.
  13507. @table @option
  13508. @item stats_file, f
  13509. If specified the filter will use the named file to save the SSIM of
  13510. each individual frame. When filename equals "-" the data is sent to
  13511. standard output.
  13512. @end table
  13513. The file printed if @var{stats_file} is selected, contains a sequence of
  13514. key/value pairs of the form @var{key}:@var{value} for each compared
  13515. couple of frames.
  13516. A description of each shown parameter follows:
  13517. @table @option
  13518. @item n
  13519. sequential number of the input frame, starting from 1
  13520. @item Y, U, V, R, G, B
  13521. SSIM of the compared frames for the component specified by the suffix.
  13522. @item All
  13523. SSIM of the compared frames for the whole frame.
  13524. @item dB
  13525. Same as above but in dB representation.
  13526. @end table
  13527. This filter also supports the @ref{framesync} options.
  13528. @subsection Examples
  13529. @itemize
  13530. @item
  13531. For example:
  13532. @example
  13533. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13534. [main][ref] ssim="stats_file=stats.log" [out]
  13535. @end example
  13536. On this example the input file being processed is compared with the
  13537. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  13538. is stored in @file{stats.log}.
  13539. @item
  13540. Another example with both psnr and ssim at same time:
  13541. @example
  13542. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  13543. @end example
  13544. @item
  13545. Another example with different containers:
  13546. @example
  13547. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]ssim" -f null -
  13548. @end example
  13549. @end itemize
  13550. @section stereo3d
  13551. Convert between different stereoscopic image formats.
  13552. The filters accept the following options:
  13553. @table @option
  13554. @item in
  13555. Set stereoscopic image format of input.
  13556. Available values for input image formats are:
  13557. @table @samp
  13558. @item sbsl
  13559. side by side parallel (left eye left, right eye right)
  13560. @item sbsr
  13561. side by side crosseye (right eye left, left eye right)
  13562. @item sbs2l
  13563. side by side parallel with half width resolution
  13564. (left eye left, right eye right)
  13565. @item sbs2r
  13566. side by side crosseye with half width resolution
  13567. (right eye left, left eye right)
  13568. @item abl
  13569. @item tbl
  13570. above-below (left eye above, right eye below)
  13571. @item abr
  13572. @item tbr
  13573. above-below (right eye above, left eye below)
  13574. @item ab2l
  13575. @item tb2l
  13576. above-below with half height resolution
  13577. (left eye above, right eye below)
  13578. @item ab2r
  13579. @item tb2r
  13580. above-below with half height resolution
  13581. (right eye above, left eye below)
  13582. @item al
  13583. alternating frames (left eye first, right eye second)
  13584. @item ar
  13585. alternating frames (right eye first, left eye second)
  13586. @item irl
  13587. interleaved rows (left eye has top row, right eye starts on next row)
  13588. @item irr
  13589. interleaved rows (right eye has top row, left eye starts on next row)
  13590. @item icl
  13591. interleaved columns, left eye first
  13592. @item icr
  13593. interleaved columns, right eye first
  13594. Default value is @samp{sbsl}.
  13595. @end table
  13596. @item out
  13597. Set stereoscopic image format of output.
  13598. @table @samp
  13599. @item sbsl
  13600. side by side parallel (left eye left, right eye right)
  13601. @item sbsr
  13602. side by side crosseye (right eye left, left eye right)
  13603. @item sbs2l
  13604. side by side parallel with half width resolution
  13605. (left eye left, right eye right)
  13606. @item sbs2r
  13607. side by side crosseye with half width resolution
  13608. (right eye left, left eye right)
  13609. @item abl
  13610. @item tbl
  13611. above-below (left eye above, right eye below)
  13612. @item abr
  13613. @item tbr
  13614. above-below (right eye above, left eye below)
  13615. @item ab2l
  13616. @item tb2l
  13617. above-below with half height resolution
  13618. (left eye above, right eye below)
  13619. @item ab2r
  13620. @item tb2r
  13621. above-below with half height resolution
  13622. (right eye above, left eye below)
  13623. @item al
  13624. alternating frames (left eye first, right eye second)
  13625. @item ar
  13626. alternating frames (right eye first, left eye second)
  13627. @item irl
  13628. interleaved rows (left eye has top row, right eye starts on next row)
  13629. @item irr
  13630. interleaved rows (right eye has top row, left eye starts on next row)
  13631. @item arbg
  13632. anaglyph red/blue gray
  13633. (red filter on left eye, blue filter on right eye)
  13634. @item argg
  13635. anaglyph red/green gray
  13636. (red filter on left eye, green filter on right eye)
  13637. @item arcg
  13638. anaglyph red/cyan gray
  13639. (red filter on left eye, cyan filter on right eye)
  13640. @item arch
  13641. anaglyph red/cyan half colored
  13642. (red filter on left eye, cyan filter on right eye)
  13643. @item arcc
  13644. anaglyph red/cyan color
  13645. (red filter on left eye, cyan filter on right eye)
  13646. @item arcd
  13647. anaglyph red/cyan color optimized with the least squares projection of dubois
  13648. (red filter on left eye, cyan filter on right eye)
  13649. @item agmg
  13650. anaglyph green/magenta gray
  13651. (green filter on left eye, magenta filter on right eye)
  13652. @item agmh
  13653. anaglyph green/magenta half colored
  13654. (green filter on left eye, magenta filter on right eye)
  13655. @item agmc
  13656. anaglyph green/magenta colored
  13657. (green filter on left eye, magenta filter on right eye)
  13658. @item agmd
  13659. anaglyph green/magenta color optimized with the least squares projection of dubois
  13660. (green filter on left eye, magenta filter on right eye)
  13661. @item aybg
  13662. anaglyph yellow/blue gray
  13663. (yellow filter on left eye, blue filter on right eye)
  13664. @item aybh
  13665. anaglyph yellow/blue half colored
  13666. (yellow filter on left eye, blue filter on right eye)
  13667. @item aybc
  13668. anaglyph yellow/blue colored
  13669. (yellow filter on left eye, blue filter on right eye)
  13670. @item aybd
  13671. anaglyph yellow/blue color optimized with the least squares projection of dubois
  13672. (yellow filter on left eye, blue filter on right eye)
  13673. @item ml
  13674. mono output (left eye only)
  13675. @item mr
  13676. mono output (right eye only)
  13677. @item chl
  13678. checkerboard, left eye first
  13679. @item chr
  13680. checkerboard, right eye first
  13681. @item icl
  13682. interleaved columns, left eye first
  13683. @item icr
  13684. interleaved columns, right eye first
  13685. @item hdmi
  13686. HDMI frame pack
  13687. @end table
  13688. Default value is @samp{arcd}.
  13689. @end table
  13690. @subsection Examples
  13691. @itemize
  13692. @item
  13693. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  13694. @example
  13695. stereo3d=sbsl:aybd
  13696. @end example
  13697. @item
  13698. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  13699. @example
  13700. stereo3d=abl:sbsr
  13701. @end example
  13702. @end itemize
  13703. @section streamselect, astreamselect
  13704. Select video or audio streams.
  13705. The filter accepts the following options:
  13706. @table @option
  13707. @item inputs
  13708. Set number of inputs. Default is 2.
  13709. @item map
  13710. Set input indexes to remap to outputs.
  13711. @end table
  13712. @subsection Commands
  13713. The @code{streamselect} and @code{astreamselect} filter supports the following
  13714. commands:
  13715. @table @option
  13716. @item map
  13717. Set input indexes to remap to outputs.
  13718. @end table
  13719. @subsection Examples
  13720. @itemize
  13721. @item
  13722. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13723. @example
  13724. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13725. @end example
  13726. @item
  13727. Same as above, but for audio:
  13728. @example
  13729. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13730. @end example
  13731. @end itemize
  13732. @anchor{subtitles}
  13733. @section subtitles
  13734. Draw subtitles on top of input video using the libass library.
  13735. To enable compilation of this filter you need to configure FFmpeg with
  13736. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13737. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13738. Alpha) subtitles format.
  13739. The filter accepts the following options:
  13740. @table @option
  13741. @item filename, f
  13742. Set the filename of the subtitle file to read. It must be specified.
  13743. @item original_size
  13744. Specify the size of the original video, the video for which the ASS file
  13745. was composed. For the syntax of this option, check the
  13746. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13747. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13748. correctly scale the fonts if the aspect ratio has been changed.
  13749. @item fontsdir
  13750. Set a directory path containing fonts that can be used by the filter.
  13751. These fonts will be used in addition to whatever the font provider uses.
  13752. @item alpha
  13753. Process alpha channel, by default alpha channel is untouched.
  13754. @item charenc
  13755. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13756. useful if not UTF-8.
  13757. @item stream_index, si
  13758. Set subtitles stream index. @code{subtitles} filter only.
  13759. @item force_style
  13760. Override default style or script info parameters of the subtitles. It accepts a
  13761. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13762. @end table
  13763. If the first key is not specified, it is assumed that the first value
  13764. specifies the @option{filename}.
  13765. For example, to render the file @file{sub.srt} on top of the input
  13766. video, use the command:
  13767. @example
  13768. subtitles=sub.srt
  13769. @end example
  13770. which is equivalent to:
  13771. @example
  13772. subtitles=filename=sub.srt
  13773. @end example
  13774. To render the default subtitles stream from file @file{video.mkv}, use:
  13775. @example
  13776. subtitles=video.mkv
  13777. @end example
  13778. To render the second subtitles stream from that file, use:
  13779. @example
  13780. subtitles=video.mkv:si=1
  13781. @end example
  13782. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13783. @code{DejaVu Serif}, use:
  13784. @example
  13785. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13786. @end example
  13787. @section super2xsai
  13788. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13789. Interpolate) pixel art scaling algorithm.
  13790. Useful for enlarging pixel art images without reducing sharpness.
  13791. @section swaprect
  13792. Swap two rectangular objects in video.
  13793. This filter accepts the following options:
  13794. @table @option
  13795. @item w
  13796. Set object width.
  13797. @item h
  13798. Set object height.
  13799. @item x1
  13800. Set 1st rect x coordinate.
  13801. @item y1
  13802. Set 1st rect y coordinate.
  13803. @item x2
  13804. Set 2nd rect x coordinate.
  13805. @item y2
  13806. Set 2nd rect y coordinate.
  13807. All expressions are evaluated once for each frame.
  13808. @end table
  13809. The all options are expressions containing the following constants:
  13810. @table @option
  13811. @item w
  13812. @item h
  13813. The input width and height.
  13814. @item a
  13815. same as @var{w} / @var{h}
  13816. @item sar
  13817. input sample aspect ratio
  13818. @item dar
  13819. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13820. @item n
  13821. The number of the input frame, starting from 0.
  13822. @item t
  13823. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13824. @item pos
  13825. the position in the file of the input frame, NAN if unknown
  13826. @end table
  13827. @section swapuv
  13828. Swap U & V plane.
  13829. @section tblend
  13830. Blend successive video frames.
  13831. See @ref{blend}
  13832. @section telecine
  13833. Apply telecine process to the video.
  13834. This filter accepts the following options:
  13835. @table @option
  13836. @item first_field
  13837. @table @samp
  13838. @item top, t
  13839. top field first
  13840. @item bottom, b
  13841. bottom field first
  13842. The default value is @code{top}.
  13843. @end table
  13844. @item pattern
  13845. A string of numbers representing the pulldown pattern you wish to apply.
  13846. The default value is @code{23}.
  13847. @end table
  13848. @example
  13849. Some typical patterns:
  13850. NTSC output (30i):
  13851. 27.5p: 32222
  13852. 24p: 23 (classic)
  13853. 24p: 2332 (preferred)
  13854. 20p: 33
  13855. 18p: 334
  13856. 16p: 3444
  13857. PAL output (25i):
  13858. 27.5p: 12222
  13859. 24p: 222222222223 ("Euro pulldown")
  13860. 16.67p: 33
  13861. 16p: 33333334
  13862. @end example
  13863. @section thistogram
  13864. Compute and draw a color distribution histogram for the input video across time.
  13865. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  13866. at certain time, this filter shows also past histograms of number of frames defined
  13867. by @code{width} option.
  13868. The computed histogram is a representation of the color component
  13869. distribution in an image.
  13870. The filter accepts the following options:
  13871. @table @option
  13872. @item width, w
  13873. Set width of single color component output. Default value is @code{0}.
  13874. Value of @code{0} means width will be picked from input video.
  13875. This also set number of passed histograms to keep.
  13876. Allowed range is [0, 8192].
  13877. @item display_mode, d
  13878. Set display mode.
  13879. It accepts the following values:
  13880. @table @samp
  13881. @item stack
  13882. Per color component graphs are placed below each other.
  13883. @item parade
  13884. Per color component graphs are placed side by side.
  13885. @item overlay
  13886. Presents information identical to that in the @code{parade}, except
  13887. that the graphs representing color components are superimposed directly
  13888. over one another.
  13889. @end table
  13890. Default is @code{stack}.
  13891. @item levels_mode, m
  13892. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  13893. Default is @code{linear}.
  13894. @item components, c
  13895. Set what color components to display.
  13896. Default is @code{7}.
  13897. @item bgopacity, b
  13898. Set background opacity. Default is @code{0.9}.
  13899. @item envelope, e
  13900. Show envelope. Default is disabled.
  13901. @item ecolor, ec
  13902. Set envelope color. Default is @code{gold}.
  13903. @end table
  13904. @section threshold
  13905. Apply threshold effect to video stream.
  13906. This filter needs four video streams to perform thresholding.
  13907. First stream is stream we are filtering.
  13908. Second stream is holding threshold values, third stream is holding min values,
  13909. and last, fourth stream is holding max values.
  13910. The filter accepts the following option:
  13911. @table @option
  13912. @item planes
  13913. Set which planes will be processed, unprocessed planes will be copied.
  13914. By default value 0xf, all planes will be processed.
  13915. @end table
  13916. For example if first stream pixel's component value is less then threshold value
  13917. of pixel component from 2nd threshold stream, third stream value will picked,
  13918. otherwise fourth stream pixel component value will be picked.
  13919. Using color source filter one can perform various types of thresholding:
  13920. @subsection Examples
  13921. @itemize
  13922. @item
  13923. Binary threshold, using gray color as threshold:
  13924. @example
  13925. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13926. @end example
  13927. @item
  13928. Inverted binary threshold, using gray color as threshold:
  13929. @example
  13930. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13931. @end example
  13932. @item
  13933. Truncate binary threshold, using gray color as threshold:
  13934. @example
  13935. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13936. @end example
  13937. @item
  13938. Threshold to zero, using gray color as threshold:
  13939. @example
  13940. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13941. @end example
  13942. @item
  13943. Inverted threshold to zero, using gray color as threshold:
  13944. @example
  13945. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13946. @end example
  13947. @end itemize
  13948. @section thumbnail
  13949. Select the most representative frame in a given sequence of consecutive frames.
  13950. The filter accepts the following options:
  13951. @table @option
  13952. @item n
  13953. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13954. will pick one of them, and then handle the next batch of @var{n} frames until
  13955. the end. Default is @code{100}.
  13956. @end table
  13957. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13958. value will result in a higher memory usage, so a high value is not recommended.
  13959. @subsection Examples
  13960. @itemize
  13961. @item
  13962. Extract one picture each 50 frames:
  13963. @example
  13964. thumbnail=50
  13965. @end example
  13966. @item
  13967. Complete example of a thumbnail creation with @command{ffmpeg}:
  13968. @example
  13969. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13970. @end example
  13971. @end itemize
  13972. @anchor{tile}
  13973. @section tile
  13974. Tile several successive frames together.
  13975. The @ref{untile} filter can do the reverse.
  13976. The filter accepts the following options:
  13977. @table @option
  13978. @item layout
  13979. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13980. this option, check the
  13981. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13982. @item nb_frames
  13983. Set the maximum number of frames to render in the given area. It must be less
  13984. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13985. the area will be used.
  13986. @item margin
  13987. Set the outer border margin in pixels.
  13988. @item padding
  13989. Set the inner border thickness (i.e. the number of pixels between frames). For
  13990. more advanced padding options (such as having different values for the edges),
  13991. refer to the pad video filter.
  13992. @item color
  13993. Specify the color of the unused area. For the syntax of this option, check the
  13994. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13995. The default value of @var{color} is "black".
  13996. @item overlap
  13997. Set the number of frames to overlap when tiling several successive frames together.
  13998. The value must be between @code{0} and @var{nb_frames - 1}.
  13999. @item init_padding
  14000. Set the number of frames to initially be empty before displaying first output frame.
  14001. This controls how soon will one get first output frame.
  14002. The value must be between @code{0} and @var{nb_frames - 1}.
  14003. @end table
  14004. @subsection Examples
  14005. @itemize
  14006. @item
  14007. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  14008. @example
  14009. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  14010. @end example
  14011. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  14012. duplicating each output frame to accommodate the originally detected frame
  14013. rate.
  14014. @item
  14015. Display @code{5} pictures in an area of @code{3x2} frames,
  14016. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  14017. mixed flat and named options:
  14018. @example
  14019. tile=3x2:nb_frames=5:padding=7:margin=2
  14020. @end example
  14021. @end itemize
  14022. @section tinterlace
  14023. Perform various types of temporal field interlacing.
  14024. Frames are counted starting from 1, so the first input frame is
  14025. considered odd.
  14026. The filter accepts the following options:
  14027. @table @option
  14028. @item mode
  14029. Specify the mode of the interlacing. This option can also be specified
  14030. as a value alone. See below for a list of values for this option.
  14031. Available values are:
  14032. @table @samp
  14033. @item merge, 0
  14034. Move odd frames into the upper field, even into the lower field,
  14035. generating a double height frame at half frame rate.
  14036. @example
  14037. ------> time
  14038. Input:
  14039. Frame 1 Frame 2 Frame 3 Frame 4
  14040. 11111 22222 33333 44444
  14041. 11111 22222 33333 44444
  14042. 11111 22222 33333 44444
  14043. 11111 22222 33333 44444
  14044. Output:
  14045. 11111 33333
  14046. 22222 44444
  14047. 11111 33333
  14048. 22222 44444
  14049. 11111 33333
  14050. 22222 44444
  14051. 11111 33333
  14052. 22222 44444
  14053. @end example
  14054. @item drop_even, 1
  14055. Only output odd frames, even frames are dropped, generating a frame with
  14056. unchanged height at half frame rate.
  14057. @example
  14058. ------> time
  14059. Input:
  14060. Frame 1 Frame 2 Frame 3 Frame 4
  14061. 11111 22222 33333 44444
  14062. 11111 22222 33333 44444
  14063. 11111 22222 33333 44444
  14064. 11111 22222 33333 44444
  14065. Output:
  14066. 11111 33333
  14067. 11111 33333
  14068. 11111 33333
  14069. 11111 33333
  14070. @end example
  14071. @item drop_odd, 2
  14072. Only output even frames, odd frames are dropped, generating a frame with
  14073. unchanged height at half frame rate.
  14074. @example
  14075. ------> time
  14076. Input:
  14077. Frame 1 Frame 2 Frame 3 Frame 4
  14078. 11111 22222 33333 44444
  14079. 11111 22222 33333 44444
  14080. 11111 22222 33333 44444
  14081. 11111 22222 33333 44444
  14082. Output:
  14083. 22222 44444
  14084. 22222 44444
  14085. 22222 44444
  14086. 22222 44444
  14087. @end example
  14088. @item pad, 3
  14089. Expand each frame to full height, but pad alternate lines with black,
  14090. generating a frame with double height at the same input frame rate.
  14091. @example
  14092. ------> time
  14093. Input:
  14094. Frame 1 Frame 2 Frame 3 Frame 4
  14095. 11111 22222 33333 44444
  14096. 11111 22222 33333 44444
  14097. 11111 22222 33333 44444
  14098. 11111 22222 33333 44444
  14099. Output:
  14100. 11111 ..... 33333 .....
  14101. ..... 22222 ..... 44444
  14102. 11111 ..... 33333 .....
  14103. ..... 22222 ..... 44444
  14104. 11111 ..... 33333 .....
  14105. ..... 22222 ..... 44444
  14106. 11111 ..... 33333 .....
  14107. ..... 22222 ..... 44444
  14108. @end example
  14109. @item interleave_top, 4
  14110. Interleave the upper field from odd frames with the lower field from
  14111. even frames, generating a frame with unchanged height at half frame rate.
  14112. @example
  14113. ------> time
  14114. Input:
  14115. Frame 1 Frame 2 Frame 3 Frame 4
  14116. 11111<- 22222 33333<- 44444
  14117. 11111 22222<- 33333 44444<-
  14118. 11111<- 22222 33333<- 44444
  14119. 11111 22222<- 33333 44444<-
  14120. Output:
  14121. 11111 33333
  14122. 22222 44444
  14123. 11111 33333
  14124. 22222 44444
  14125. @end example
  14126. @item interleave_bottom, 5
  14127. Interleave the lower field from odd frames with the upper field from
  14128. even frames, generating a frame with unchanged height at half frame rate.
  14129. @example
  14130. ------> time
  14131. Input:
  14132. Frame 1 Frame 2 Frame 3 Frame 4
  14133. 11111 22222<- 33333 44444<-
  14134. 11111<- 22222 33333<- 44444
  14135. 11111 22222<- 33333 44444<-
  14136. 11111<- 22222 33333<- 44444
  14137. Output:
  14138. 22222 44444
  14139. 11111 33333
  14140. 22222 44444
  14141. 11111 33333
  14142. @end example
  14143. @item interlacex2, 6
  14144. Double frame rate with unchanged height. Frames are inserted each
  14145. containing the second temporal field from the previous input frame and
  14146. the first temporal field from the next input frame. This mode relies on
  14147. the top_field_first flag. Useful for interlaced video displays with no
  14148. field synchronisation.
  14149. @example
  14150. ------> time
  14151. Input:
  14152. Frame 1 Frame 2 Frame 3 Frame 4
  14153. 11111 22222 33333 44444
  14154. 11111 22222 33333 44444
  14155. 11111 22222 33333 44444
  14156. 11111 22222 33333 44444
  14157. Output:
  14158. 11111 22222 22222 33333 33333 44444 44444
  14159. 11111 11111 22222 22222 33333 33333 44444
  14160. 11111 22222 22222 33333 33333 44444 44444
  14161. 11111 11111 22222 22222 33333 33333 44444
  14162. @end example
  14163. @item mergex2, 7
  14164. Move odd frames into the upper field, even into the lower field,
  14165. generating a double height frame at same frame rate.
  14166. @example
  14167. ------> time
  14168. Input:
  14169. Frame 1 Frame 2 Frame 3 Frame 4
  14170. 11111 22222 33333 44444
  14171. 11111 22222 33333 44444
  14172. 11111 22222 33333 44444
  14173. 11111 22222 33333 44444
  14174. Output:
  14175. 11111 33333 33333 55555
  14176. 22222 22222 44444 44444
  14177. 11111 33333 33333 55555
  14178. 22222 22222 44444 44444
  14179. 11111 33333 33333 55555
  14180. 22222 22222 44444 44444
  14181. 11111 33333 33333 55555
  14182. 22222 22222 44444 44444
  14183. @end example
  14184. @end table
  14185. Numeric values are deprecated but are accepted for backward
  14186. compatibility reasons.
  14187. Default mode is @code{merge}.
  14188. @item flags
  14189. Specify flags influencing the filter process.
  14190. Available value for @var{flags} is:
  14191. @table @option
  14192. @item low_pass_filter, vlpf
  14193. Enable linear vertical low-pass filtering in the filter.
  14194. Vertical low-pass filtering is required when creating an interlaced
  14195. destination from a progressive source which contains high-frequency
  14196. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  14197. patterning.
  14198. @item complex_filter, cvlpf
  14199. Enable complex vertical low-pass filtering.
  14200. This will slightly less reduce interlace 'twitter' and Moire
  14201. patterning but better retain detail and subjective sharpness impression.
  14202. @item bypass_il
  14203. Bypass already interlaced frames, only adjust the frame rate.
  14204. @end table
  14205. Vertical low-pass filtering and bypassing already interlaced frames can only be
  14206. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  14207. @end table
  14208. @section tmedian
  14209. Pick median pixels from several successive input video frames.
  14210. The filter accepts the following options:
  14211. @table @option
  14212. @item radius
  14213. Set radius of median filter.
  14214. Default is 1. Allowed range is from 1 to 127.
  14215. @item planes
  14216. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14217. @item percentile
  14218. Set median percentile. Default value is @code{0.5}.
  14219. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  14220. minimum values, and @code{1} maximum values.
  14221. @end table
  14222. @section tmix
  14223. Mix successive video frames.
  14224. A description of the accepted options follows.
  14225. @table @option
  14226. @item frames
  14227. The number of successive frames to mix. If unspecified, it defaults to 3.
  14228. @item weights
  14229. Specify weight of each input video frame.
  14230. Each weight is separated by space. If number of weights is smaller than
  14231. number of @var{frames} last specified weight will be used for all remaining
  14232. unset weights.
  14233. @item scale
  14234. Specify scale, if it is set it will be multiplied with sum
  14235. of each weight multiplied with pixel values to give final destination
  14236. pixel value. By default @var{scale} is auto scaled to sum of weights.
  14237. @end table
  14238. @subsection Examples
  14239. @itemize
  14240. @item
  14241. Average 7 successive frames:
  14242. @example
  14243. tmix=frames=7:weights="1 1 1 1 1 1 1"
  14244. @end example
  14245. @item
  14246. Apply simple temporal convolution:
  14247. @example
  14248. tmix=frames=3:weights="-1 3 -1"
  14249. @end example
  14250. @item
  14251. Similar as above but only showing temporal differences:
  14252. @example
  14253. tmix=frames=3:weights="-1 2 -1":scale=1
  14254. @end example
  14255. @end itemize
  14256. @anchor{tonemap}
  14257. @section tonemap
  14258. Tone map colors from different dynamic ranges.
  14259. This filter expects data in single precision floating point, as it needs to
  14260. operate on (and can output) out-of-range values. Another filter, such as
  14261. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  14262. The tonemapping algorithms implemented only work on linear light, so input
  14263. data should be linearized beforehand (and possibly correctly tagged).
  14264. @example
  14265. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  14266. @end example
  14267. @subsection Options
  14268. The filter accepts the following options.
  14269. @table @option
  14270. @item tonemap
  14271. Set the tone map algorithm to use.
  14272. Possible values are:
  14273. @table @var
  14274. @item none
  14275. Do not apply any tone map, only desaturate overbright pixels.
  14276. @item clip
  14277. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  14278. in-range values, while distorting out-of-range values.
  14279. @item linear
  14280. Stretch the entire reference gamut to a linear multiple of the display.
  14281. @item gamma
  14282. Fit a logarithmic transfer between the tone curves.
  14283. @item reinhard
  14284. Preserve overall image brightness with a simple curve, using nonlinear
  14285. contrast, which results in flattening details and degrading color accuracy.
  14286. @item hable
  14287. Preserve both dark and bright details better than @var{reinhard}, at the cost
  14288. of slightly darkening everything. Use it when detail preservation is more
  14289. important than color and brightness accuracy.
  14290. @item mobius
  14291. Smoothly map out-of-range values, while retaining contrast and colors for
  14292. in-range material as much as possible. Use it when color accuracy is more
  14293. important than detail preservation.
  14294. @end table
  14295. Default is none.
  14296. @item param
  14297. Tune the tone mapping algorithm.
  14298. This affects the following algorithms:
  14299. @table @var
  14300. @item none
  14301. Ignored.
  14302. @item linear
  14303. Specifies the scale factor to use while stretching.
  14304. Default to 1.0.
  14305. @item gamma
  14306. Specifies the exponent of the function.
  14307. Default to 1.8.
  14308. @item clip
  14309. Specify an extra linear coefficient to multiply into the signal before clipping.
  14310. Default to 1.0.
  14311. @item reinhard
  14312. Specify the local contrast coefficient at the display peak.
  14313. Default to 0.5, which means that in-gamut values will be about half as bright
  14314. as when clipping.
  14315. @item hable
  14316. Ignored.
  14317. @item mobius
  14318. Specify the transition point from linear to mobius transform. Every value
  14319. below this point is guaranteed to be mapped 1:1. The higher the value, the
  14320. more accurate the result will be, at the cost of losing bright details.
  14321. Default to 0.3, which due to the steep initial slope still preserves in-range
  14322. colors fairly accurately.
  14323. @end table
  14324. @item desat
  14325. Apply desaturation for highlights that exceed this level of brightness. The
  14326. higher the parameter, the more color information will be preserved. This
  14327. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14328. (smoothly) turning into white instead. This makes images feel more natural,
  14329. at the cost of reducing information about out-of-range colors.
  14330. The default of 2.0 is somewhat conservative and will mostly just apply to
  14331. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  14332. This option works only if the input frame has a supported color tag.
  14333. @item peak
  14334. Override signal/nominal/reference peak with this value. Useful when the
  14335. embedded peak information in display metadata is not reliable or when tone
  14336. mapping from a lower range to a higher range.
  14337. @end table
  14338. @section tpad
  14339. Temporarily pad video frames.
  14340. The filter accepts the following options:
  14341. @table @option
  14342. @item start
  14343. Specify number of delay frames before input video stream. Default is 0.
  14344. @item stop
  14345. Specify number of padding frames after input video stream.
  14346. Set to -1 to pad indefinitely. Default is 0.
  14347. @item start_mode
  14348. Set kind of frames added to beginning of stream.
  14349. Can be either @var{add} or @var{clone}.
  14350. With @var{add} frames of solid-color are added.
  14351. With @var{clone} frames are clones of first frame.
  14352. Default is @var{add}.
  14353. @item stop_mode
  14354. Set kind of frames added to end of stream.
  14355. Can be either @var{add} or @var{clone}.
  14356. With @var{add} frames of solid-color are added.
  14357. With @var{clone} frames are clones of last frame.
  14358. Default is @var{add}.
  14359. @item start_duration, stop_duration
  14360. Specify the duration of the start/stop delay. See
  14361. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14362. for the accepted syntax.
  14363. These options override @var{start} and @var{stop}. Default is 0.
  14364. @item color
  14365. Specify the color of the padded area. For the syntax of this option,
  14366. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14367. manual,ffmpeg-utils}.
  14368. The default value of @var{color} is "black".
  14369. @end table
  14370. @anchor{transpose}
  14371. @section transpose
  14372. Transpose rows with columns in the input video and optionally flip it.
  14373. It accepts the following parameters:
  14374. @table @option
  14375. @item dir
  14376. Specify the transposition direction.
  14377. Can assume the following values:
  14378. @table @samp
  14379. @item 0, 4, cclock_flip
  14380. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  14381. @example
  14382. L.R L.l
  14383. . . -> . .
  14384. l.r R.r
  14385. @end example
  14386. @item 1, 5, clock
  14387. Rotate by 90 degrees clockwise, that is:
  14388. @example
  14389. L.R l.L
  14390. . . -> . .
  14391. l.r r.R
  14392. @end example
  14393. @item 2, 6, cclock
  14394. Rotate by 90 degrees counterclockwise, that is:
  14395. @example
  14396. L.R R.r
  14397. . . -> . .
  14398. l.r L.l
  14399. @end example
  14400. @item 3, 7, clock_flip
  14401. Rotate by 90 degrees clockwise and vertically flip, that is:
  14402. @example
  14403. L.R r.R
  14404. . . -> . .
  14405. l.r l.L
  14406. @end example
  14407. @end table
  14408. For values between 4-7, the transposition is only done if the input
  14409. video geometry is portrait and not landscape. These values are
  14410. deprecated, the @code{passthrough} option should be used instead.
  14411. Numerical values are deprecated, and should be dropped in favor of
  14412. symbolic constants.
  14413. @item passthrough
  14414. Do not apply the transposition if the input geometry matches the one
  14415. specified by the specified value. It accepts the following values:
  14416. @table @samp
  14417. @item none
  14418. Always apply transposition.
  14419. @item portrait
  14420. Preserve portrait geometry (when @var{height} >= @var{width}).
  14421. @item landscape
  14422. Preserve landscape geometry (when @var{width} >= @var{height}).
  14423. @end table
  14424. Default value is @code{none}.
  14425. @end table
  14426. For example to rotate by 90 degrees clockwise and preserve portrait
  14427. layout:
  14428. @example
  14429. transpose=dir=1:passthrough=portrait
  14430. @end example
  14431. The command above can also be specified as:
  14432. @example
  14433. transpose=1:portrait
  14434. @end example
  14435. @section transpose_npp
  14436. Transpose rows with columns in the input video and optionally flip it.
  14437. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14438. It accepts the following parameters:
  14439. @table @option
  14440. @item dir
  14441. Specify the transposition direction.
  14442. Can assume the following values:
  14443. @table @samp
  14444. @item cclock_flip
  14445. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14446. @item clock
  14447. Rotate by 90 degrees clockwise.
  14448. @item cclock
  14449. Rotate by 90 degrees counterclockwise.
  14450. @item clock_flip
  14451. Rotate by 90 degrees clockwise and vertically flip.
  14452. @end table
  14453. @item passthrough
  14454. Do not apply the transposition if the input geometry matches the one
  14455. specified by the specified value. It accepts the following values:
  14456. @table @samp
  14457. @item none
  14458. Always apply transposition. (default)
  14459. @item portrait
  14460. Preserve portrait geometry (when @var{height} >= @var{width}).
  14461. @item landscape
  14462. Preserve landscape geometry (when @var{width} >= @var{height}).
  14463. @end table
  14464. @end table
  14465. @section trim
  14466. Trim the input so that the output contains one continuous subpart of the input.
  14467. It accepts the following parameters:
  14468. @table @option
  14469. @item start
  14470. Specify the time of the start of the kept section, i.e. the frame with the
  14471. timestamp @var{start} will be the first frame in the output.
  14472. @item end
  14473. Specify the time of the first frame that will be dropped, i.e. the frame
  14474. immediately preceding the one with the timestamp @var{end} will be the last
  14475. frame in the output.
  14476. @item start_pts
  14477. This is the same as @var{start}, except this option sets the start timestamp
  14478. in timebase units instead of seconds.
  14479. @item end_pts
  14480. This is the same as @var{end}, except this option sets the end timestamp
  14481. in timebase units instead of seconds.
  14482. @item duration
  14483. The maximum duration of the output in seconds.
  14484. @item start_frame
  14485. The number of the first frame that should be passed to the output.
  14486. @item end_frame
  14487. The number of the first frame that should be dropped.
  14488. @end table
  14489. @option{start}, @option{end}, and @option{duration} are expressed as time
  14490. duration specifications; see
  14491. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14492. for the accepted syntax.
  14493. Note that the first two sets of the start/end options and the @option{duration}
  14494. option look at the frame timestamp, while the _frame variants simply count the
  14495. frames that pass through the filter. Also note that this filter does not modify
  14496. the timestamps. If you wish for the output timestamps to start at zero, insert a
  14497. setpts filter after the trim filter.
  14498. If multiple start or end options are set, this filter tries to be greedy and
  14499. keep all the frames that match at least one of the specified constraints. To keep
  14500. only the part that matches all the constraints at once, chain multiple trim
  14501. filters.
  14502. The defaults are such that all the input is kept. So it is possible to set e.g.
  14503. just the end values to keep everything before the specified time.
  14504. Examples:
  14505. @itemize
  14506. @item
  14507. Drop everything except the second minute of input:
  14508. @example
  14509. ffmpeg -i INPUT -vf trim=60:120
  14510. @end example
  14511. @item
  14512. Keep only the first second:
  14513. @example
  14514. ffmpeg -i INPUT -vf trim=duration=1
  14515. @end example
  14516. @end itemize
  14517. @section unpremultiply
  14518. Apply alpha unpremultiply effect to input video stream using first plane
  14519. of second stream as alpha.
  14520. Both streams must have same dimensions and same pixel format.
  14521. The filter accepts the following option:
  14522. @table @option
  14523. @item planes
  14524. Set which planes will be processed, unprocessed planes will be copied.
  14525. By default value 0xf, all planes will be processed.
  14526. If the format has 1 or 2 components, then luma is bit 0.
  14527. If the format has 3 or 4 components:
  14528. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  14529. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  14530. If present, the alpha channel is always the last bit.
  14531. @item inplace
  14532. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14533. @end table
  14534. @anchor{unsharp}
  14535. @section unsharp
  14536. Sharpen or blur the input video.
  14537. It accepts the following parameters:
  14538. @table @option
  14539. @item luma_msize_x, lx
  14540. Set the luma matrix horizontal size. It must be an odd integer between
  14541. 3 and 23. The default value is 5.
  14542. @item luma_msize_y, ly
  14543. Set the luma matrix vertical size. It must be an odd integer between 3
  14544. and 23. The default value is 5.
  14545. @item luma_amount, la
  14546. Set the luma effect strength. It must be a floating point number, reasonable
  14547. values lay between -1.5 and 1.5.
  14548. Negative values will blur the input video, while positive values will
  14549. sharpen it, a value of zero will disable the effect.
  14550. Default value is 1.0.
  14551. @item chroma_msize_x, cx
  14552. Set the chroma matrix horizontal size. It must be an odd integer
  14553. between 3 and 23. The default value is 5.
  14554. @item chroma_msize_y, cy
  14555. Set the chroma matrix vertical size. It must be an odd integer
  14556. between 3 and 23. The default value is 5.
  14557. @item chroma_amount, ca
  14558. Set the chroma effect strength. It must be a floating point number, reasonable
  14559. values lay between -1.5 and 1.5.
  14560. Negative values will blur the input video, while positive values will
  14561. sharpen it, a value of zero will disable the effect.
  14562. Default value is 0.0.
  14563. @end table
  14564. All parameters are optional and default to the equivalent of the
  14565. string '5:5:1.0:5:5:0.0'.
  14566. @subsection Examples
  14567. @itemize
  14568. @item
  14569. Apply strong luma sharpen effect:
  14570. @example
  14571. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  14572. @end example
  14573. @item
  14574. Apply a strong blur of both luma and chroma parameters:
  14575. @example
  14576. unsharp=7:7:-2:7:7:-2
  14577. @end example
  14578. @end itemize
  14579. @anchor{untile}
  14580. @section untile
  14581. Decompose a video made of tiled images into the individual images.
  14582. The frame rate of the output video is the frame rate of the input video
  14583. multiplied by the number of tiles.
  14584. This filter does the reverse of @ref{tile}.
  14585. The filter accepts the following options:
  14586. @table @option
  14587. @item layout
  14588. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14589. this option, check the
  14590. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14591. @end table
  14592. @subsection Examples
  14593. @itemize
  14594. @item
  14595. Produce a 1-second video from a still image file made of 25 frames stacked
  14596. vertically, like an analogic film reel:
  14597. @example
  14598. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  14599. @end example
  14600. @end itemize
  14601. @section uspp
  14602. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  14603. the image at several (or - in the case of @option{quality} level @code{8} - all)
  14604. shifts and average the results.
  14605. The way this differs from the behavior of spp is that uspp actually encodes &
  14606. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  14607. DCT similar to MJPEG.
  14608. The filter accepts the following options:
  14609. @table @option
  14610. @item quality
  14611. Set quality. This option defines the number of levels for averaging. It accepts
  14612. an integer in the range 0-8. If set to @code{0}, the filter will have no
  14613. effect. A value of @code{8} means the higher quality. For each increment of
  14614. that value the speed drops by a factor of approximately 2. Default value is
  14615. @code{3}.
  14616. @item qp
  14617. Force a constant quantization parameter. If not set, the filter will use the QP
  14618. from the video stream (if available).
  14619. @end table
  14620. @section v360
  14621. Convert 360 videos between various formats.
  14622. The filter accepts the following options:
  14623. @table @option
  14624. @item input
  14625. @item output
  14626. Set format of the input/output video.
  14627. Available formats:
  14628. @table @samp
  14629. @item e
  14630. @item equirect
  14631. Equirectangular projection.
  14632. @item c3x2
  14633. @item c6x1
  14634. @item c1x6
  14635. Cubemap with 3x2/6x1/1x6 layout.
  14636. Format specific options:
  14637. @table @option
  14638. @item in_pad
  14639. @item out_pad
  14640. Set padding proportion for the input/output cubemap. Values in decimals.
  14641. Example values:
  14642. @table @samp
  14643. @item 0
  14644. No padding.
  14645. @item 0.01
  14646. 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)
  14647. @end table
  14648. Default value is @b{@samp{0}}.
  14649. Maximum value is @b{@samp{0.1}}.
  14650. @item fin_pad
  14651. @item fout_pad
  14652. Set fixed padding for the input/output cubemap. Values in pixels.
  14653. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  14654. @item in_forder
  14655. @item out_forder
  14656. Set order of faces for the input/output cubemap. Choose one direction for each position.
  14657. Designation of directions:
  14658. @table @samp
  14659. @item r
  14660. right
  14661. @item l
  14662. left
  14663. @item u
  14664. up
  14665. @item d
  14666. down
  14667. @item f
  14668. forward
  14669. @item b
  14670. back
  14671. @end table
  14672. Default value is @b{@samp{rludfb}}.
  14673. @item in_frot
  14674. @item out_frot
  14675. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  14676. Designation of angles:
  14677. @table @samp
  14678. @item 0
  14679. 0 degrees clockwise
  14680. @item 1
  14681. 90 degrees clockwise
  14682. @item 2
  14683. 180 degrees clockwise
  14684. @item 3
  14685. 270 degrees clockwise
  14686. @end table
  14687. Default value is @b{@samp{000000}}.
  14688. @end table
  14689. @item eac
  14690. Equi-Angular Cubemap.
  14691. @item flat
  14692. @item gnomonic
  14693. @item rectilinear
  14694. Regular video.
  14695. Format specific options:
  14696. @table @option
  14697. @item h_fov
  14698. @item v_fov
  14699. @item d_fov
  14700. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14701. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14702. @item ih_fov
  14703. @item iv_fov
  14704. @item id_fov
  14705. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14706. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14707. @end table
  14708. @item dfisheye
  14709. Dual fisheye.
  14710. Format specific options:
  14711. @table @option
  14712. @item h_fov
  14713. @item v_fov
  14714. @item d_fov
  14715. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14716. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14717. @item ih_fov
  14718. @item iv_fov
  14719. @item id_fov
  14720. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14721. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14722. @end table
  14723. @item barrel
  14724. @item fb
  14725. @item barrelsplit
  14726. Facebook's 360 formats.
  14727. @item sg
  14728. Stereographic format.
  14729. Format specific options:
  14730. @table @option
  14731. @item h_fov
  14732. @item v_fov
  14733. @item d_fov
  14734. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14735. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14736. @item ih_fov
  14737. @item iv_fov
  14738. @item id_fov
  14739. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14740. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14741. @end table
  14742. @item mercator
  14743. Mercator format.
  14744. @item ball
  14745. Ball format, gives significant distortion toward the back.
  14746. @item hammer
  14747. Hammer-Aitoff map projection format.
  14748. @item sinusoidal
  14749. Sinusoidal map projection format.
  14750. @item fisheye
  14751. Fisheye projection.
  14752. Format specific options:
  14753. @table @option
  14754. @item h_fov
  14755. @item v_fov
  14756. @item d_fov
  14757. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14758. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14759. @item ih_fov
  14760. @item iv_fov
  14761. @item id_fov
  14762. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14763. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14764. @end table
  14765. @item pannini
  14766. Pannini projection.
  14767. Format specific options:
  14768. @table @option
  14769. @item h_fov
  14770. Set output pannini parameter.
  14771. @item ih_fov
  14772. Set input pannini parameter.
  14773. @end table
  14774. @item cylindrical
  14775. Cylindrical projection.
  14776. Format specific options:
  14777. @table @option
  14778. @item h_fov
  14779. @item v_fov
  14780. @item d_fov
  14781. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14782. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14783. @item ih_fov
  14784. @item iv_fov
  14785. @item id_fov
  14786. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14787. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14788. @end table
  14789. @item perspective
  14790. Perspective projection. @i{(output only)}
  14791. Format specific options:
  14792. @table @option
  14793. @item v_fov
  14794. Set perspective parameter.
  14795. @end table
  14796. @item tetrahedron
  14797. Tetrahedron projection.
  14798. @item tsp
  14799. Truncated square pyramid projection.
  14800. @item he
  14801. @item hequirect
  14802. Half equirectangular projection.
  14803. @item equisolid
  14804. Equisolid format.
  14805. Format specific options:
  14806. @table @option
  14807. @item h_fov
  14808. @item v_fov
  14809. @item d_fov
  14810. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14811. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14812. @item ih_fov
  14813. @item iv_fov
  14814. @item id_fov
  14815. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14816. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14817. @end table
  14818. @item og
  14819. Orthographic format.
  14820. Format specific options:
  14821. @table @option
  14822. @item h_fov
  14823. @item v_fov
  14824. @item d_fov
  14825. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14826. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14827. @item ih_fov
  14828. @item iv_fov
  14829. @item id_fov
  14830. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14831. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14832. @end table
  14833. @end table
  14834. @item interp
  14835. Set interpolation method.@*
  14836. @i{Note: more complex interpolation methods require much more memory to run.}
  14837. Available methods:
  14838. @table @samp
  14839. @item near
  14840. @item nearest
  14841. Nearest neighbour.
  14842. @item line
  14843. @item linear
  14844. Bilinear interpolation.
  14845. @item lagrange9
  14846. Lagrange9 interpolation.
  14847. @item cube
  14848. @item cubic
  14849. Bicubic interpolation.
  14850. @item lanc
  14851. @item lanczos
  14852. Lanczos interpolation.
  14853. @item sp16
  14854. @item spline16
  14855. Spline16 interpolation.
  14856. @item gauss
  14857. @item gaussian
  14858. Gaussian interpolation.
  14859. @end table
  14860. Default value is @b{@samp{line}}.
  14861. @item w
  14862. @item h
  14863. Set the output video resolution.
  14864. Default resolution depends on formats.
  14865. @item in_stereo
  14866. @item out_stereo
  14867. Set the input/output stereo format.
  14868. @table @samp
  14869. @item 2d
  14870. 2D mono
  14871. @item sbs
  14872. Side by side
  14873. @item tb
  14874. Top bottom
  14875. @end table
  14876. Default value is @b{@samp{2d}} for input and output format.
  14877. @item yaw
  14878. @item pitch
  14879. @item roll
  14880. Set rotation for the output video. Values in degrees.
  14881. @item rorder
  14882. Set rotation order for the output video. Choose one item for each position.
  14883. @table @samp
  14884. @item y, Y
  14885. yaw
  14886. @item p, P
  14887. pitch
  14888. @item r, R
  14889. roll
  14890. @end table
  14891. Default value is @b{@samp{ypr}}.
  14892. @item h_flip
  14893. @item v_flip
  14894. @item d_flip
  14895. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  14896. @item ih_flip
  14897. @item iv_flip
  14898. Set if input video is flipped horizontally/vertically. Boolean values.
  14899. @item in_trans
  14900. Set if input video is transposed. Boolean value, by default disabled.
  14901. @item out_trans
  14902. Set if output video needs to be transposed. Boolean value, by default disabled.
  14903. @item alpha_mask
  14904. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  14905. @end table
  14906. @subsection Examples
  14907. @itemize
  14908. @item
  14909. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  14910. @example
  14911. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  14912. @end example
  14913. @item
  14914. Extract back view of Equi-Angular Cubemap:
  14915. @example
  14916. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  14917. @end example
  14918. @item
  14919. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  14920. @example
  14921. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  14922. @end example
  14923. @end itemize
  14924. @subsection Commands
  14925. This filter supports subset of above options as @ref{commands}.
  14926. @section vaguedenoiser
  14927. Apply a wavelet based denoiser.
  14928. It transforms each frame from the video input into the wavelet domain,
  14929. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  14930. the obtained coefficients. It does an inverse wavelet transform after.
  14931. Due to wavelet properties, it should give a nice smoothed result, and
  14932. reduced noise, without blurring picture features.
  14933. This filter accepts the following options:
  14934. @table @option
  14935. @item threshold
  14936. The filtering strength. The higher, the more filtered the video will be.
  14937. Hard thresholding can use a higher threshold than soft thresholding
  14938. before the video looks overfiltered. Default value is 2.
  14939. @item method
  14940. The filtering method the filter will use.
  14941. It accepts the following values:
  14942. @table @samp
  14943. @item hard
  14944. All values under the threshold will be zeroed.
  14945. @item soft
  14946. All values under the threshold will be zeroed. All values above will be
  14947. reduced by the threshold.
  14948. @item garrote
  14949. Scales or nullifies coefficients - intermediary between (more) soft and
  14950. (less) hard thresholding.
  14951. @end table
  14952. Default is garrote.
  14953. @item nsteps
  14954. Number of times, the wavelet will decompose the picture. Picture can't
  14955. be decomposed beyond a particular point (typically, 8 for a 640x480
  14956. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  14957. @item percent
  14958. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  14959. @item planes
  14960. A list of the planes to process. By default all planes are processed.
  14961. @item type
  14962. The threshold type the filter will use.
  14963. It accepts the following values:
  14964. @table @samp
  14965. @item universal
  14966. Threshold used is same for all decompositions.
  14967. @item bayes
  14968. Threshold used depends also on each decomposition coefficients.
  14969. @end table
  14970. Default is universal.
  14971. @end table
  14972. @section vectorscope
  14973. Display 2 color component values in the two dimensional graph (which is called
  14974. a vectorscope).
  14975. This filter accepts the following options:
  14976. @table @option
  14977. @item mode, m
  14978. Set vectorscope mode.
  14979. It accepts the following values:
  14980. @table @samp
  14981. @item gray
  14982. @item tint
  14983. Gray values are displayed on graph, higher brightness means more pixels have
  14984. same component color value on location in graph. This is the default mode.
  14985. @item color
  14986. Gray values are displayed on graph. Surrounding pixels values which are not
  14987. present in video frame are drawn in gradient of 2 color components which are
  14988. set by option @code{x} and @code{y}. The 3rd color component is static.
  14989. @item color2
  14990. Actual color components values present in video frame are displayed on graph.
  14991. @item color3
  14992. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  14993. on graph increases value of another color component, which is luminance by
  14994. default values of @code{x} and @code{y}.
  14995. @item color4
  14996. Actual colors present in video frame are displayed on graph. If two different
  14997. colors map to same position on graph then color with higher value of component
  14998. not present in graph is picked.
  14999. @item color5
  15000. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  15001. component picked from radial gradient.
  15002. @end table
  15003. @item x
  15004. Set which color component will be represented on X-axis. Default is @code{1}.
  15005. @item y
  15006. Set which color component will be represented on Y-axis. Default is @code{2}.
  15007. @item intensity, i
  15008. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  15009. of color component which represents frequency of (X, Y) location in graph.
  15010. @item envelope, e
  15011. @table @samp
  15012. @item none
  15013. No envelope, this is default.
  15014. @item instant
  15015. Instant envelope, even darkest single pixel will be clearly highlighted.
  15016. @item peak
  15017. Hold maximum and minimum values presented in graph over time. This way you
  15018. can still spot out of range values without constantly looking at vectorscope.
  15019. @item peak+instant
  15020. Peak and instant envelope combined together.
  15021. @end table
  15022. @item graticule, g
  15023. Set what kind of graticule to draw.
  15024. @table @samp
  15025. @item none
  15026. @item green
  15027. @item color
  15028. @item invert
  15029. @end table
  15030. @item opacity, o
  15031. Set graticule opacity.
  15032. @item flags, f
  15033. Set graticule flags.
  15034. @table @samp
  15035. @item white
  15036. Draw graticule for white point.
  15037. @item black
  15038. Draw graticule for black point.
  15039. @item name
  15040. Draw color points short names.
  15041. @end table
  15042. @item bgopacity, b
  15043. Set background opacity.
  15044. @item lthreshold, l
  15045. Set low threshold for color component not represented on X or Y axis.
  15046. Values lower than this value will be ignored. Default is 0.
  15047. Note this value is multiplied with actual max possible value one pixel component
  15048. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  15049. is 0.1 * 255 = 25.
  15050. @item hthreshold, h
  15051. Set high threshold for color component not represented on X or Y axis.
  15052. Values higher than this value will be ignored. Default is 1.
  15053. Note this value is multiplied with actual max possible value one pixel component
  15054. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  15055. is 0.9 * 255 = 230.
  15056. @item colorspace, c
  15057. Set what kind of colorspace to use when drawing graticule.
  15058. @table @samp
  15059. @item auto
  15060. @item 601
  15061. @item 709
  15062. @end table
  15063. Default is auto.
  15064. @item tint0, t0
  15065. @item tint1, t1
  15066. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  15067. This means no tint, and output will remain gray.
  15068. @end table
  15069. @anchor{vidstabdetect}
  15070. @section vidstabdetect
  15071. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  15072. @ref{vidstabtransform} for pass 2.
  15073. This filter generates a file with relative translation and rotation
  15074. transform information about subsequent frames, which is then used by
  15075. the @ref{vidstabtransform} filter.
  15076. To enable compilation of this filter you need to configure FFmpeg with
  15077. @code{--enable-libvidstab}.
  15078. This filter accepts the following options:
  15079. @table @option
  15080. @item result
  15081. Set the path to the file used to write the transforms information.
  15082. Default value is @file{transforms.trf}.
  15083. @item shakiness
  15084. Set how shaky the video is and how quick the camera is. It accepts an
  15085. integer in the range 1-10, a value of 1 means little shakiness, a
  15086. value of 10 means strong shakiness. Default value is 5.
  15087. @item accuracy
  15088. Set the accuracy of the detection process. It must be a value in the
  15089. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  15090. accuracy. Default value is 15.
  15091. @item stepsize
  15092. Set stepsize of the search process. The region around minimum is
  15093. scanned with 1 pixel resolution. Default value is 6.
  15094. @item mincontrast
  15095. Set minimum contrast. Below this value a local measurement field is
  15096. discarded. Must be a floating point value in the range 0-1. Default
  15097. value is 0.3.
  15098. @item tripod
  15099. Set reference frame number for tripod mode.
  15100. If enabled, the motion of the frames is compared to a reference frame
  15101. in the filtered stream, identified by the specified number. The idea
  15102. is to compensate all movements in a more-or-less static scene and keep
  15103. the camera view absolutely still.
  15104. If set to 0, it is disabled. The frames are counted starting from 1.
  15105. @item show
  15106. Show fields and transforms in the resulting frames. It accepts an
  15107. integer in the range 0-2. Default value is 0, which disables any
  15108. visualization.
  15109. @end table
  15110. @subsection Examples
  15111. @itemize
  15112. @item
  15113. Use default values:
  15114. @example
  15115. vidstabdetect
  15116. @end example
  15117. @item
  15118. Analyze strongly shaky movie and put the results in file
  15119. @file{mytransforms.trf}:
  15120. @example
  15121. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  15122. @end example
  15123. @item
  15124. Visualize the result of internal transformations in the resulting
  15125. video:
  15126. @example
  15127. vidstabdetect=show=1
  15128. @end example
  15129. @item
  15130. Analyze a video with medium shakiness using @command{ffmpeg}:
  15131. @example
  15132. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  15133. @end example
  15134. @end itemize
  15135. @anchor{vidstabtransform}
  15136. @section vidstabtransform
  15137. Video stabilization/deshaking: pass 2 of 2,
  15138. see @ref{vidstabdetect} for pass 1.
  15139. Read a file with transform information for each frame and
  15140. apply/compensate them. Together with the @ref{vidstabdetect}
  15141. filter this can be used to deshake videos. See also
  15142. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  15143. the @ref{unsharp} filter, see below.
  15144. To enable compilation of this filter you need to configure FFmpeg with
  15145. @code{--enable-libvidstab}.
  15146. @subsection Options
  15147. @table @option
  15148. @item input
  15149. Set path to the file used to read the transforms. Default value is
  15150. @file{transforms.trf}.
  15151. @item smoothing
  15152. Set the number of frames (value*2 + 1) used for lowpass filtering the
  15153. camera movements. Default value is 10.
  15154. For example a number of 10 means that 21 frames are used (10 in the
  15155. past and 10 in the future) to smoothen the motion in the video. A
  15156. larger value leads to a smoother video, but limits the acceleration of
  15157. the camera (pan/tilt movements). 0 is a special case where a static
  15158. camera is simulated.
  15159. @item optalgo
  15160. Set the camera path optimization algorithm.
  15161. Accepted values are:
  15162. @table @samp
  15163. @item gauss
  15164. gaussian kernel low-pass filter on camera motion (default)
  15165. @item avg
  15166. averaging on transformations
  15167. @end table
  15168. @item maxshift
  15169. Set maximal number of pixels to translate frames. Default value is -1,
  15170. meaning no limit.
  15171. @item maxangle
  15172. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  15173. value is -1, meaning no limit.
  15174. @item crop
  15175. Specify how to deal with borders that may be visible due to movement
  15176. compensation.
  15177. Available values are:
  15178. @table @samp
  15179. @item keep
  15180. keep image information from previous frame (default)
  15181. @item black
  15182. fill the border black
  15183. @end table
  15184. @item invert
  15185. Invert transforms if set to 1. Default value is 0.
  15186. @item relative
  15187. Consider transforms as relative to previous frame if set to 1,
  15188. absolute if set to 0. Default value is 0.
  15189. @item zoom
  15190. Set percentage to zoom. A positive value will result in a zoom-in
  15191. effect, a negative value in a zoom-out effect. Default value is 0 (no
  15192. zoom).
  15193. @item optzoom
  15194. Set optimal zooming to avoid borders.
  15195. Accepted values are:
  15196. @table @samp
  15197. @item 0
  15198. disabled
  15199. @item 1
  15200. optimal static zoom value is determined (only very strong movements
  15201. will lead to visible borders) (default)
  15202. @item 2
  15203. optimal adaptive zoom value is determined (no borders will be
  15204. visible), see @option{zoomspeed}
  15205. @end table
  15206. Note that the value given at zoom is added to the one calculated here.
  15207. @item zoomspeed
  15208. Set percent to zoom maximally each frame (enabled when
  15209. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  15210. 0.25.
  15211. @item interpol
  15212. Specify type of interpolation.
  15213. Available values are:
  15214. @table @samp
  15215. @item no
  15216. no interpolation
  15217. @item linear
  15218. linear only horizontal
  15219. @item bilinear
  15220. linear in both directions (default)
  15221. @item bicubic
  15222. cubic in both directions (slow)
  15223. @end table
  15224. @item tripod
  15225. Enable virtual tripod mode if set to 1, which is equivalent to
  15226. @code{relative=0:smoothing=0}. Default value is 0.
  15227. Use also @code{tripod} option of @ref{vidstabdetect}.
  15228. @item debug
  15229. Increase log verbosity if set to 1. Also the detected global motions
  15230. are written to the temporary file @file{global_motions.trf}. Default
  15231. value is 0.
  15232. @end table
  15233. @subsection Examples
  15234. @itemize
  15235. @item
  15236. Use @command{ffmpeg} for a typical stabilization with default values:
  15237. @example
  15238. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  15239. @end example
  15240. Note the use of the @ref{unsharp} filter which is always recommended.
  15241. @item
  15242. Zoom in a bit more and load transform data from a given file:
  15243. @example
  15244. vidstabtransform=zoom=5:input="mytransforms.trf"
  15245. @end example
  15246. @item
  15247. Smoothen the video even more:
  15248. @example
  15249. vidstabtransform=smoothing=30
  15250. @end example
  15251. @end itemize
  15252. @section vflip
  15253. Flip the input video vertically.
  15254. For example, to vertically flip a video with @command{ffmpeg}:
  15255. @example
  15256. ffmpeg -i in.avi -vf "vflip" out.avi
  15257. @end example
  15258. @section vfrdet
  15259. Detect variable frame rate video.
  15260. This filter tries to detect if the input is variable or constant frame rate.
  15261. At end it will output number of frames detected as having variable delta pts,
  15262. and ones with constant delta pts.
  15263. If there was frames with variable delta, than it will also show min, max and
  15264. average delta encountered.
  15265. @section vibrance
  15266. Boost or alter saturation.
  15267. The filter accepts the following options:
  15268. @table @option
  15269. @item intensity
  15270. Set strength of boost if positive value or strength of alter if negative value.
  15271. Default is 0. Allowed range is from -2 to 2.
  15272. @item rbal
  15273. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  15274. @item gbal
  15275. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  15276. @item bbal
  15277. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  15278. @item rlum
  15279. Set the red luma coefficient.
  15280. @item glum
  15281. Set the green luma coefficient.
  15282. @item blum
  15283. Set the blue luma coefficient.
  15284. @item alternate
  15285. If @code{intensity} is negative and this is set to 1, colors will change,
  15286. otherwise colors will be less saturated, more towards gray.
  15287. @end table
  15288. @subsection Commands
  15289. This filter supports the all above options as @ref{commands}.
  15290. @anchor{vignette}
  15291. @section vignette
  15292. Make or reverse a natural vignetting effect.
  15293. The filter accepts the following options:
  15294. @table @option
  15295. @item angle, a
  15296. Set lens angle expression as a number of radians.
  15297. The value is clipped in the @code{[0,PI/2]} range.
  15298. Default value: @code{"PI/5"}
  15299. @item x0
  15300. @item y0
  15301. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  15302. by default.
  15303. @item mode
  15304. Set forward/backward mode.
  15305. Available modes are:
  15306. @table @samp
  15307. @item forward
  15308. The larger the distance from the central point, the darker the image becomes.
  15309. @item backward
  15310. The larger the distance from the central point, the brighter the image becomes.
  15311. This can be used to reverse a vignette effect, though there is no automatic
  15312. detection to extract the lens @option{angle} and other settings (yet). It can
  15313. also be used to create a burning effect.
  15314. @end table
  15315. Default value is @samp{forward}.
  15316. @item eval
  15317. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  15318. It accepts the following values:
  15319. @table @samp
  15320. @item init
  15321. Evaluate expressions only once during the filter initialization.
  15322. @item frame
  15323. Evaluate expressions for each incoming frame. This is way slower than the
  15324. @samp{init} mode since it requires all the scalers to be re-computed, but it
  15325. allows advanced dynamic expressions.
  15326. @end table
  15327. Default value is @samp{init}.
  15328. @item dither
  15329. Set dithering to reduce the circular banding effects. Default is @code{1}
  15330. (enabled).
  15331. @item aspect
  15332. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  15333. Setting this value to the SAR of the input will make a rectangular vignetting
  15334. following the dimensions of the video.
  15335. Default is @code{1/1}.
  15336. @end table
  15337. @subsection Expressions
  15338. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  15339. following parameters.
  15340. @table @option
  15341. @item w
  15342. @item h
  15343. input width and height
  15344. @item n
  15345. the number of input frame, starting from 0
  15346. @item pts
  15347. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  15348. @var{TB} units, NAN if undefined
  15349. @item r
  15350. frame rate of the input video, NAN if the input frame rate is unknown
  15351. @item t
  15352. the PTS (Presentation TimeStamp) of the filtered video frame,
  15353. expressed in seconds, NAN if undefined
  15354. @item tb
  15355. time base of the input video
  15356. @end table
  15357. @subsection Examples
  15358. @itemize
  15359. @item
  15360. Apply simple strong vignetting effect:
  15361. @example
  15362. vignette=PI/4
  15363. @end example
  15364. @item
  15365. Make a flickering vignetting:
  15366. @example
  15367. vignette='PI/4+random(1)*PI/50':eval=frame
  15368. @end example
  15369. @end itemize
  15370. @section vmafmotion
  15371. Obtain the average VMAF motion score of a video.
  15372. It is one of the component metrics of VMAF.
  15373. The obtained average motion score is printed through the logging system.
  15374. The filter accepts the following options:
  15375. @table @option
  15376. @item stats_file
  15377. If specified, the filter will use the named file to save the motion score of
  15378. each frame with respect to the previous frame.
  15379. When filename equals "-" the data is sent to standard output.
  15380. @end table
  15381. Example:
  15382. @example
  15383. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  15384. @end example
  15385. @section vstack
  15386. Stack input videos vertically.
  15387. All streams must be of same pixel format and of same width.
  15388. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  15389. to create same output.
  15390. The filter accepts the following options:
  15391. @table @option
  15392. @item inputs
  15393. Set number of input streams. Default is 2.
  15394. @item shortest
  15395. If set to 1, force the output to terminate when the shortest input
  15396. terminates. Default value is 0.
  15397. @end table
  15398. @section w3fdif
  15399. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  15400. Deinterlacing Filter").
  15401. Based on the process described by Martin Weston for BBC R&D, and
  15402. implemented based on the de-interlace algorithm written by Jim
  15403. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  15404. uses filter coefficients calculated by BBC R&D.
  15405. This filter uses field-dominance information in frame to decide which
  15406. of each pair of fields to place first in the output.
  15407. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  15408. There are two sets of filter coefficients, so called "simple"
  15409. and "complex". Which set of filter coefficients is used can
  15410. be set by passing an optional parameter:
  15411. @table @option
  15412. @item filter
  15413. Set the interlacing filter coefficients. Accepts one of the following values:
  15414. @table @samp
  15415. @item simple
  15416. Simple filter coefficient set.
  15417. @item complex
  15418. More-complex filter coefficient set.
  15419. @end table
  15420. Default value is @samp{complex}.
  15421. @item deint
  15422. Specify which frames to deinterlace. Accepts one of the following values:
  15423. @table @samp
  15424. @item all
  15425. Deinterlace all frames,
  15426. @item interlaced
  15427. Only deinterlace frames marked as interlaced.
  15428. @end table
  15429. Default value is @samp{all}.
  15430. @end table
  15431. @section waveform
  15432. Video waveform monitor.
  15433. The waveform monitor plots color component intensity. By default luminance
  15434. only. Each column of the waveform corresponds to a column of pixels in the
  15435. source video.
  15436. It accepts the following options:
  15437. @table @option
  15438. @item mode, m
  15439. Can be either @code{row}, or @code{column}. Default is @code{column}.
  15440. In row mode, the graph on the left side represents color component value 0 and
  15441. the right side represents value = 255. In column mode, the top side represents
  15442. color component value = 0 and bottom side represents value = 255.
  15443. @item intensity, i
  15444. Set intensity. Smaller values are useful to find out how many values of the same
  15445. luminance are distributed across input rows/columns.
  15446. Default value is @code{0.04}. Allowed range is [0, 1].
  15447. @item mirror, r
  15448. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  15449. In mirrored mode, higher values will be represented on the left
  15450. side for @code{row} mode and at the top for @code{column} mode. Default is
  15451. @code{1} (mirrored).
  15452. @item display, d
  15453. Set display mode.
  15454. It accepts the following values:
  15455. @table @samp
  15456. @item overlay
  15457. Presents information identical to that in the @code{parade}, except
  15458. that the graphs representing color components are superimposed directly
  15459. over one another.
  15460. This display mode makes it easier to spot relative differences or similarities
  15461. in overlapping areas of the color components that are supposed to be identical,
  15462. such as neutral whites, grays, or blacks.
  15463. @item stack
  15464. Display separate graph for the color components side by side in
  15465. @code{row} mode or one below the other in @code{column} mode.
  15466. @item parade
  15467. Display separate graph for the color components side by side in
  15468. @code{column} mode or one below the other in @code{row} mode.
  15469. Using this display mode makes it easy to spot color casts in the highlights
  15470. and shadows of an image, by comparing the contours of the top and the bottom
  15471. graphs of each waveform. Since whites, grays, and blacks are characterized
  15472. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  15473. should display three waveforms of roughly equal width/height. If not, the
  15474. correction is easy to perform by making level adjustments the three waveforms.
  15475. @end table
  15476. Default is @code{stack}.
  15477. @item components, c
  15478. Set which color components to display. Default is 1, which means only luminance
  15479. or red color component if input is in RGB colorspace. If is set for example to
  15480. 7 it will display all 3 (if) available color components.
  15481. @item envelope, e
  15482. @table @samp
  15483. @item none
  15484. No envelope, this is default.
  15485. @item instant
  15486. Instant envelope, minimum and maximum values presented in graph will be easily
  15487. visible even with small @code{step} value.
  15488. @item peak
  15489. Hold minimum and maximum values presented in graph across time. This way you
  15490. can still spot out of range values without constantly looking at waveforms.
  15491. @item peak+instant
  15492. Peak and instant envelope combined together.
  15493. @end table
  15494. @item filter, f
  15495. @table @samp
  15496. @item lowpass
  15497. No filtering, this is default.
  15498. @item flat
  15499. Luma and chroma combined together.
  15500. @item aflat
  15501. Similar as above, but shows difference between blue and red chroma.
  15502. @item xflat
  15503. Similar as above, but use different colors.
  15504. @item yflat
  15505. Similar as above, but again with different colors.
  15506. @item chroma
  15507. Displays only chroma.
  15508. @item color
  15509. Displays actual color value on waveform.
  15510. @item acolor
  15511. Similar as above, but with luma showing frequency of chroma values.
  15512. @end table
  15513. @item graticule, g
  15514. Set which graticule to display.
  15515. @table @samp
  15516. @item none
  15517. Do not display graticule.
  15518. @item green
  15519. Display green graticule showing legal broadcast ranges.
  15520. @item orange
  15521. Display orange graticule showing legal broadcast ranges.
  15522. @item invert
  15523. Display invert graticule showing legal broadcast ranges.
  15524. @end table
  15525. @item opacity, o
  15526. Set graticule opacity.
  15527. @item flags, fl
  15528. Set graticule flags.
  15529. @table @samp
  15530. @item numbers
  15531. Draw numbers above lines. By default enabled.
  15532. @item dots
  15533. Draw dots instead of lines.
  15534. @end table
  15535. @item scale, s
  15536. Set scale used for displaying graticule.
  15537. @table @samp
  15538. @item digital
  15539. @item millivolts
  15540. @item ire
  15541. @end table
  15542. Default is digital.
  15543. @item bgopacity, b
  15544. Set background opacity.
  15545. @item tint0, t0
  15546. @item tint1, t1
  15547. Set tint for output.
  15548. Only used with lowpass filter and when display is not overlay and input
  15549. pixel formats are not RGB.
  15550. @end table
  15551. @section weave, doubleweave
  15552. The @code{weave} takes a field-based video input and join
  15553. each two sequential fields into single frame, producing a new double
  15554. height clip with half the frame rate and half the frame count.
  15555. The @code{doubleweave} works same as @code{weave} but without
  15556. halving frame rate and frame count.
  15557. It accepts the following option:
  15558. @table @option
  15559. @item first_field
  15560. Set first field. Available values are:
  15561. @table @samp
  15562. @item top, t
  15563. Set the frame as top-field-first.
  15564. @item bottom, b
  15565. Set the frame as bottom-field-first.
  15566. @end table
  15567. @end table
  15568. @subsection Examples
  15569. @itemize
  15570. @item
  15571. Interlace video using @ref{select} and @ref{separatefields} filter:
  15572. @example
  15573. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  15574. @end example
  15575. @end itemize
  15576. @section xbr
  15577. Apply the xBR high-quality magnification filter which is designed for pixel
  15578. art. It follows a set of edge-detection rules, see
  15579. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  15580. It accepts the following option:
  15581. @table @option
  15582. @item n
  15583. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  15584. @code{3xBR} and @code{4} for @code{4xBR}.
  15585. Default is @code{3}.
  15586. @end table
  15587. @section xfade
  15588. Apply cross fade from one input video stream to another input video stream.
  15589. The cross fade is applied for specified duration.
  15590. The filter accepts the following options:
  15591. @table @option
  15592. @item transition
  15593. Set one of available transition effects:
  15594. @table @samp
  15595. @item custom
  15596. @item fade
  15597. @item wipeleft
  15598. @item wiperight
  15599. @item wipeup
  15600. @item wipedown
  15601. @item slideleft
  15602. @item slideright
  15603. @item slideup
  15604. @item slidedown
  15605. @item circlecrop
  15606. @item rectcrop
  15607. @item distance
  15608. @item fadeblack
  15609. @item fadewhite
  15610. @item radial
  15611. @item smoothleft
  15612. @item smoothright
  15613. @item smoothup
  15614. @item smoothdown
  15615. @item circleopen
  15616. @item circleclose
  15617. @item vertopen
  15618. @item vertclose
  15619. @item horzopen
  15620. @item horzclose
  15621. @item dissolve
  15622. @item pixelize
  15623. @item diagtl
  15624. @item diagtr
  15625. @item diagbl
  15626. @item diagbr
  15627. @item hlslice
  15628. @item hrslice
  15629. @item vuslice
  15630. @item vdslice
  15631. @item hblur
  15632. @item fadegrays
  15633. @item wipetl
  15634. @item wipetr
  15635. @item wipebl
  15636. @item wipebr
  15637. @end table
  15638. Default transition effect is fade.
  15639. @item duration
  15640. Set cross fade duration in seconds.
  15641. Default duration is 1 second.
  15642. @item offset
  15643. Set cross fade start relative to first input stream in seconds.
  15644. Default offset is 0.
  15645. @item expr
  15646. Set expression for custom transition effect.
  15647. The expressions can use the following variables and functions:
  15648. @table @option
  15649. @item X
  15650. @item Y
  15651. The coordinates of the current sample.
  15652. @item W
  15653. @item H
  15654. The width and height of the image.
  15655. @item P
  15656. Progress of transition effect.
  15657. @item PLANE
  15658. Currently processed plane.
  15659. @item A
  15660. Return value of first input at current location and plane.
  15661. @item B
  15662. Return value of second input at current location and plane.
  15663. @item a0(x, y)
  15664. @item a1(x, y)
  15665. @item a2(x, y)
  15666. @item a3(x, y)
  15667. Return the value of the pixel at location (@var{x},@var{y}) of the
  15668. first/second/third/fourth component of first input.
  15669. @item b0(x, y)
  15670. @item b1(x, y)
  15671. @item b2(x, y)
  15672. @item b3(x, y)
  15673. Return the value of the pixel at location (@var{x},@var{y}) of the
  15674. first/second/third/fourth component of second input.
  15675. @end table
  15676. @end table
  15677. @subsection Examples
  15678. @itemize
  15679. @item
  15680. Cross fade from one input video to another input video, with fade transition and duration of transition
  15681. of 2 seconds starting at offset of 5 seconds:
  15682. @example
  15683. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  15684. @end example
  15685. @end itemize
  15686. @section xmedian
  15687. Pick median pixels from several input videos.
  15688. The filter accepts the following options:
  15689. @table @option
  15690. @item inputs
  15691. Set number of inputs.
  15692. Default is 3. Allowed range is from 3 to 255.
  15693. If number of inputs is even number, than result will be mean value between two median values.
  15694. @item planes
  15695. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  15696. @item percentile
  15697. Set median percentile. Default value is @code{0.5}.
  15698. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  15699. minimum values, and @code{1} maximum values.
  15700. @end table
  15701. @section xstack
  15702. Stack video inputs into custom layout.
  15703. All streams must be of same pixel format.
  15704. The filter accepts the following options:
  15705. @table @option
  15706. @item inputs
  15707. Set number of input streams. Default is 2.
  15708. @item layout
  15709. Specify layout of inputs.
  15710. This option requires the desired layout configuration to be explicitly set by the user.
  15711. This sets position of each video input in output. Each input
  15712. is separated by '|'.
  15713. The first number represents the column, and the second number represents the row.
  15714. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  15715. where X is video input from which to take width or height.
  15716. Multiple values can be used when separated by '+'. In such
  15717. case values are summed together.
  15718. Note that if inputs are of different sizes gaps may appear, as not all of
  15719. the output video frame will be filled. Similarly, videos can overlap each
  15720. other if their position doesn't leave enough space for the full frame of
  15721. adjoining videos.
  15722. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  15723. a layout must be set by the user.
  15724. @item shortest
  15725. If set to 1, force the output to terminate when the shortest input
  15726. terminates. Default value is 0.
  15727. @item fill
  15728. If set to valid color, all unused pixels will be filled with that color.
  15729. By default fill is set to none, so it is disabled.
  15730. @end table
  15731. @subsection Examples
  15732. @itemize
  15733. @item
  15734. Display 4 inputs into 2x2 grid.
  15735. Layout:
  15736. @example
  15737. input1(0, 0) | input3(w0, 0)
  15738. input2(0, h0) | input4(w0, h0)
  15739. @end example
  15740. @example
  15741. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  15742. @end example
  15743. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15744. @item
  15745. Display 4 inputs into 1x4 grid.
  15746. Layout:
  15747. @example
  15748. input1(0, 0)
  15749. input2(0, h0)
  15750. input3(0, h0+h1)
  15751. input4(0, h0+h1+h2)
  15752. @end example
  15753. @example
  15754. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  15755. @end example
  15756. Note that if inputs are of different widths, unused space will appear.
  15757. @item
  15758. Display 9 inputs into 3x3 grid.
  15759. Layout:
  15760. @example
  15761. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  15762. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  15763. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  15764. @end example
  15765. @example
  15766. 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
  15767. @end example
  15768. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15769. @item
  15770. Display 16 inputs into 4x4 grid.
  15771. Layout:
  15772. @example
  15773. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  15774. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  15775. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  15776. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  15777. @end example
  15778. @example
  15779. 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|
  15780. 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
  15781. @end example
  15782. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15783. @end itemize
  15784. @anchor{yadif}
  15785. @section yadif
  15786. Deinterlace the input video ("yadif" means "yet another deinterlacing
  15787. filter").
  15788. It accepts the following parameters:
  15789. @table @option
  15790. @item mode
  15791. The interlacing mode to adopt. It accepts one of the following values:
  15792. @table @option
  15793. @item 0, send_frame
  15794. Output one frame for each frame.
  15795. @item 1, send_field
  15796. Output one frame for each field.
  15797. @item 2, send_frame_nospatial
  15798. Like @code{send_frame}, but it skips the spatial interlacing check.
  15799. @item 3, send_field_nospatial
  15800. Like @code{send_field}, but it skips the spatial interlacing check.
  15801. @end table
  15802. The default value is @code{send_frame}.
  15803. @item parity
  15804. The picture field parity assumed for the input interlaced video. It accepts one
  15805. of the following values:
  15806. @table @option
  15807. @item 0, tff
  15808. Assume the top field is first.
  15809. @item 1, bff
  15810. Assume the bottom field is first.
  15811. @item -1, auto
  15812. Enable automatic detection of field parity.
  15813. @end table
  15814. The default value is @code{auto}.
  15815. If the interlacing is unknown or the decoder does not export this information,
  15816. top field first will be assumed.
  15817. @item deint
  15818. Specify which frames to deinterlace. Accepts one of the following
  15819. values:
  15820. @table @option
  15821. @item 0, all
  15822. Deinterlace all frames.
  15823. @item 1, interlaced
  15824. Only deinterlace frames marked as interlaced.
  15825. @end table
  15826. The default value is @code{all}.
  15827. @end table
  15828. @section yadif_cuda
  15829. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  15830. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  15831. and/or nvenc.
  15832. It accepts the following parameters:
  15833. @table @option
  15834. @item mode
  15835. The interlacing mode to adopt. It accepts one of the following values:
  15836. @table @option
  15837. @item 0, send_frame
  15838. Output one frame for each frame.
  15839. @item 1, send_field
  15840. Output one frame for each field.
  15841. @item 2, send_frame_nospatial
  15842. Like @code{send_frame}, but it skips the spatial interlacing check.
  15843. @item 3, send_field_nospatial
  15844. Like @code{send_field}, but it skips the spatial interlacing check.
  15845. @end table
  15846. The default value is @code{send_frame}.
  15847. @item parity
  15848. The picture field parity assumed for the input interlaced video. It accepts one
  15849. of the following values:
  15850. @table @option
  15851. @item 0, tff
  15852. Assume the top field is first.
  15853. @item 1, bff
  15854. Assume the bottom field is first.
  15855. @item -1, auto
  15856. Enable automatic detection of field parity.
  15857. @end table
  15858. The default value is @code{auto}.
  15859. If the interlacing is unknown or the decoder does not export this information,
  15860. top field first will be assumed.
  15861. @item deint
  15862. Specify which frames to deinterlace. Accepts one of the following
  15863. values:
  15864. @table @option
  15865. @item 0, all
  15866. Deinterlace all frames.
  15867. @item 1, interlaced
  15868. Only deinterlace frames marked as interlaced.
  15869. @end table
  15870. The default value is @code{all}.
  15871. @end table
  15872. @section yaepblur
  15873. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  15874. The algorithm is described in
  15875. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  15876. It accepts the following parameters:
  15877. @table @option
  15878. @item radius, r
  15879. Set the window radius. Default value is 3.
  15880. @item planes, p
  15881. Set which planes to filter. Default is only the first plane.
  15882. @item sigma, s
  15883. Set blur strength. Default value is 128.
  15884. @end table
  15885. @subsection Commands
  15886. This filter supports same @ref{commands} as options.
  15887. @section zoompan
  15888. Apply Zoom & Pan effect.
  15889. This filter accepts the following options:
  15890. @table @option
  15891. @item zoom, z
  15892. Set the zoom expression. Range is 1-10. Default is 1.
  15893. @item x
  15894. @item y
  15895. Set the x and y expression. Default is 0.
  15896. @item d
  15897. Set the duration expression in number of frames.
  15898. This sets for how many number of frames effect will last for
  15899. single input image.
  15900. @item s
  15901. Set the output image size, default is 'hd720'.
  15902. @item fps
  15903. Set the output frame rate, default is '25'.
  15904. @end table
  15905. Each expression can contain the following constants:
  15906. @table @option
  15907. @item in_w, iw
  15908. Input width.
  15909. @item in_h, ih
  15910. Input height.
  15911. @item out_w, ow
  15912. Output width.
  15913. @item out_h, oh
  15914. Output height.
  15915. @item in
  15916. Input frame count.
  15917. @item on
  15918. Output frame count.
  15919. @item in_time, it
  15920. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  15921. @item out_time, time, ot
  15922. The output timestamp expressed in seconds.
  15923. @item x
  15924. @item y
  15925. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  15926. for current input frame.
  15927. @item px
  15928. @item py
  15929. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  15930. not yet such frame (first input frame).
  15931. @item zoom
  15932. Last calculated zoom from 'z' expression for current input frame.
  15933. @item pzoom
  15934. Last calculated zoom of last output frame of previous input frame.
  15935. @item duration
  15936. Number of output frames for current input frame. Calculated from 'd' expression
  15937. for each input frame.
  15938. @item pduration
  15939. number of output frames created for previous input frame
  15940. @item a
  15941. Rational number: input width / input height
  15942. @item sar
  15943. sample aspect ratio
  15944. @item dar
  15945. display aspect ratio
  15946. @end table
  15947. @subsection Examples
  15948. @itemize
  15949. @item
  15950. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  15951. @example
  15952. 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
  15953. @end example
  15954. @item
  15955. Zoom in up to 1.5x and pan always at center of picture:
  15956. @example
  15957. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15958. @end example
  15959. @item
  15960. Same as above but without pausing:
  15961. @example
  15962. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15963. @end example
  15964. @item
  15965. Zoom in 2x into center of picture only for the first second of the input video:
  15966. @example
  15967. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15968. @end example
  15969. @end itemize
  15970. @anchor{zscale}
  15971. @section zscale
  15972. Scale (resize) the input video, using the z.lib library:
  15973. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  15974. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  15975. The zscale filter forces the output display aspect ratio to be the same
  15976. as the input, by changing the output sample aspect ratio.
  15977. If the input image format is different from the format requested by
  15978. the next filter, the zscale filter will convert the input to the
  15979. requested format.
  15980. @subsection Options
  15981. The filter accepts the following options.
  15982. @table @option
  15983. @item width, w
  15984. @item height, h
  15985. Set the output video dimension expression. Default value is the input
  15986. dimension.
  15987. If the @var{width} or @var{w} value is 0, the input width is used for
  15988. the output. If the @var{height} or @var{h} value is 0, the input height
  15989. is used for the output.
  15990. If one and only one of the values is -n with n >= 1, the zscale filter
  15991. will use a value that maintains the aspect ratio of the input image,
  15992. calculated from the other specified dimension. After that it will,
  15993. however, make sure that the calculated dimension is divisible by n and
  15994. adjust the value if necessary.
  15995. If both values are -n with n >= 1, the behavior will be identical to
  15996. both values being set to 0 as previously detailed.
  15997. See below for the list of accepted constants for use in the dimension
  15998. expression.
  15999. @item size, s
  16000. Set the video size. For the syntax of this option, check the
  16001. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16002. @item dither, d
  16003. Set the dither type.
  16004. Possible values are:
  16005. @table @var
  16006. @item none
  16007. @item ordered
  16008. @item random
  16009. @item error_diffusion
  16010. @end table
  16011. Default is none.
  16012. @item filter, f
  16013. Set the resize filter type.
  16014. Possible values are:
  16015. @table @var
  16016. @item point
  16017. @item bilinear
  16018. @item bicubic
  16019. @item spline16
  16020. @item spline36
  16021. @item lanczos
  16022. @end table
  16023. Default is bilinear.
  16024. @item range, r
  16025. Set the color range.
  16026. Possible values are:
  16027. @table @var
  16028. @item input
  16029. @item limited
  16030. @item full
  16031. @end table
  16032. Default is same as input.
  16033. @item primaries, p
  16034. Set the color primaries.
  16035. Possible values are:
  16036. @table @var
  16037. @item input
  16038. @item 709
  16039. @item unspecified
  16040. @item 170m
  16041. @item 240m
  16042. @item 2020
  16043. @end table
  16044. Default is same as input.
  16045. @item transfer, t
  16046. Set the transfer characteristics.
  16047. Possible values are:
  16048. @table @var
  16049. @item input
  16050. @item 709
  16051. @item unspecified
  16052. @item 601
  16053. @item linear
  16054. @item 2020_10
  16055. @item 2020_12
  16056. @item smpte2084
  16057. @item iec61966-2-1
  16058. @item arib-std-b67
  16059. @end table
  16060. Default is same as input.
  16061. @item matrix, m
  16062. Set the colorspace matrix.
  16063. Possible value are:
  16064. @table @var
  16065. @item input
  16066. @item 709
  16067. @item unspecified
  16068. @item 470bg
  16069. @item 170m
  16070. @item 2020_ncl
  16071. @item 2020_cl
  16072. @end table
  16073. Default is same as input.
  16074. @item rangein, rin
  16075. Set the input color range.
  16076. Possible values are:
  16077. @table @var
  16078. @item input
  16079. @item limited
  16080. @item full
  16081. @end table
  16082. Default is same as input.
  16083. @item primariesin, pin
  16084. Set the input color primaries.
  16085. Possible values are:
  16086. @table @var
  16087. @item input
  16088. @item 709
  16089. @item unspecified
  16090. @item 170m
  16091. @item 240m
  16092. @item 2020
  16093. @end table
  16094. Default is same as input.
  16095. @item transferin, tin
  16096. Set the input transfer characteristics.
  16097. Possible values are:
  16098. @table @var
  16099. @item input
  16100. @item 709
  16101. @item unspecified
  16102. @item 601
  16103. @item linear
  16104. @item 2020_10
  16105. @item 2020_12
  16106. @end table
  16107. Default is same as input.
  16108. @item matrixin, min
  16109. Set the input colorspace matrix.
  16110. Possible value are:
  16111. @table @var
  16112. @item input
  16113. @item 709
  16114. @item unspecified
  16115. @item 470bg
  16116. @item 170m
  16117. @item 2020_ncl
  16118. @item 2020_cl
  16119. @end table
  16120. @item chromal, c
  16121. Set the output chroma location.
  16122. Possible values are:
  16123. @table @var
  16124. @item input
  16125. @item left
  16126. @item center
  16127. @item topleft
  16128. @item top
  16129. @item bottomleft
  16130. @item bottom
  16131. @end table
  16132. @item chromalin, cin
  16133. Set the input chroma location.
  16134. Possible values are:
  16135. @table @var
  16136. @item input
  16137. @item left
  16138. @item center
  16139. @item topleft
  16140. @item top
  16141. @item bottomleft
  16142. @item bottom
  16143. @end table
  16144. @item npl
  16145. Set the nominal peak luminance.
  16146. @end table
  16147. The values of the @option{w} and @option{h} options are expressions
  16148. containing the following constants:
  16149. @table @var
  16150. @item in_w
  16151. @item in_h
  16152. The input width and height
  16153. @item iw
  16154. @item ih
  16155. These are the same as @var{in_w} and @var{in_h}.
  16156. @item out_w
  16157. @item out_h
  16158. The output (scaled) width and height
  16159. @item ow
  16160. @item oh
  16161. These are the same as @var{out_w} and @var{out_h}
  16162. @item a
  16163. The same as @var{iw} / @var{ih}
  16164. @item sar
  16165. input sample aspect ratio
  16166. @item dar
  16167. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16168. @item hsub
  16169. @item vsub
  16170. horizontal and vertical input chroma subsample values. For example for the
  16171. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16172. @item ohsub
  16173. @item ovsub
  16174. horizontal and vertical output chroma subsample values. For example for the
  16175. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16176. @end table
  16177. @subsection Commands
  16178. This filter supports the following commands:
  16179. @table @option
  16180. @item width, w
  16181. @item height, h
  16182. Set the output video dimension expression.
  16183. The command accepts the same syntax of the corresponding option.
  16184. If the specified expression is not valid, it is kept at its current
  16185. value.
  16186. @end table
  16187. @c man end VIDEO FILTERS
  16188. @chapter OpenCL Video Filters
  16189. @c man begin OPENCL VIDEO FILTERS
  16190. Below is a description of the currently available OpenCL video filters.
  16191. To enable compilation of these filters you need to configure FFmpeg with
  16192. @code{--enable-opencl}.
  16193. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  16194. @table @option
  16195. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  16196. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  16197. given device parameters.
  16198. @item -filter_hw_device @var{name}
  16199. Pass the hardware device called @var{name} to all filters in any filter graph.
  16200. @end table
  16201. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  16202. @itemize
  16203. @item
  16204. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  16205. @example
  16206. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  16207. @end example
  16208. @end itemize
  16209. 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.
  16210. @section avgblur_opencl
  16211. Apply average blur filter.
  16212. The filter accepts the following options:
  16213. @table @option
  16214. @item sizeX
  16215. Set horizontal radius size.
  16216. Range is @code{[1, 1024]} and default value is @code{1}.
  16217. @item planes
  16218. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16219. @item sizeY
  16220. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  16221. @end table
  16222. @subsection Example
  16223. @itemize
  16224. @item
  16225. 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.
  16226. @example
  16227. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  16228. @end example
  16229. @end itemize
  16230. @section boxblur_opencl
  16231. Apply a boxblur algorithm to the input video.
  16232. It accepts the following parameters:
  16233. @table @option
  16234. @item luma_radius, lr
  16235. @item luma_power, lp
  16236. @item chroma_radius, cr
  16237. @item chroma_power, cp
  16238. @item alpha_radius, ar
  16239. @item alpha_power, ap
  16240. @end table
  16241. A description of the accepted options follows.
  16242. @table @option
  16243. @item luma_radius, lr
  16244. @item chroma_radius, cr
  16245. @item alpha_radius, ar
  16246. Set an expression for the box radius in pixels used for blurring the
  16247. corresponding input plane.
  16248. The radius value must be a non-negative number, and must not be
  16249. greater than the value of the expression @code{min(w,h)/2} for the
  16250. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  16251. planes.
  16252. Default value for @option{luma_radius} is "2". If not specified,
  16253. @option{chroma_radius} and @option{alpha_radius} default to the
  16254. corresponding value set for @option{luma_radius}.
  16255. The expressions can contain the following constants:
  16256. @table @option
  16257. @item w
  16258. @item h
  16259. The input width and height in pixels.
  16260. @item cw
  16261. @item ch
  16262. The input chroma image width and height in pixels.
  16263. @item hsub
  16264. @item vsub
  16265. The horizontal and vertical chroma subsample values. For example, for the
  16266. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  16267. @end table
  16268. @item luma_power, lp
  16269. @item chroma_power, cp
  16270. @item alpha_power, ap
  16271. Specify how many times the boxblur filter is applied to the
  16272. corresponding plane.
  16273. Default value for @option{luma_power} is 2. If not specified,
  16274. @option{chroma_power} and @option{alpha_power} default to the
  16275. corresponding value set for @option{luma_power}.
  16276. A value of 0 will disable the effect.
  16277. @end table
  16278. @subsection Examples
  16279. 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.
  16280. @itemize
  16281. @item
  16282. Apply a boxblur filter with the luma, chroma, and alpha radius
  16283. 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.
  16284. @example
  16285. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  16286. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  16287. @end example
  16288. @item
  16289. 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.
  16290. For the luma plane, a 2x2 box radius will be run once.
  16291. For the chroma plane, a 4x4 box radius will be run 5 times.
  16292. For the alpha plane, a 3x3 box radius will be run 7 times.
  16293. @example
  16294. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  16295. @end example
  16296. @end itemize
  16297. @section colorkey_opencl
  16298. RGB colorspace color keying.
  16299. The filter accepts the following options:
  16300. @table @option
  16301. @item color
  16302. The color which will be replaced with transparency.
  16303. @item similarity
  16304. Similarity percentage with the key color.
  16305. 0.01 matches only the exact key color, while 1.0 matches everything.
  16306. @item blend
  16307. Blend percentage.
  16308. 0.0 makes pixels either fully transparent, or not transparent at all.
  16309. Higher values result in semi-transparent pixels, with a higher transparency
  16310. the more similar the pixels color is to the key color.
  16311. @end table
  16312. @subsection Examples
  16313. @itemize
  16314. @item
  16315. Make every semi-green pixel in the input transparent with some slight blending:
  16316. @example
  16317. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  16318. @end example
  16319. @end itemize
  16320. @section convolution_opencl
  16321. Apply convolution of 3x3, 5x5, 7x7 matrix.
  16322. The filter accepts the following options:
  16323. @table @option
  16324. @item 0m
  16325. @item 1m
  16326. @item 2m
  16327. @item 3m
  16328. Set matrix for each plane.
  16329. Matrix is sequence of 9, 25 or 49 signed numbers.
  16330. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  16331. @item 0rdiv
  16332. @item 1rdiv
  16333. @item 2rdiv
  16334. @item 3rdiv
  16335. Set multiplier for calculated value for each plane.
  16336. If unset or 0, it will be sum of all matrix elements.
  16337. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  16338. @item 0bias
  16339. @item 1bias
  16340. @item 2bias
  16341. @item 3bias
  16342. Set bias for each plane. This value is added to the result of the multiplication.
  16343. Useful for making the overall image brighter or darker.
  16344. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  16345. @end table
  16346. @subsection Examples
  16347. @itemize
  16348. @item
  16349. Apply sharpen:
  16350. @example
  16351. -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
  16352. @end example
  16353. @item
  16354. Apply blur:
  16355. @example
  16356. -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
  16357. @end example
  16358. @item
  16359. Apply edge enhance:
  16360. @example
  16361. -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
  16362. @end example
  16363. @item
  16364. Apply edge detect:
  16365. @example
  16366. -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
  16367. @end example
  16368. @item
  16369. Apply laplacian edge detector which includes diagonals:
  16370. @example
  16371. -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
  16372. @end example
  16373. @item
  16374. Apply emboss:
  16375. @example
  16376. -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
  16377. @end example
  16378. @end itemize
  16379. @section erosion_opencl
  16380. Apply erosion effect to the video.
  16381. This filter replaces the pixel by the local(3x3) minimum.
  16382. It accepts the following options:
  16383. @table @option
  16384. @item threshold0
  16385. @item threshold1
  16386. @item threshold2
  16387. @item threshold3
  16388. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16389. If @code{0}, plane will remain unchanged.
  16390. @item coordinates
  16391. Flag which specifies the pixel to refer to.
  16392. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16393. Flags to local 3x3 coordinates region centered on @code{x}:
  16394. 1 2 3
  16395. 4 x 5
  16396. 6 7 8
  16397. @end table
  16398. @subsection Example
  16399. @itemize
  16400. @item
  16401. 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.
  16402. @example
  16403. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16404. @end example
  16405. @end itemize
  16406. @section deshake_opencl
  16407. Feature-point based video stabilization filter.
  16408. The filter accepts the following options:
  16409. @table @option
  16410. @item tripod
  16411. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  16412. @item debug
  16413. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  16414. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  16415. Viewing point matches in the output video is only supported for RGB input.
  16416. Defaults to @code{0}.
  16417. @item adaptive_crop
  16418. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  16419. Defaults to @code{1}.
  16420. @item refine_features
  16421. Whether or not feature points should be refined at a sub-pixel level.
  16422. This can be turned off for a slight performance gain at the cost of precision.
  16423. Defaults to @code{1}.
  16424. @item smooth_strength
  16425. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  16426. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  16427. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  16428. Defaults to @code{0.0}.
  16429. @item smooth_window_multiplier
  16430. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  16431. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  16432. Acceptable values range from @code{0.1} to @code{10.0}.
  16433. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  16434. potentially improving smoothness, but also increase latency and memory usage.
  16435. Defaults to @code{2.0}.
  16436. @end table
  16437. @subsection Examples
  16438. @itemize
  16439. @item
  16440. Stabilize a video with a fixed, medium smoothing strength:
  16441. @example
  16442. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  16443. @end example
  16444. @item
  16445. Stabilize a video with debugging (both in console and in rendered video):
  16446. @example
  16447. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  16448. @end example
  16449. @end itemize
  16450. @section dilation_opencl
  16451. Apply dilation effect to the video.
  16452. This filter replaces the pixel by the local(3x3) maximum.
  16453. It accepts the following options:
  16454. @table @option
  16455. @item threshold0
  16456. @item threshold1
  16457. @item threshold2
  16458. @item threshold3
  16459. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16460. If @code{0}, plane will remain unchanged.
  16461. @item coordinates
  16462. Flag which specifies the pixel to refer to.
  16463. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16464. Flags to local 3x3 coordinates region centered on @code{x}:
  16465. 1 2 3
  16466. 4 x 5
  16467. 6 7 8
  16468. @end table
  16469. @subsection Example
  16470. @itemize
  16471. @item
  16472. 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.
  16473. @example
  16474. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16475. @end example
  16476. @end itemize
  16477. @section nlmeans_opencl
  16478. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  16479. @section overlay_opencl
  16480. Overlay one video on top of another.
  16481. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  16482. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  16483. The filter accepts the following options:
  16484. @table @option
  16485. @item x
  16486. Set the x coordinate of the overlaid video on the main video.
  16487. Default value is @code{0}.
  16488. @item y
  16489. Set the y coordinate of the overlaid video on the main video.
  16490. Default value is @code{0}.
  16491. @end table
  16492. @subsection Examples
  16493. @itemize
  16494. @item
  16495. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  16496. @example
  16497. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16498. @end example
  16499. @item
  16500. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  16501. @example
  16502. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16503. @end example
  16504. @end itemize
  16505. @section pad_opencl
  16506. Add paddings to the input image, and place the original input at the
  16507. provided @var{x}, @var{y} coordinates.
  16508. It accepts the following options:
  16509. @table @option
  16510. @item width, w
  16511. @item height, h
  16512. Specify an expression for the size of the output image with the
  16513. paddings added. If the value for @var{width} or @var{height} is 0, the
  16514. corresponding input size is used for the output.
  16515. The @var{width} expression can reference the value set by the
  16516. @var{height} expression, and vice versa.
  16517. The default value of @var{width} and @var{height} is 0.
  16518. @item x
  16519. @item y
  16520. Specify the offsets to place the input image at within the padded area,
  16521. with respect to the top/left border of the output image.
  16522. The @var{x} expression can reference the value set by the @var{y}
  16523. expression, and vice versa.
  16524. The default value of @var{x} and @var{y} is 0.
  16525. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  16526. so the input image is centered on the padded area.
  16527. @item color
  16528. Specify the color of the padded area. For the syntax of this option,
  16529. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  16530. manual,ffmpeg-utils}.
  16531. @item aspect
  16532. Pad to an aspect instead to a resolution.
  16533. @end table
  16534. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  16535. options are expressions containing the following constants:
  16536. @table @option
  16537. @item in_w
  16538. @item in_h
  16539. The input video width and height.
  16540. @item iw
  16541. @item ih
  16542. These are the same as @var{in_w} and @var{in_h}.
  16543. @item out_w
  16544. @item out_h
  16545. The output width and height (the size of the padded area), as
  16546. specified by the @var{width} and @var{height} expressions.
  16547. @item ow
  16548. @item oh
  16549. These are the same as @var{out_w} and @var{out_h}.
  16550. @item x
  16551. @item y
  16552. The x and y offsets as specified by the @var{x} and @var{y}
  16553. expressions, or NAN if not yet specified.
  16554. @item a
  16555. same as @var{iw} / @var{ih}
  16556. @item sar
  16557. input sample aspect ratio
  16558. @item dar
  16559. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  16560. @end table
  16561. @section prewitt_opencl
  16562. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  16563. The filter accepts the following option:
  16564. @table @option
  16565. @item planes
  16566. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16567. @item scale
  16568. Set value which will be multiplied with filtered result.
  16569. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16570. @item delta
  16571. Set value which will be added to filtered result.
  16572. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16573. @end table
  16574. @subsection Example
  16575. @itemize
  16576. @item
  16577. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  16578. @example
  16579. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16580. @end example
  16581. @end itemize
  16582. @anchor{program_opencl}
  16583. @section program_opencl
  16584. Filter video using an OpenCL program.
  16585. @table @option
  16586. @item source
  16587. OpenCL program source file.
  16588. @item kernel
  16589. Kernel name in program.
  16590. @item inputs
  16591. Number of inputs to the filter. Defaults to 1.
  16592. @item size, s
  16593. Size of output frames. Defaults to the same as the first input.
  16594. @end table
  16595. The @code{program_opencl} filter also supports the @ref{framesync} options.
  16596. The program source file must contain a kernel function with the given name,
  16597. which will be run once for each plane of the output. Each run on a plane
  16598. gets enqueued as a separate 2D global NDRange with one work-item for each
  16599. pixel to be generated. The global ID offset for each work-item is therefore
  16600. the coordinates of a pixel in the destination image.
  16601. The kernel function needs to take the following arguments:
  16602. @itemize
  16603. @item
  16604. Destination image, @var{__write_only image2d_t}.
  16605. This image will become the output; the kernel should write all of it.
  16606. @item
  16607. Frame index, @var{unsigned int}.
  16608. This is a counter starting from zero and increasing by one for each frame.
  16609. @item
  16610. Source images, @var{__read_only image2d_t}.
  16611. These are the most recent images on each input. The kernel may read from
  16612. them to generate the output, but they can't be written to.
  16613. @end itemize
  16614. Example programs:
  16615. @itemize
  16616. @item
  16617. Copy the input to the output (output must be the same size as the input).
  16618. @verbatim
  16619. __kernel void copy(__write_only image2d_t destination,
  16620. unsigned int index,
  16621. __read_only image2d_t source)
  16622. {
  16623. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  16624. int2 location = (int2)(get_global_id(0), get_global_id(1));
  16625. float4 value = read_imagef(source, sampler, location);
  16626. write_imagef(destination, location, value);
  16627. }
  16628. @end verbatim
  16629. @item
  16630. Apply a simple transformation, rotating the input by an amount increasing
  16631. with the index counter. Pixel values are linearly interpolated by the
  16632. sampler, and the output need not have the same dimensions as the input.
  16633. @verbatim
  16634. __kernel void rotate_image(__write_only image2d_t dst,
  16635. unsigned int index,
  16636. __read_only image2d_t src)
  16637. {
  16638. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16639. CLK_FILTER_LINEAR);
  16640. float angle = (float)index / 100.0f;
  16641. float2 dst_dim = convert_float2(get_image_dim(dst));
  16642. float2 src_dim = convert_float2(get_image_dim(src));
  16643. float2 dst_cen = dst_dim / 2.0f;
  16644. float2 src_cen = src_dim / 2.0f;
  16645. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16646. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  16647. float2 src_pos = {
  16648. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  16649. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  16650. };
  16651. src_pos = src_pos * src_dim / dst_dim;
  16652. float2 src_loc = src_pos + src_cen;
  16653. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  16654. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  16655. write_imagef(dst, dst_loc, 0.5f);
  16656. else
  16657. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  16658. }
  16659. @end verbatim
  16660. @item
  16661. Blend two inputs together, with the amount of each input used varying
  16662. with the index counter.
  16663. @verbatim
  16664. __kernel void blend_images(__write_only image2d_t dst,
  16665. unsigned int index,
  16666. __read_only image2d_t src1,
  16667. __read_only image2d_t src2)
  16668. {
  16669. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16670. CLK_FILTER_LINEAR);
  16671. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  16672. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16673. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  16674. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  16675. float4 val1 = read_imagef(src1, sampler, src1_loc);
  16676. float4 val2 = read_imagef(src2, sampler, src2_loc);
  16677. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  16678. }
  16679. @end verbatim
  16680. @end itemize
  16681. @section roberts_opencl
  16682. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  16683. The filter accepts the following option:
  16684. @table @option
  16685. @item planes
  16686. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16687. @item scale
  16688. Set value which will be multiplied with filtered result.
  16689. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16690. @item delta
  16691. Set value which will be added to filtered result.
  16692. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16693. @end table
  16694. @subsection Example
  16695. @itemize
  16696. @item
  16697. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  16698. @example
  16699. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16700. @end example
  16701. @end itemize
  16702. @section sobel_opencl
  16703. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  16704. The filter accepts the following option:
  16705. @table @option
  16706. @item planes
  16707. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16708. @item scale
  16709. Set value which will be multiplied with filtered result.
  16710. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16711. @item delta
  16712. Set value which will be added to filtered result.
  16713. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16714. @end table
  16715. @subsection Example
  16716. @itemize
  16717. @item
  16718. Apply sobel operator with scale set to 2 and delta set to 10
  16719. @example
  16720. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16721. @end example
  16722. @end itemize
  16723. @section tonemap_opencl
  16724. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  16725. It accepts the following parameters:
  16726. @table @option
  16727. @item tonemap
  16728. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  16729. @item param
  16730. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  16731. @item desat
  16732. Apply desaturation for highlights that exceed this level of brightness. The
  16733. higher the parameter, the more color information will be preserved. This
  16734. setting helps prevent unnaturally blown-out colors for super-highlights, by
  16735. (smoothly) turning into white instead. This makes images feel more natural,
  16736. at the cost of reducing information about out-of-range colors.
  16737. The default value is 0.5, and the algorithm here is a little different from
  16738. the cpu version tonemap currently. A setting of 0.0 disables this option.
  16739. @item threshold
  16740. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  16741. is used to detect whether the scene has changed or not. If the distance between
  16742. the current frame average brightness and the current running average exceeds
  16743. a threshold value, we would re-calculate scene average and peak brightness.
  16744. The default value is 0.2.
  16745. @item format
  16746. Specify the output pixel format.
  16747. Currently supported formats are:
  16748. @table @var
  16749. @item p010
  16750. @item nv12
  16751. @end table
  16752. @item range, r
  16753. Set the output color range.
  16754. Possible values are:
  16755. @table @var
  16756. @item tv/mpeg
  16757. @item pc/jpeg
  16758. @end table
  16759. Default is same as input.
  16760. @item primaries, p
  16761. Set the output color primaries.
  16762. Possible values are:
  16763. @table @var
  16764. @item bt709
  16765. @item bt2020
  16766. @end table
  16767. Default is same as input.
  16768. @item transfer, t
  16769. Set the output transfer characteristics.
  16770. Possible values are:
  16771. @table @var
  16772. @item bt709
  16773. @item bt2020
  16774. @end table
  16775. Default is bt709.
  16776. @item matrix, m
  16777. Set the output colorspace matrix.
  16778. Possible value are:
  16779. @table @var
  16780. @item bt709
  16781. @item bt2020
  16782. @end table
  16783. Default is same as input.
  16784. @end table
  16785. @subsection Example
  16786. @itemize
  16787. @item
  16788. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  16789. @example
  16790. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  16791. @end example
  16792. @end itemize
  16793. @section unsharp_opencl
  16794. Sharpen or blur the input video.
  16795. It accepts the following parameters:
  16796. @table @option
  16797. @item luma_msize_x, lx
  16798. Set the luma matrix horizontal size.
  16799. Range is @code{[1, 23]} and default value is @code{5}.
  16800. @item luma_msize_y, ly
  16801. Set the luma matrix vertical size.
  16802. Range is @code{[1, 23]} and default value is @code{5}.
  16803. @item luma_amount, la
  16804. Set the luma effect strength.
  16805. Range is @code{[-10, 10]} and default value is @code{1.0}.
  16806. Negative values will blur the input video, while positive values will
  16807. sharpen it, a value of zero will disable the effect.
  16808. @item chroma_msize_x, cx
  16809. Set the chroma matrix horizontal size.
  16810. Range is @code{[1, 23]} and default value is @code{5}.
  16811. @item chroma_msize_y, cy
  16812. Set the chroma matrix vertical size.
  16813. Range is @code{[1, 23]} and default value is @code{5}.
  16814. @item chroma_amount, ca
  16815. Set the chroma effect strength.
  16816. Range is @code{[-10, 10]} and default value is @code{0.0}.
  16817. Negative values will blur the input video, while positive values will
  16818. sharpen it, a value of zero will disable the effect.
  16819. @end table
  16820. All parameters are optional and default to the equivalent of the
  16821. string '5:5:1.0:5:5:0.0'.
  16822. @subsection Examples
  16823. @itemize
  16824. @item
  16825. Apply strong luma sharpen effect:
  16826. @example
  16827. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  16828. @end example
  16829. @item
  16830. Apply a strong blur of both luma and chroma parameters:
  16831. @example
  16832. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  16833. @end example
  16834. @end itemize
  16835. @section xfade_opencl
  16836. Cross fade two videos with custom transition effect by using OpenCL.
  16837. It accepts the following options:
  16838. @table @option
  16839. @item transition
  16840. Set one of possible transition effects.
  16841. @table @option
  16842. @item custom
  16843. Select custom transition effect, the actual transition description
  16844. will be picked from source and kernel options.
  16845. @item fade
  16846. @item wipeleft
  16847. @item wiperight
  16848. @item wipeup
  16849. @item wipedown
  16850. @item slideleft
  16851. @item slideright
  16852. @item slideup
  16853. @item slidedown
  16854. Default transition is fade.
  16855. @end table
  16856. @item source
  16857. OpenCL program source file for custom transition.
  16858. @item kernel
  16859. Set name of kernel to use for custom transition from program source file.
  16860. @item duration
  16861. Set duration of video transition.
  16862. @item offset
  16863. Set time of start of transition relative to first video.
  16864. @end table
  16865. The program source file must contain a kernel function with the given name,
  16866. which will be run once for each plane of the output. Each run on a plane
  16867. gets enqueued as a separate 2D global NDRange with one work-item for each
  16868. pixel to be generated. The global ID offset for each work-item is therefore
  16869. the coordinates of a pixel in the destination image.
  16870. The kernel function needs to take the following arguments:
  16871. @itemize
  16872. @item
  16873. Destination image, @var{__write_only image2d_t}.
  16874. This image will become the output; the kernel should write all of it.
  16875. @item
  16876. First Source image, @var{__read_only image2d_t}.
  16877. Second Source image, @var{__read_only image2d_t}.
  16878. These are the most recent images on each input. The kernel may read from
  16879. them to generate the output, but they can't be written to.
  16880. @item
  16881. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  16882. @end itemize
  16883. Example programs:
  16884. @itemize
  16885. @item
  16886. Apply dots curtain transition effect:
  16887. @verbatim
  16888. __kernel void blend_images(__write_only image2d_t dst,
  16889. __read_only image2d_t src1,
  16890. __read_only image2d_t src2,
  16891. float progress)
  16892. {
  16893. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16894. CLK_FILTER_LINEAR);
  16895. int2 p = (int2)(get_global_id(0), get_global_id(1));
  16896. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  16897. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  16898. rp = rp / dim;
  16899. float2 dots = (float2)(20.0, 20.0);
  16900. float2 center = (float2)(0,0);
  16901. float2 unused;
  16902. float4 val1 = read_imagef(src1, sampler, p);
  16903. float4 val2 = read_imagef(src2, sampler, p);
  16904. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  16905. write_imagef(dst, p, next ? val1 : val2);
  16906. }
  16907. @end verbatim
  16908. @end itemize
  16909. @c man end OPENCL VIDEO FILTERS
  16910. @chapter VAAPI Video Filters
  16911. @c man begin VAAPI VIDEO FILTERS
  16912. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  16913. To enable compilation of these filters you need to configure FFmpeg with
  16914. @code{--enable-vaapi}.
  16915. To use vaapi filters, you need to setup the vaapi device correctly. For more information, please read @url{https://trac.ffmpeg.org/wiki/Hardware/VAAPI}
  16916. @section tonemap_vaapi
  16917. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  16918. It maps the dynamic range of HDR10 content to the SDR content.
  16919. It currently only accepts HDR10 as input.
  16920. It accepts the following parameters:
  16921. @table @option
  16922. @item format
  16923. Specify the output pixel format.
  16924. Currently supported formats are:
  16925. @table @var
  16926. @item p010
  16927. @item nv12
  16928. @end table
  16929. Default is nv12.
  16930. @item primaries, p
  16931. Set the output color primaries.
  16932. Default is same as input.
  16933. @item transfer, t
  16934. Set the output transfer characteristics.
  16935. Default is bt709.
  16936. @item matrix, m
  16937. Set the output colorspace matrix.
  16938. Default is same as input.
  16939. @end table
  16940. @subsection Example
  16941. @itemize
  16942. @item
  16943. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  16944. @example
  16945. tonemap_vaapi=format=p010:t=bt2020-10
  16946. @end example
  16947. @end itemize
  16948. @c man end VAAPI VIDEO FILTERS
  16949. @chapter Video Sources
  16950. @c man begin VIDEO SOURCES
  16951. Below is a description of the currently available video sources.
  16952. @section buffer
  16953. Buffer video frames, and make them available to the filter chain.
  16954. This source is mainly intended for a programmatic use, in particular
  16955. through the interface defined in @file{libavfilter/buffersrc.h}.
  16956. It accepts the following parameters:
  16957. @table @option
  16958. @item video_size
  16959. Specify the size (width and height) of the buffered video frames. For the
  16960. syntax of this option, check the
  16961. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16962. @item width
  16963. The input video width.
  16964. @item height
  16965. The input video height.
  16966. @item pix_fmt
  16967. A string representing the pixel format of the buffered video frames.
  16968. It may be a number corresponding to a pixel format, or a pixel format
  16969. name.
  16970. @item time_base
  16971. Specify the timebase assumed by the timestamps of the buffered frames.
  16972. @item frame_rate
  16973. Specify the frame rate expected for the video stream.
  16974. @item pixel_aspect, sar
  16975. The sample (pixel) aspect ratio of the input video.
  16976. @item sws_param
  16977. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  16978. to the filtergraph description to specify swscale flags for automatically
  16979. inserted scalers. See @ref{Filtergraph syntax}.
  16980. @item hw_frames_ctx
  16981. When using a hardware pixel format, this should be a reference to an
  16982. AVHWFramesContext describing input frames.
  16983. @end table
  16984. For example:
  16985. @example
  16986. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  16987. @end example
  16988. will instruct the source to accept video frames with size 320x240 and
  16989. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  16990. square pixels (1:1 sample aspect ratio).
  16991. Since the pixel format with name "yuv410p" corresponds to the number 6
  16992. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  16993. this example corresponds to:
  16994. @example
  16995. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  16996. @end example
  16997. Alternatively, the options can be specified as a flat string, but this
  16998. syntax is deprecated:
  16999. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  17000. @section cellauto
  17001. Create a pattern generated by an elementary cellular automaton.
  17002. The initial state of the cellular automaton can be defined through the
  17003. @option{filename} and @option{pattern} options. If such options are
  17004. not specified an initial state is created randomly.
  17005. At each new frame a new row in the video is filled with the result of
  17006. the cellular automaton next generation. The behavior when the whole
  17007. frame is filled is defined by the @option{scroll} option.
  17008. This source accepts the following options:
  17009. @table @option
  17010. @item filename, f
  17011. Read the initial cellular automaton state, i.e. the starting row, from
  17012. the specified file.
  17013. In the file, each non-whitespace character is considered an alive
  17014. cell, a newline will terminate the row, and further characters in the
  17015. file will be ignored.
  17016. @item pattern, p
  17017. Read the initial cellular automaton state, i.e. the starting row, from
  17018. the specified string.
  17019. Each non-whitespace character in the string is considered an alive
  17020. cell, a newline will terminate the row, and further characters in the
  17021. string will be ignored.
  17022. @item rate, r
  17023. Set the video rate, that is the number of frames generated per second.
  17024. Default is 25.
  17025. @item random_fill_ratio, ratio
  17026. Set the random fill ratio for the initial cellular automaton row. It
  17027. is a floating point number value ranging from 0 to 1, defaults to
  17028. 1/PHI.
  17029. This option is ignored when a file or a pattern is specified.
  17030. @item random_seed, seed
  17031. Set the seed for filling randomly the initial row, must be an integer
  17032. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17033. set to -1, the filter will try to use a good random seed on a best
  17034. effort basis.
  17035. @item rule
  17036. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  17037. Default value is 110.
  17038. @item size, s
  17039. Set the size of the output video. For the syntax of this option, check the
  17040. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17041. If @option{filename} or @option{pattern} is specified, the size is set
  17042. by default to the width of the specified initial state row, and the
  17043. height is set to @var{width} * PHI.
  17044. If @option{size} is set, it must contain the width of the specified
  17045. pattern string, and the specified pattern will be centered in the
  17046. larger row.
  17047. If a filename or a pattern string is not specified, the size value
  17048. defaults to "320x518" (used for a randomly generated initial state).
  17049. @item scroll
  17050. If set to 1, scroll the output upward when all the rows in the output
  17051. have been already filled. If set to 0, the new generated row will be
  17052. written over the top row just after the bottom row is filled.
  17053. Defaults to 1.
  17054. @item start_full, full
  17055. If set to 1, completely fill the output with generated rows before
  17056. outputting the first frame.
  17057. This is the default behavior, for disabling set the value to 0.
  17058. @item stitch
  17059. If set to 1, stitch the left and right row edges together.
  17060. This is the default behavior, for disabling set the value to 0.
  17061. @end table
  17062. @subsection Examples
  17063. @itemize
  17064. @item
  17065. Read the initial state from @file{pattern}, and specify an output of
  17066. size 200x400.
  17067. @example
  17068. cellauto=f=pattern:s=200x400
  17069. @end example
  17070. @item
  17071. Generate a random initial row with a width of 200 cells, with a fill
  17072. ratio of 2/3:
  17073. @example
  17074. cellauto=ratio=2/3:s=200x200
  17075. @end example
  17076. @item
  17077. Create a pattern generated by rule 18 starting by a single alive cell
  17078. centered on an initial row with width 100:
  17079. @example
  17080. cellauto=p=@@:s=100x400:full=0:rule=18
  17081. @end example
  17082. @item
  17083. Specify a more elaborated initial pattern:
  17084. @example
  17085. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  17086. @end example
  17087. @end itemize
  17088. @anchor{coreimagesrc}
  17089. @section coreimagesrc
  17090. Video source generated on GPU using Apple's CoreImage API on OSX.
  17091. This video source is a specialized version of the @ref{coreimage} video filter.
  17092. Use a core image generator at the beginning of the applied filterchain to
  17093. generate the content.
  17094. The coreimagesrc video source accepts the following options:
  17095. @table @option
  17096. @item list_generators
  17097. List all available generators along with all their respective options as well as
  17098. possible minimum and maximum values along with the default values.
  17099. @example
  17100. list_generators=true
  17101. @end example
  17102. @item size, s
  17103. Specify the size of the sourced video. For the syntax of this option, check the
  17104. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17105. The default value is @code{320x240}.
  17106. @item rate, r
  17107. Specify the frame rate of the sourced video, as the number of frames
  17108. generated per second. It has to be a string in the format
  17109. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17110. number or a valid video frame rate abbreviation. The default value is
  17111. "25".
  17112. @item sar
  17113. Set the sample aspect ratio of the sourced video.
  17114. @item duration, d
  17115. Set the duration of the sourced video. See
  17116. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17117. for the accepted syntax.
  17118. If not specified, or the expressed duration is negative, the video is
  17119. supposed to be generated forever.
  17120. @end table
  17121. Additionally, all options of the @ref{coreimage} video filter are accepted.
  17122. A complete filterchain can be used for further processing of the
  17123. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  17124. and examples for details.
  17125. @subsection Examples
  17126. @itemize
  17127. @item
  17128. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  17129. given as complete and escaped command-line for Apple's standard bash shell:
  17130. @example
  17131. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  17132. @end example
  17133. This example is equivalent to the QRCode example of @ref{coreimage} without the
  17134. need for a nullsrc video source.
  17135. @end itemize
  17136. @section gradients
  17137. Generate several gradients.
  17138. @table @option
  17139. @item size, s
  17140. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17141. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17142. @item rate, r
  17143. Set frame rate, expressed as number of frames per second. Default
  17144. value is "25".
  17145. @item c0, c1, c2, c3, c4, c5, c6, c7
  17146. Set 8 colors. Default values for colors is to pick random one.
  17147. @item x0, y0, y0, y1
  17148. Set gradient line source and destination points. If negative or out of range, random ones
  17149. are picked.
  17150. @item nb_colors, n
  17151. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  17152. @item seed
  17153. Set seed for picking gradient line points.
  17154. @item duration, d
  17155. Set the duration of the sourced video. See
  17156. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17157. for the accepted syntax.
  17158. If not specified, or the expressed duration is negative, the video is
  17159. supposed to be generated forever.
  17160. @item speed
  17161. Set speed of gradients rotation.
  17162. @end table
  17163. @section mandelbrot
  17164. Generate a Mandelbrot set fractal, and progressively zoom towards the
  17165. point specified with @var{start_x} and @var{start_y}.
  17166. This source accepts the following options:
  17167. @table @option
  17168. @item end_pts
  17169. Set the terminal pts value. Default value is 400.
  17170. @item end_scale
  17171. Set the terminal scale value.
  17172. Must be a floating point value. Default value is 0.3.
  17173. @item inner
  17174. Set the inner coloring mode, that is the algorithm used to draw the
  17175. Mandelbrot fractal internal region.
  17176. It shall assume one of the following values:
  17177. @table @option
  17178. @item black
  17179. Set black mode.
  17180. @item convergence
  17181. Show time until convergence.
  17182. @item mincol
  17183. Set color based on point closest to the origin of the iterations.
  17184. @item period
  17185. Set period mode.
  17186. @end table
  17187. Default value is @var{mincol}.
  17188. @item bailout
  17189. Set the bailout value. Default value is 10.0.
  17190. @item maxiter
  17191. Set the maximum of iterations performed by the rendering
  17192. algorithm. Default value is 7189.
  17193. @item outer
  17194. Set outer coloring mode.
  17195. It shall assume one of following values:
  17196. @table @option
  17197. @item iteration_count
  17198. Set iteration count mode.
  17199. @item normalized_iteration_count
  17200. set normalized iteration count mode.
  17201. @end table
  17202. Default value is @var{normalized_iteration_count}.
  17203. @item rate, r
  17204. Set frame rate, expressed as number of frames per second. Default
  17205. value is "25".
  17206. @item size, s
  17207. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17208. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17209. @item start_scale
  17210. Set the initial scale value. Default value is 3.0.
  17211. @item start_x
  17212. Set the initial x position. Must be a floating point value between
  17213. -100 and 100. Default value is -0.743643887037158704752191506114774.
  17214. @item start_y
  17215. Set the initial y position. Must be a floating point value between
  17216. -100 and 100. Default value is -0.131825904205311970493132056385139.
  17217. @end table
  17218. @section mptestsrc
  17219. Generate various test patterns, as generated by the MPlayer test filter.
  17220. The size of the generated video is fixed, and is 256x256.
  17221. This source is useful in particular for testing encoding features.
  17222. This source accepts the following options:
  17223. @table @option
  17224. @item rate, r
  17225. Specify the frame rate of the sourced video, as the number of frames
  17226. generated per second. It has to be a string in the format
  17227. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17228. number or a valid video frame rate abbreviation. The default value is
  17229. "25".
  17230. @item duration, d
  17231. Set the duration of the sourced video. See
  17232. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17233. for the accepted syntax.
  17234. If not specified, or the expressed duration is negative, the video is
  17235. supposed to be generated forever.
  17236. @item test, t
  17237. Set the number or the name of the test to perform. Supported tests are:
  17238. @table @option
  17239. @item dc_luma
  17240. @item dc_chroma
  17241. @item freq_luma
  17242. @item freq_chroma
  17243. @item amp_luma
  17244. @item amp_chroma
  17245. @item cbp
  17246. @item mv
  17247. @item ring1
  17248. @item ring2
  17249. @item all
  17250. @item max_frames, m
  17251. Set the maximum number of frames generated for each test, default value is 30.
  17252. @end table
  17253. Default value is "all", which will cycle through the list of all tests.
  17254. @end table
  17255. Some examples:
  17256. @example
  17257. mptestsrc=t=dc_luma
  17258. @end example
  17259. will generate a "dc_luma" test pattern.
  17260. @section frei0r_src
  17261. Provide a frei0r source.
  17262. To enable compilation of this filter you need to install the frei0r
  17263. header and configure FFmpeg with @code{--enable-frei0r}.
  17264. This source accepts the following parameters:
  17265. @table @option
  17266. @item size
  17267. The size of the video to generate. For the syntax of this option, check the
  17268. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17269. @item framerate
  17270. The framerate of the generated video. It may be a string of the form
  17271. @var{num}/@var{den} or a frame rate abbreviation.
  17272. @item filter_name
  17273. The name to the frei0r source to load. For more information regarding frei0r and
  17274. how to set the parameters, read the @ref{frei0r} section in the video filters
  17275. documentation.
  17276. @item filter_params
  17277. A '|'-separated list of parameters to pass to the frei0r source.
  17278. @end table
  17279. For example, to generate a frei0r partik0l source with size 200x200
  17280. and frame rate 10 which is overlaid on the overlay filter main input:
  17281. @example
  17282. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  17283. @end example
  17284. @section life
  17285. Generate a life pattern.
  17286. This source is based on a generalization of John Conway's life game.
  17287. The sourced input represents a life grid, each pixel represents a cell
  17288. which can be in one of two possible states, alive or dead. Every cell
  17289. interacts with its eight neighbours, which are the cells that are
  17290. horizontally, vertically, or diagonally adjacent.
  17291. At each interaction the grid evolves according to the adopted rule,
  17292. which specifies the number of neighbor alive cells which will make a
  17293. cell stay alive or born. The @option{rule} option allows one to specify
  17294. the rule to adopt.
  17295. This source accepts the following options:
  17296. @table @option
  17297. @item filename, f
  17298. Set the file from which to read the initial grid state. In the file,
  17299. each non-whitespace character is considered an alive cell, and newline
  17300. is used to delimit the end of each row.
  17301. If this option is not specified, the initial grid is generated
  17302. randomly.
  17303. @item rate, r
  17304. Set the video rate, that is the number of frames generated per second.
  17305. Default is 25.
  17306. @item random_fill_ratio, ratio
  17307. Set the random fill ratio for the initial random grid. It is a
  17308. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  17309. It is ignored when a file is specified.
  17310. @item random_seed, seed
  17311. Set the seed for filling the initial random grid, must be an integer
  17312. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17313. set to -1, the filter will try to use a good random seed on a best
  17314. effort basis.
  17315. @item rule
  17316. Set the life rule.
  17317. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  17318. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  17319. @var{NS} specifies the number of alive neighbor cells which make a
  17320. live cell stay alive, and @var{NB} the number of alive neighbor cells
  17321. which make a dead cell to become alive (i.e. to "born").
  17322. "s" and "b" can be used in place of "S" and "B", respectively.
  17323. Alternatively a rule can be specified by an 18-bits integer. The 9
  17324. high order bits are used to encode the next cell state if it is alive
  17325. for each number of neighbor alive cells, the low order bits specify
  17326. the rule for "borning" new cells. Higher order bits encode for an
  17327. higher number of neighbor cells.
  17328. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  17329. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  17330. Default value is "S23/B3", which is the original Conway's game of life
  17331. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  17332. cells, and will born a new cell if there are three alive cells around
  17333. a dead cell.
  17334. @item size, s
  17335. Set the size of the output video. For the syntax of this option, check the
  17336. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17337. If @option{filename} is specified, the size is set by default to the
  17338. same size of the input file. If @option{size} is set, it must contain
  17339. the size specified in the input file, and the initial grid defined in
  17340. that file is centered in the larger resulting area.
  17341. If a filename is not specified, the size value defaults to "320x240"
  17342. (used for a randomly generated initial grid).
  17343. @item stitch
  17344. If set to 1, stitch the left and right grid edges together, and the
  17345. top and bottom edges also. Defaults to 1.
  17346. @item mold
  17347. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  17348. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  17349. value from 0 to 255.
  17350. @item life_color
  17351. Set the color of living (or new born) cells.
  17352. @item death_color
  17353. Set the color of dead cells. If @option{mold} is set, this is the first color
  17354. used to represent a dead cell.
  17355. @item mold_color
  17356. Set mold color, for definitely dead and moldy cells.
  17357. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  17358. ffmpeg-utils manual,ffmpeg-utils}.
  17359. @end table
  17360. @subsection Examples
  17361. @itemize
  17362. @item
  17363. Read a grid from @file{pattern}, and center it on a grid of size
  17364. 300x300 pixels:
  17365. @example
  17366. life=f=pattern:s=300x300
  17367. @end example
  17368. @item
  17369. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  17370. @example
  17371. life=ratio=2/3:s=200x200
  17372. @end example
  17373. @item
  17374. Specify a custom rule for evolving a randomly generated grid:
  17375. @example
  17376. life=rule=S14/B34
  17377. @end example
  17378. @item
  17379. Full example with slow death effect (mold) using @command{ffplay}:
  17380. @example
  17381. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  17382. @end example
  17383. @end itemize
  17384. @anchor{allrgb}
  17385. @anchor{allyuv}
  17386. @anchor{color}
  17387. @anchor{haldclutsrc}
  17388. @anchor{nullsrc}
  17389. @anchor{pal75bars}
  17390. @anchor{pal100bars}
  17391. @anchor{rgbtestsrc}
  17392. @anchor{smptebars}
  17393. @anchor{smptehdbars}
  17394. @anchor{testsrc}
  17395. @anchor{testsrc2}
  17396. @anchor{yuvtestsrc}
  17397. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  17398. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  17399. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  17400. The @code{color} source provides an uniformly colored input.
  17401. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  17402. @ref{haldclut} filter.
  17403. The @code{nullsrc} source returns unprocessed video frames. It is
  17404. mainly useful to be employed in analysis / debugging tools, or as the
  17405. source for filters which ignore the input data.
  17406. The @code{pal75bars} source generates a color bars pattern, based on
  17407. EBU PAL recommendations with 75% color levels.
  17408. The @code{pal100bars} source generates a color bars pattern, based on
  17409. EBU PAL recommendations with 100% color levels.
  17410. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  17411. detecting RGB vs BGR issues. You should see a red, green and blue
  17412. stripe from top to bottom.
  17413. The @code{smptebars} source generates a color bars pattern, based on
  17414. the SMPTE Engineering Guideline EG 1-1990.
  17415. The @code{smptehdbars} source generates a color bars pattern, based on
  17416. the SMPTE RP 219-2002.
  17417. The @code{testsrc} source generates a test video pattern, showing a
  17418. color pattern, a scrolling gradient and a timestamp. This is mainly
  17419. intended for testing purposes.
  17420. The @code{testsrc2} source is similar to testsrc, but supports more
  17421. pixel formats instead of just @code{rgb24}. This allows using it as an
  17422. input for other tests without requiring a format conversion.
  17423. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  17424. see a y, cb and cr stripe from top to bottom.
  17425. The sources accept the following parameters:
  17426. @table @option
  17427. @item level
  17428. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  17429. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  17430. pixels to be used as identity matrix for 3D lookup tables. Each component is
  17431. coded on a @code{1/(N*N)} scale.
  17432. @item color, c
  17433. Specify the color of the source, only available in the @code{color}
  17434. source. For the syntax of this option, check the
  17435. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17436. @item size, s
  17437. Specify the size of the sourced video. For the syntax of this option, check the
  17438. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17439. The default value is @code{320x240}.
  17440. This option is not available with the @code{allrgb}, @code{allyuv}, and
  17441. @code{haldclutsrc} filters.
  17442. @item rate, r
  17443. Specify the frame rate of the sourced video, as the number of frames
  17444. generated per second. It has to be a string in the format
  17445. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17446. number or a valid video frame rate abbreviation. The default value is
  17447. "25".
  17448. @item duration, d
  17449. Set the duration of the sourced video. See
  17450. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17451. for the accepted syntax.
  17452. If not specified, or the expressed duration is negative, the video is
  17453. supposed to be generated forever.
  17454. @item sar
  17455. Set the sample aspect ratio of the sourced video.
  17456. @item alpha
  17457. Specify the alpha (opacity) of the background, only available in the
  17458. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  17459. 255 (fully opaque, the default).
  17460. @item decimals, n
  17461. Set the number of decimals to show in the timestamp, only available in the
  17462. @code{testsrc} source.
  17463. The displayed timestamp value will correspond to the original
  17464. timestamp value multiplied by the power of 10 of the specified
  17465. value. Default value is 0.
  17466. @end table
  17467. @subsection Examples
  17468. @itemize
  17469. @item
  17470. Generate a video with a duration of 5.3 seconds, with size
  17471. 176x144 and a frame rate of 10 frames per second:
  17472. @example
  17473. testsrc=duration=5.3:size=qcif:rate=10
  17474. @end example
  17475. @item
  17476. The following graph description will generate a red source
  17477. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  17478. frames per second:
  17479. @example
  17480. color=c=red@@0.2:s=qcif:r=10
  17481. @end example
  17482. @item
  17483. If the input content is to be ignored, @code{nullsrc} can be used. The
  17484. following command generates noise in the luminance plane by employing
  17485. the @code{geq} filter:
  17486. @example
  17487. nullsrc=s=256x256, geq=random(1)*255:128:128
  17488. @end example
  17489. @end itemize
  17490. @subsection Commands
  17491. The @code{color} source supports the following commands:
  17492. @table @option
  17493. @item c, color
  17494. Set the color of the created image. Accepts the same syntax of the
  17495. corresponding @option{color} option.
  17496. @end table
  17497. @section openclsrc
  17498. Generate video using an OpenCL program.
  17499. @table @option
  17500. @item source
  17501. OpenCL program source file.
  17502. @item kernel
  17503. Kernel name in program.
  17504. @item size, s
  17505. Size of frames to generate. This must be set.
  17506. @item format
  17507. Pixel format to use for the generated frames. This must be set.
  17508. @item rate, r
  17509. Number of frames generated every second. Default value is '25'.
  17510. @end table
  17511. For details of how the program loading works, see the @ref{program_opencl}
  17512. filter.
  17513. Example programs:
  17514. @itemize
  17515. @item
  17516. Generate a colour ramp by setting pixel values from the position of the pixel
  17517. in the output image. (Note that this will work with all pixel formats, but
  17518. the generated output will not be the same.)
  17519. @verbatim
  17520. __kernel void ramp(__write_only image2d_t dst,
  17521. unsigned int index)
  17522. {
  17523. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17524. float4 val;
  17525. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  17526. write_imagef(dst, loc, val);
  17527. }
  17528. @end verbatim
  17529. @item
  17530. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  17531. @verbatim
  17532. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  17533. unsigned int index)
  17534. {
  17535. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17536. float4 value = 0.0f;
  17537. int x = loc.x + index;
  17538. int y = loc.y + index;
  17539. while (x > 0 || y > 0) {
  17540. if (x % 3 == 1 && y % 3 == 1) {
  17541. value = 1.0f;
  17542. break;
  17543. }
  17544. x /= 3;
  17545. y /= 3;
  17546. }
  17547. write_imagef(dst, loc, value);
  17548. }
  17549. @end verbatim
  17550. @end itemize
  17551. @section sierpinski
  17552. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  17553. This source accepts the following options:
  17554. @table @option
  17555. @item size, s
  17556. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17557. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17558. @item rate, r
  17559. Set frame rate, expressed as number of frames per second. Default
  17560. value is "25".
  17561. @item seed
  17562. Set seed which is used for random panning.
  17563. @item jump
  17564. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  17565. @item type
  17566. Set fractal type, can be default @code{carpet} or @code{triangle}.
  17567. @end table
  17568. @c man end VIDEO SOURCES
  17569. @chapter Video Sinks
  17570. @c man begin VIDEO SINKS
  17571. Below is a description of the currently available video sinks.
  17572. @section buffersink
  17573. Buffer video frames, and make them available to the end of the filter
  17574. graph.
  17575. This sink is mainly intended for programmatic use, in particular
  17576. through the interface defined in @file{libavfilter/buffersink.h}
  17577. or the options system.
  17578. It accepts a pointer to an AVBufferSinkContext structure, which
  17579. defines the incoming buffers' formats, to be passed as the opaque
  17580. parameter to @code{avfilter_init_filter} for initialization.
  17581. @section nullsink
  17582. Null video sink: do absolutely nothing with the input video. It is
  17583. mainly useful as a template and for use in analysis / debugging
  17584. tools.
  17585. @c man end VIDEO SINKS
  17586. @chapter Multimedia Filters
  17587. @c man begin MULTIMEDIA FILTERS
  17588. Below is a description of the currently available multimedia filters.
  17589. @section abitscope
  17590. Convert input audio to a video output, displaying the audio bit scope.
  17591. The filter accepts the following options:
  17592. @table @option
  17593. @item rate, r
  17594. Set frame rate, expressed as number of frames per second. Default
  17595. value is "25".
  17596. @item size, s
  17597. Specify the video size for the output. For the syntax of this option, check the
  17598. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17599. Default value is @code{1024x256}.
  17600. @item colors
  17601. Specify list of colors separated by space or by '|' which will be used to
  17602. draw channels. Unrecognized or missing colors will be replaced
  17603. by white color.
  17604. @end table
  17605. @section adrawgraph
  17606. Draw a graph using input audio metadata.
  17607. See @ref{drawgraph}
  17608. @section agraphmonitor
  17609. See @ref{graphmonitor}.
  17610. @section ahistogram
  17611. Convert input audio to a video output, displaying the volume histogram.
  17612. The filter accepts the following options:
  17613. @table @option
  17614. @item dmode
  17615. Specify how histogram is calculated.
  17616. It accepts the following values:
  17617. @table @samp
  17618. @item single
  17619. Use single histogram for all channels.
  17620. @item separate
  17621. Use separate histogram for each channel.
  17622. @end table
  17623. Default is @code{single}.
  17624. @item rate, r
  17625. Set frame rate, expressed as number of frames per second. Default
  17626. value is "25".
  17627. @item size, s
  17628. Specify the video size for the output. For the syntax of this option, check the
  17629. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17630. Default value is @code{hd720}.
  17631. @item scale
  17632. Set display scale.
  17633. It accepts the following values:
  17634. @table @samp
  17635. @item log
  17636. logarithmic
  17637. @item sqrt
  17638. square root
  17639. @item cbrt
  17640. cubic root
  17641. @item lin
  17642. linear
  17643. @item rlog
  17644. reverse logarithmic
  17645. @end table
  17646. Default is @code{log}.
  17647. @item ascale
  17648. Set amplitude scale.
  17649. It accepts the following values:
  17650. @table @samp
  17651. @item log
  17652. logarithmic
  17653. @item lin
  17654. linear
  17655. @end table
  17656. Default is @code{log}.
  17657. @item acount
  17658. Set how much frames to accumulate in histogram.
  17659. Default is 1. Setting this to -1 accumulates all frames.
  17660. @item rheight
  17661. Set histogram ratio of window height.
  17662. @item slide
  17663. Set sonogram sliding.
  17664. It accepts the following values:
  17665. @table @samp
  17666. @item replace
  17667. replace old rows with new ones.
  17668. @item scroll
  17669. scroll from top to bottom.
  17670. @end table
  17671. Default is @code{replace}.
  17672. @end table
  17673. @section aphasemeter
  17674. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  17675. representing mean phase of current audio frame. A video output can also be produced and is
  17676. enabled by default. The audio is passed through as first output.
  17677. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  17678. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  17679. and @code{1} means channels are in phase.
  17680. The filter accepts the following options, all related to its video output:
  17681. @table @option
  17682. @item rate, r
  17683. Set the output frame rate. Default value is @code{25}.
  17684. @item size, s
  17685. Set the video size for the output. For the syntax of this option, check the
  17686. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17687. Default value is @code{800x400}.
  17688. @item rc
  17689. @item gc
  17690. @item bc
  17691. Specify the red, green, blue contrast. Default values are @code{2},
  17692. @code{7} and @code{1}.
  17693. Allowed range is @code{[0, 255]}.
  17694. @item mpc
  17695. Set color which will be used for drawing median phase. If color is
  17696. @code{none} which is default, no median phase value will be drawn.
  17697. @item video
  17698. Enable video output. Default is enabled.
  17699. @end table
  17700. @section avectorscope
  17701. Convert input audio to a video output, representing the audio vector
  17702. scope.
  17703. The filter is used to measure the difference between channels of stereo
  17704. audio stream. A monaural signal, consisting of identical left and right
  17705. signal, results in straight vertical line. Any stereo separation is visible
  17706. as a deviation from this line, creating a Lissajous figure.
  17707. If the straight (or deviation from it) but horizontal line appears this
  17708. indicates that the left and right channels are out of phase.
  17709. The filter accepts the following options:
  17710. @table @option
  17711. @item mode, m
  17712. Set the vectorscope mode.
  17713. Available values are:
  17714. @table @samp
  17715. @item lissajous
  17716. Lissajous rotated by 45 degrees.
  17717. @item lissajous_xy
  17718. Same as above but not rotated.
  17719. @item polar
  17720. Shape resembling half of circle.
  17721. @end table
  17722. Default value is @samp{lissajous}.
  17723. @item size, s
  17724. Set the video size for the output. For the syntax of this option, check the
  17725. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17726. Default value is @code{400x400}.
  17727. @item rate, r
  17728. Set the output frame rate. Default value is @code{25}.
  17729. @item rc
  17730. @item gc
  17731. @item bc
  17732. @item ac
  17733. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  17734. @code{160}, @code{80} and @code{255}.
  17735. Allowed range is @code{[0, 255]}.
  17736. @item rf
  17737. @item gf
  17738. @item bf
  17739. @item af
  17740. Specify the red, green, blue and alpha fade. Default values are @code{15},
  17741. @code{10}, @code{5} and @code{5}.
  17742. Allowed range is @code{[0, 255]}.
  17743. @item zoom
  17744. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  17745. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  17746. @item draw
  17747. Set the vectorscope drawing mode.
  17748. Available values are:
  17749. @table @samp
  17750. @item dot
  17751. Draw dot for each sample.
  17752. @item line
  17753. Draw line between previous and current sample.
  17754. @end table
  17755. Default value is @samp{dot}.
  17756. @item scale
  17757. Specify amplitude scale of audio samples.
  17758. Available values are:
  17759. @table @samp
  17760. @item lin
  17761. Linear.
  17762. @item sqrt
  17763. Square root.
  17764. @item cbrt
  17765. Cubic root.
  17766. @item log
  17767. Logarithmic.
  17768. @end table
  17769. @item swap
  17770. Swap left channel axis with right channel axis.
  17771. @item mirror
  17772. Mirror axis.
  17773. @table @samp
  17774. @item none
  17775. No mirror.
  17776. @item x
  17777. Mirror only x axis.
  17778. @item y
  17779. Mirror only y axis.
  17780. @item xy
  17781. Mirror both axis.
  17782. @end table
  17783. @end table
  17784. @subsection Examples
  17785. @itemize
  17786. @item
  17787. Complete example using @command{ffplay}:
  17788. @example
  17789. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17790. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  17791. @end example
  17792. @end itemize
  17793. @section bench, abench
  17794. Benchmark part of a filtergraph.
  17795. The filter accepts the following options:
  17796. @table @option
  17797. @item action
  17798. Start or stop a timer.
  17799. Available values are:
  17800. @table @samp
  17801. @item start
  17802. Get the current time, set it as frame metadata (using the key
  17803. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  17804. @item stop
  17805. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  17806. the input frame metadata to get the time difference. Time difference, average,
  17807. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  17808. @code{min}) are then printed. The timestamps are expressed in seconds.
  17809. @end table
  17810. @end table
  17811. @subsection Examples
  17812. @itemize
  17813. @item
  17814. Benchmark @ref{selectivecolor} filter:
  17815. @example
  17816. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  17817. @end example
  17818. @end itemize
  17819. @section concat
  17820. Concatenate audio and video streams, joining them together one after the
  17821. other.
  17822. The filter works on segments of synchronized video and audio streams. All
  17823. segments must have the same number of streams of each type, and that will
  17824. also be the number of streams at output.
  17825. The filter accepts the following options:
  17826. @table @option
  17827. @item n
  17828. Set the number of segments. Default is 2.
  17829. @item v
  17830. Set the number of output video streams, that is also the number of video
  17831. streams in each segment. Default is 1.
  17832. @item a
  17833. Set the number of output audio streams, that is also the number of audio
  17834. streams in each segment. Default is 0.
  17835. @item unsafe
  17836. Activate unsafe mode: do not fail if segments have a different format.
  17837. @end table
  17838. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  17839. @var{a} audio outputs.
  17840. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  17841. segment, in the same order as the outputs, then the inputs for the second
  17842. segment, etc.
  17843. Related streams do not always have exactly the same duration, for various
  17844. reasons including codec frame size or sloppy authoring. For that reason,
  17845. related synchronized streams (e.g. a video and its audio track) should be
  17846. concatenated at once. The concat filter will use the duration of the longest
  17847. stream in each segment (except the last one), and if necessary pad shorter
  17848. audio streams with silence.
  17849. For this filter to work correctly, all segments must start at timestamp 0.
  17850. All corresponding streams must have the same parameters in all segments; the
  17851. filtering system will automatically select a common pixel format for video
  17852. streams, and a common sample format, sample rate and channel layout for
  17853. audio streams, but other settings, such as resolution, must be converted
  17854. explicitly by the user.
  17855. Different frame rates are acceptable but will result in variable frame rate
  17856. at output; be sure to configure the output file to handle it.
  17857. @subsection Examples
  17858. @itemize
  17859. @item
  17860. Concatenate an opening, an episode and an ending, all in bilingual version
  17861. (video in stream 0, audio in streams 1 and 2):
  17862. @example
  17863. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  17864. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  17865. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  17866. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  17867. @end example
  17868. @item
  17869. Concatenate two parts, handling audio and video separately, using the
  17870. (a)movie sources, and adjusting the resolution:
  17871. @example
  17872. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  17873. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  17874. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  17875. @end example
  17876. Note that a desync will happen at the stitch if the audio and video streams
  17877. do not have exactly the same duration in the first file.
  17878. @end itemize
  17879. @subsection Commands
  17880. This filter supports the following commands:
  17881. @table @option
  17882. @item next
  17883. Close the current segment and step to the next one
  17884. @end table
  17885. @anchor{ebur128}
  17886. @section ebur128
  17887. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  17888. level. By default, it logs a message at a frequency of 10Hz with the
  17889. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  17890. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  17891. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  17892. sample format is double-precision floating point. The input stream will be converted to
  17893. this specification, if needed. Users may need to insert aformat and/or aresample filters
  17894. after this filter to obtain the original parameters.
  17895. The filter also has a video output (see the @var{video} option) with a real
  17896. time graph to observe the loudness evolution. The graphic contains the logged
  17897. message mentioned above, so it is not printed anymore when this option is set,
  17898. unless the verbose logging is set. The main graphing area contains the
  17899. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  17900. the momentary loudness (400 milliseconds), but can optionally be configured
  17901. to instead display short-term loudness (see @var{gauge}).
  17902. The green area marks a +/- 1LU target range around the target loudness
  17903. (-23LUFS by default, unless modified through @var{target}).
  17904. More information about the Loudness Recommendation EBU R128 on
  17905. @url{http://tech.ebu.ch/loudness}.
  17906. The filter accepts the following options:
  17907. @table @option
  17908. @item video
  17909. Activate the video output. The audio stream is passed unchanged whether this
  17910. option is set or no. The video stream will be the first output stream if
  17911. activated. Default is @code{0}.
  17912. @item size
  17913. Set the video size. This option is for video only. For the syntax of this
  17914. option, check the
  17915. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17916. Default and minimum resolution is @code{640x480}.
  17917. @item meter
  17918. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  17919. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  17920. other integer value between this range is allowed.
  17921. @item metadata
  17922. Set metadata injection. If set to @code{1}, the audio input will be segmented
  17923. into 100ms output frames, each of them containing various loudness information
  17924. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  17925. Default is @code{0}.
  17926. @item framelog
  17927. Force the frame logging level.
  17928. Available values are:
  17929. @table @samp
  17930. @item info
  17931. information logging level
  17932. @item verbose
  17933. verbose logging level
  17934. @end table
  17935. By default, the logging level is set to @var{info}. If the @option{video} or
  17936. the @option{metadata} options are set, it switches to @var{verbose}.
  17937. @item peak
  17938. Set peak mode(s).
  17939. Available modes can be cumulated (the option is a @code{flag} type). Possible
  17940. values are:
  17941. @table @samp
  17942. @item none
  17943. Disable any peak mode (default).
  17944. @item sample
  17945. Enable sample-peak mode.
  17946. Simple peak mode looking for the higher sample value. It logs a message
  17947. for sample-peak (identified by @code{SPK}).
  17948. @item true
  17949. Enable true-peak mode.
  17950. If enabled, the peak lookup is done on an over-sampled version of the input
  17951. stream for better peak accuracy. It logs a message for true-peak.
  17952. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  17953. This mode requires a build with @code{libswresample}.
  17954. @end table
  17955. @item dualmono
  17956. Treat mono input files as "dual mono". If a mono file is intended for playback
  17957. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  17958. If set to @code{true}, this option will compensate for this effect.
  17959. Multi-channel input files are not affected by this option.
  17960. @item panlaw
  17961. Set a specific pan law to be used for the measurement of dual mono files.
  17962. This parameter is optional, and has a default value of -3.01dB.
  17963. @item target
  17964. Set a specific target level (in LUFS) used as relative zero in the visualization.
  17965. This parameter is optional and has a default value of -23LUFS as specified
  17966. by EBU R128. However, material published online may prefer a level of -16LUFS
  17967. (e.g. for use with podcasts or video platforms).
  17968. @item gauge
  17969. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  17970. @code{shortterm}. By default the momentary value will be used, but in certain
  17971. scenarios it may be more useful to observe the short term value instead (e.g.
  17972. live mixing).
  17973. @item scale
  17974. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  17975. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  17976. video output, not the summary or continuous log output.
  17977. @end table
  17978. @subsection Examples
  17979. @itemize
  17980. @item
  17981. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  17982. @example
  17983. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  17984. @end example
  17985. @item
  17986. Run an analysis with @command{ffmpeg}:
  17987. @example
  17988. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  17989. @end example
  17990. @end itemize
  17991. @section interleave, ainterleave
  17992. Temporally interleave frames from several inputs.
  17993. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  17994. These filters read frames from several inputs and send the oldest
  17995. queued frame to the output.
  17996. Input streams must have well defined, monotonically increasing frame
  17997. timestamp values.
  17998. In order to submit one frame to output, these filters need to enqueue
  17999. at least one frame for each input, so they cannot work in case one
  18000. input is not yet terminated and will not receive incoming frames.
  18001. For example consider the case when one input is a @code{select} filter
  18002. which always drops input frames. The @code{interleave} filter will keep
  18003. reading from that input, but it will never be able to send new frames
  18004. to output until the input sends an end-of-stream signal.
  18005. Also, depending on inputs synchronization, the filters will drop
  18006. frames in case one input receives more frames than the other ones, and
  18007. the queue is already filled.
  18008. These filters accept the following options:
  18009. @table @option
  18010. @item nb_inputs, n
  18011. Set the number of different inputs, it is 2 by default.
  18012. @item duration
  18013. How to determine the end-of-stream.
  18014. @table @option
  18015. @item longest
  18016. The duration of the longest input. (default)
  18017. @item shortest
  18018. The duration of the shortest input.
  18019. @item first
  18020. The duration of the first input.
  18021. @end table
  18022. @end table
  18023. @subsection Examples
  18024. @itemize
  18025. @item
  18026. Interleave frames belonging to different streams using @command{ffmpeg}:
  18027. @example
  18028. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  18029. @end example
  18030. @item
  18031. Add flickering blur effect:
  18032. @example
  18033. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  18034. @end example
  18035. @end itemize
  18036. @section metadata, ametadata
  18037. Manipulate frame metadata.
  18038. This filter accepts the following options:
  18039. @table @option
  18040. @item mode
  18041. Set mode of operation of the filter.
  18042. Can be one of the following:
  18043. @table @samp
  18044. @item select
  18045. If both @code{value} and @code{key} is set, select frames
  18046. which have such metadata. If only @code{key} is set, select
  18047. every frame that has such key in metadata.
  18048. @item add
  18049. Add new metadata @code{key} and @code{value}. If key is already available
  18050. do nothing.
  18051. @item modify
  18052. Modify value of already present key.
  18053. @item delete
  18054. If @code{value} is set, delete only keys that have such value.
  18055. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  18056. the frame.
  18057. @item print
  18058. Print key and its value if metadata was found. If @code{key} is not set print all
  18059. metadata values available in frame.
  18060. @end table
  18061. @item key
  18062. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  18063. @item value
  18064. Set metadata value which will be used. This option is mandatory for
  18065. @code{modify} and @code{add} mode.
  18066. @item function
  18067. Which function to use when comparing metadata value and @code{value}.
  18068. Can be one of following:
  18069. @table @samp
  18070. @item same_str
  18071. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  18072. @item starts_with
  18073. Values are interpreted as strings, returns true if metadata value starts with
  18074. the @code{value} option string.
  18075. @item less
  18076. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  18077. @item equal
  18078. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  18079. @item greater
  18080. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  18081. @item expr
  18082. Values are interpreted as floats, returns true if expression from option @code{expr}
  18083. evaluates to true.
  18084. @item ends_with
  18085. Values are interpreted as strings, returns true if metadata value ends with
  18086. the @code{value} option string.
  18087. @end table
  18088. @item expr
  18089. Set expression which is used when @code{function} is set to @code{expr}.
  18090. The expression is evaluated through the eval API and can contain the following
  18091. constants:
  18092. @table @option
  18093. @item VALUE1
  18094. Float representation of @code{value} from metadata key.
  18095. @item VALUE2
  18096. Float representation of @code{value} as supplied by user in @code{value} option.
  18097. @end table
  18098. @item file
  18099. If specified in @code{print} mode, output is written to the named file. Instead of
  18100. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  18101. for standard output. If @code{file} option is not set, output is written to the log
  18102. with AV_LOG_INFO loglevel.
  18103. @item direct
  18104. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  18105. @end table
  18106. @subsection Examples
  18107. @itemize
  18108. @item
  18109. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  18110. between 0 and 1.
  18111. @example
  18112. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  18113. @end example
  18114. @item
  18115. Print silencedetect output to file @file{metadata.txt}.
  18116. @example
  18117. silencedetect,ametadata=mode=print:file=metadata.txt
  18118. @end example
  18119. @item
  18120. Direct all metadata to a pipe with file descriptor 4.
  18121. @example
  18122. metadata=mode=print:file='pipe\:4'
  18123. @end example
  18124. @end itemize
  18125. @section perms, aperms
  18126. Set read/write permissions for the output frames.
  18127. These filters are mainly aimed at developers to test direct path in the
  18128. following filter in the filtergraph.
  18129. The filters accept the following options:
  18130. @table @option
  18131. @item mode
  18132. Select the permissions mode.
  18133. It accepts the following values:
  18134. @table @samp
  18135. @item none
  18136. Do nothing. This is the default.
  18137. @item ro
  18138. Set all the output frames read-only.
  18139. @item rw
  18140. Set all the output frames directly writable.
  18141. @item toggle
  18142. Make the frame read-only if writable, and writable if read-only.
  18143. @item random
  18144. Set each output frame read-only or writable randomly.
  18145. @end table
  18146. @item seed
  18147. Set the seed for the @var{random} mode, must be an integer included between
  18148. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  18149. @code{-1}, the filter will try to use a good random seed on a best effort
  18150. basis.
  18151. @end table
  18152. Note: in case of auto-inserted filter between the permission filter and the
  18153. following one, the permission might not be received as expected in that
  18154. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  18155. perms/aperms filter can avoid this problem.
  18156. @section realtime, arealtime
  18157. Slow down filtering to match real time approximately.
  18158. These filters will pause the filtering for a variable amount of time to
  18159. match the output rate with the input timestamps.
  18160. They are similar to the @option{re} option to @code{ffmpeg}.
  18161. They accept the following options:
  18162. @table @option
  18163. @item limit
  18164. Time limit for the pauses. Any pause longer than that will be considered
  18165. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  18166. @item speed
  18167. Speed factor for processing. The value must be a float larger than zero.
  18168. Values larger than 1.0 will result in faster than realtime processing,
  18169. smaller will slow processing down. The @var{limit} is automatically adapted
  18170. accordingly. Default is 1.0.
  18171. A processing speed faster than what is possible without these filters cannot
  18172. be achieved.
  18173. @end table
  18174. @anchor{select}
  18175. @section select, aselect
  18176. Select frames to pass in output.
  18177. This filter accepts the following options:
  18178. @table @option
  18179. @item expr, e
  18180. Set expression, which is evaluated for each input frame.
  18181. If the expression is evaluated to zero, the frame is discarded.
  18182. If the evaluation result is negative or NaN, the frame is sent to the
  18183. first output; otherwise it is sent to the output with index
  18184. @code{ceil(val)-1}, assuming that the input index starts from 0.
  18185. For example a value of @code{1.2} corresponds to the output with index
  18186. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  18187. @item outputs, n
  18188. Set the number of outputs. The output to which to send the selected
  18189. frame is based on the result of the evaluation. Default value is 1.
  18190. @end table
  18191. The expression can contain the following constants:
  18192. @table @option
  18193. @item n
  18194. The (sequential) number of the filtered frame, starting from 0.
  18195. @item selected_n
  18196. The (sequential) number of the selected frame, starting from 0.
  18197. @item prev_selected_n
  18198. The sequential number of the last selected frame. It's NAN if undefined.
  18199. @item TB
  18200. The timebase of the input timestamps.
  18201. @item pts
  18202. The PTS (Presentation TimeStamp) of the filtered video frame,
  18203. expressed in @var{TB} units. It's NAN if undefined.
  18204. @item t
  18205. The PTS of the filtered video frame,
  18206. expressed in seconds. It's NAN if undefined.
  18207. @item prev_pts
  18208. The PTS of the previously filtered video frame. It's NAN if undefined.
  18209. @item prev_selected_pts
  18210. The PTS of the last previously filtered video frame. It's NAN if undefined.
  18211. @item prev_selected_t
  18212. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  18213. @item start_pts
  18214. The PTS of the first video frame in the video. It's NAN if undefined.
  18215. @item start_t
  18216. The time of the first video frame in the video. It's NAN if undefined.
  18217. @item pict_type @emph{(video only)}
  18218. The type of the filtered frame. It can assume one of the following
  18219. values:
  18220. @table @option
  18221. @item I
  18222. @item P
  18223. @item B
  18224. @item S
  18225. @item SI
  18226. @item SP
  18227. @item BI
  18228. @end table
  18229. @item interlace_type @emph{(video only)}
  18230. The frame interlace type. It can assume one of the following values:
  18231. @table @option
  18232. @item PROGRESSIVE
  18233. The frame is progressive (not interlaced).
  18234. @item TOPFIRST
  18235. The frame is top-field-first.
  18236. @item BOTTOMFIRST
  18237. The frame is bottom-field-first.
  18238. @end table
  18239. @item consumed_sample_n @emph{(audio only)}
  18240. the number of selected samples before the current frame
  18241. @item samples_n @emph{(audio only)}
  18242. the number of samples in the current frame
  18243. @item sample_rate @emph{(audio only)}
  18244. the input sample rate
  18245. @item key
  18246. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  18247. @item pos
  18248. the position in the file of the filtered frame, -1 if the information
  18249. is not available (e.g. for synthetic video)
  18250. @item scene @emph{(video only)}
  18251. value between 0 and 1 to indicate a new scene; a low value reflects a low
  18252. probability for the current frame to introduce a new scene, while a higher
  18253. value means the current frame is more likely to be one (see the example below)
  18254. @item concatdec_select
  18255. The concat demuxer can select only part of a concat input file by setting an
  18256. inpoint and an outpoint, but the output packets may not be entirely contained
  18257. in the selected interval. By using this variable, it is possible to skip frames
  18258. generated by the concat demuxer which are not exactly contained in the selected
  18259. interval.
  18260. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  18261. and the @var{lavf.concat.duration} packet metadata values which are also
  18262. present in the decoded frames.
  18263. The @var{concatdec_select} variable is -1 if the frame pts is at least
  18264. start_time and either the duration metadata is missing or the frame pts is less
  18265. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  18266. missing.
  18267. That basically means that an input frame is selected if its pts is within the
  18268. interval set by the concat demuxer.
  18269. @end table
  18270. The default value of the select expression is "1".
  18271. @subsection Examples
  18272. @itemize
  18273. @item
  18274. Select all frames in input:
  18275. @example
  18276. select
  18277. @end example
  18278. The example above is the same as:
  18279. @example
  18280. select=1
  18281. @end example
  18282. @item
  18283. Skip all frames:
  18284. @example
  18285. select=0
  18286. @end example
  18287. @item
  18288. Select only I-frames:
  18289. @example
  18290. select='eq(pict_type\,I)'
  18291. @end example
  18292. @item
  18293. Select one frame every 100:
  18294. @example
  18295. select='not(mod(n\,100))'
  18296. @end example
  18297. @item
  18298. Select only frames contained in the 10-20 time interval:
  18299. @example
  18300. select=between(t\,10\,20)
  18301. @end example
  18302. @item
  18303. Select only I-frames contained in the 10-20 time interval:
  18304. @example
  18305. select=between(t\,10\,20)*eq(pict_type\,I)
  18306. @end example
  18307. @item
  18308. Select frames with a minimum distance of 10 seconds:
  18309. @example
  18310. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  18311. @end example
  18312. @item
  18313. Use aselect to select only audio frames with samples number > 100:
  18314. @example
  18315. aselect='gt(samples_n\,100)'
  18316. @end example
  18317. @item
  18318. Create a mosaic of the first scenes:
  18319. @example
  18320. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  18321. @end example
  18322. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  18323. choice.
  18324. @item
  18325. Send even and odd frames to separate outputs, and compose them:
  18326. @example
  18327. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  18328. @end example
  18329. @item
  18330. Select useful frames from an ffconcat file which is using inpoints and
  18331. outpoints but where the source files are not intra frame only.
  18332. @example
  18333. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  18334. @end example
  18335. @end itemize
  18336. @section sendcmd, asendcmd
  18337. Send commands to filters in the filtergraph.
  18338. These filters read commands to be sent to other filters in the
  18339. filtergraph.
  18340. @code{sendcmd} must be inserted between two video filters,
  18341. @code{asendcmd} must be inserted between two audio filters, but apart
  18342. from that they act the same way.
  18343. The specification of commands can be provided in the filter arguments
  18344. with the @var{commands} option, or in a file specified by the
  18345. @var{filename} option.
  18346. These filters accept the following options:
  18347. @table @option
  18348. @item commands, c
  18349. Set the commands to be read and sent to the other filters.
  18350. @item filename, f
  18351. Set the filename of the commands to be read and sent to the other
  18352. filters.
  18353. @end table
  18354. @subsection Commands syntax
  18355. A commands description consists of a sequence of interval
  18356. specifications, comprising a list of commands to be executed when a
  18357. particular event related to that interval occurs. The occurring event
  18358. is typically the current frame time entering or leaving a given time
  18359. interval.
  18360. An interval is specified by the following syntax:
  18361. @example
  18362. @var{START}[-@var{END}] @var{COMMANDS};
  18363. @end example
  18364. The time interval is specified by the @var{START} and @var{END} times.
  18365. @var{END} is optional and defaults to the maximum time.
  18366. The current frame time is considered within the specified interval if
  18367. it is included in the interval [@var{START}, @var{END}), that is when
  18368. the time is greater or equal to @var{START} and is lesser than
  18369. @var{END}.
  18370. @var{COMMANDS} consists of a sequence of one or more command
  18371. specifications, separated by ",", relating to that interval. The
  18372. syntax of a command specification is given by:
  18373. @example
  18374. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  18375. @end example
  18376. @var{FLAGS} is optional and specifies the type of events relating to
  18377. the time interval which enable sending the specified command, and must
  18378. be a non-null sequence of identifier flags separated by "+" or "|" and
  18379. enclosed between "[" and "]".
  18380. The following flags are recognized:
  18381. @table @option
  18382. @item enter
  18383. The command is sent when the current frame timestamp enters the
  18384. specified interval. In other words, the command is sent when the
  18385. previous frame timestamp was not in the given interval, and the
  18386. current is.
  18387. @item leave
  18388. The command is sent when the current frame timestamp leaves the
  18389. specified interval. In other words, the command is sent when the
  18390. previous frame timestamp was in the given interval, and the
  18391. current is not.
  18392. @item expr
  18393. The command @var{ARG} is interpreted as expression and result of
  18394. expression is passed as @var{ARG}.
  18395. The expression is evaluated through the eval API and can contain the following
  18396. constants:
  18397. @table @option
  18398. @item POS
  18399. Original position in the file of the frame, or undefined if undefined
  18400. for the current frame.
  18401. @item PTS
  18402. The presentation timestamp in input.
  18403. @item N
  18404. The count of the input frame for video or audio, starting from 0.
  18405. @item T
  18406. The time in seconds of the current frame.
  18407. @item TS
  18408. The start time in seconds of the current command interval.
  18409. @item TE
  18410. The end time in seconds of the current command interval.
  18411. @item TI
  18412. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  18413. @end table
  18414. @end table
  18415. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  18416. assumed.
  18417. @var{TARGET} specifies the target of the command, usually the name of
  18418. the filter class or a specific filter instance name.
  18419. @var{COMMAND} specifies the name of the command for the target filter.
  18420. @var{ARG} is optional and specifies the optional list of argument for
  18421. the given @var{COMMAND}.
  18422. Between one interval specification and another, whitespaces, or
  18423. sequences of characters starting with @code{#} until the end of line,
  18424. are ignored and can be used to annotate comments.
  18425. A simplified BNF description of the commands specification syntax
  18426. follows:
  18427. @example
  18428. @var{COMMAND_FLAG} ::= "enter" | "leave"
  18429. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  18430. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  18431. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  18432. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  18433. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  18434. @end example
  18435. @subsection Examples
  18436. @itemize
  18437. @item
  18438. Specify audio tempo change at second 4:
  18439. @example
  18440. asendcmd=c='4.0 atempo tempo 1.5',atempo
  18441. @end example
  18442. @item
  18443. Target a specific filter instance:
  18444. @example
  18445. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  18446. @end example
  18447. @item
  18448. Specify a list of drawtext and hue commands in a file.
  18449. @example
  18450. # show text in the interval 5-10
  18451. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  18452. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  18453. # desaturate the image in the interval 15-20
  18454. 15.0-20.0 [enter] hue s 0,
  18455. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  18456. [leave] hue s 1,
  18457. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  18458. # apply an exponential saturation fade-out effect, starting from time 25
  18459. 25 [enter] hue s exp(25-t)
  18460. @end example
  18461. A filtergraph allowing to read and process the above command list
  18462. stored in a file @file{test.cmd}, can be specified with:
  18463. @example
  18464. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  18465. @end example
  18466. @end itemize
  18467. @anchor{setpts}
  18468. @section setpts, asetpts
  18469. Change the PTS (presentation timestamp) of the input frames.
  18470. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  18471. This filter accepts the following options:
  18472. @table @option
  18473. @item expr
  18474. The expression which is evaluated for each frame to construct its timestamp.
  18475. @end table
  18476. The expression is evaluated through the eval API and can contain the following
  18477. constants:
  18478. @table @option
  18479. @item FRAME_RATE, FR
  18480. frame rate, only defined for constant frame-rate video
  18481. @item PTS
  18482. The presentation timestamp in input
  18483. @item N
  18484. The count of the input frame for video or the number of consumed samples,
  18485. not including the current frame for audio, starting from 0.
  18486. @item NB_CONSUMED_SAMPLES
  18487. The number of consumed samples, not including the current frame (only
  18488. audio)
  18489. @item NB_SAMPLES, S
  18490. The number of samples in the current frame (only audio)
  18491. @item SAMPLE_RATE, SR
  18492. The audio sample rate.
  18493. @item STARTPTS
  18494. The PTS of the first frame.
  18495. @item STARTT
  18496. the time in seconds of the first frame
  18497. @item INTERLACED
  18498. State whether the current frame is interlaced.
  18499. @item T
  18500. the time in seconds of the current frame
  18501. @item POS
  18502. original position in the file of the frame, or undefined if undefined
  18503. for the current frame
  18504. @item PREV_INPTS
  18505. The previous input PTS.
  18506. @item PREV_INT
  18507. previous input time in seconds
  18508. @item PREV_OUTPTS
  18509. The previous output PTS.
  18510. @item PREV_OUTT
  18511. previous output time in seconds
  18512. @item RTCTIME
  18513. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  18514. instead.
  18515. @item RTCSTART
  18516. The wallclock (RTC) time at the start of the movie in microseconds.
  18517. @item TB
  18518. The timebase of the input timestamps.
  18519. @end table
  18520. @subsection Examples
  18521. @itemize
  18522. @item
  18523. Start counting PTS from zero
  18524. @example
  18525. setpts=PTS-STARTPTS
  18526. @end example
  18527. @item
  18528. Apply fast motion effect:
  18529. @example
  18530. setpts=0.5*PTS
  18531. @end example
  18532. @item
  18533. Apply slow motion effect:
  18534. @example
  18535. setpts=2.0*PTS
  18536. @end example
  18537. @item
  18538. Set fixed rate of 25 frames per second:
  18539. @example
  18540. setpts=N/(25*TB)
  18541. @end example
  18542. @item
  18543. Set fixed rate 25 fps with some jitter:
  18544. @example
  18545. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  18546. @end example
  18547. @item
  18548. Apply an offset of 10 seconds to the input PTS:
  18549. @example
  18550. setpts=PTS+10/TB
  18551. @end example
  18552. @item
  18553. Generate timestamps from a "live source" and rebase onto the current timebase:
  18554. @example
  18555. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  18556. @end example
  18557. @item
  18558. Generate timestamps by counting samples:
  18559. @example
  18560. asetpts=N/SR/TB
  18561. @end example
  18562. @end itemize
  18563. @section setrange
  18564. Force color range for the output video frame.
  18565. The @code{setrange} filter marks the color range property for the
  18566. output frames. It does not change the input frame, but only sets the
  18567. corresponding property, which affects how the frame is treated by
  18568. following filters.
  18569. The filter accepts the following options:
  18570. @table @option
  18571. @item range
  18572. Available values are:
  18573. @table @samp
  18574. @item auto
  18575. Keep the same color range property.
  18576. @item unspecified, unknown
  18577. Set the color range as unspecified.
  18578. @item limited, tv, mpeg
  18579. Set the color range as limited.
  18580. @item full, pc, jpeg
  18581. Set the color range as full.
  18582. @end table
  18583. @end table
  18584. @section settb, asettb
  18585. Set the timebase to use for the output frames timestamps.
  18586. It is mainly useful for testing timebase configuration.
  18587. It accepts the following parameters:
  18588. @table @option
  18589. @item expr, tb
  18590. The expression which is evaluated into the output timebase.
  18591. @end table
  18592. The value for @option{tb} is an arithmetic expression representing a
  18593. rational. The expression can contain the constants "AVTB" (the default
  18594. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  18595. audio only). Default value is "intb".
  18596. @subsection Examples
  18597. @itemize
  18598. @item
  18599. Set the timebase to 1/25:
  18600. @example
  18601. settb=expr=1/25
  18602. @end example
  18603. @item
  18604. Set the timebase to 1/10:
  18605. @example
  18606. settb=expr=0.1
  18607. @end example
  18608. @item
  18609. Set the timebase to 1001/1000:
  18610. @example
  18611. settb=1+0.001
  18612. @end example
  18613. @item
  18614. Set the timebase to 2*intb:
  18615. @example
  18616. settb=2*intb
  18617. @end example
  18618. @item
  18619. Set the default timebase value:
  18620. @example
  18621. settb=AVTB
  18622. @end example
  18623. @end itemize
  18624. @section showcqt
  18625. Convert input audio to a video output representing frequency spectrum
  18626. logarithmically using Brown-Puckette constant Q transform algorithm with
  18627. direct frequency domain coefficient calculation (but the transform itself
  18628. is not really constant Q, instead the Q factor is actually variable/clamped),
  18629. with musical tone scale, from E0 to D#10.
  18630. The filter accepts the following options:
  18631. @table @option
  18632. @item size, s
  18633. Specify the video size for the output. It must be even. For the syntax of this option,
  18634. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18635. Default value is @code{1920x1080}.
  18636. @item fps, rate, r
  18637. Set the output frame rate. Default value is @code{25}.
  18638. @item bar_h
  18639. Set the bargraph height. It must be even. Default value is @code{-1} which
  18640. computes the bargraph height automatically.
  18641. @item axis_h
  18642. Set the axis height. It must be even. Default value is @code{-1} which computes
  18643. the axis height automatically.
  18644. @item sono_h
  18645. Set the sonogram height. It must be even. Default value is @code{-1} which
  18646. computes the sonogram height automatically.
  18647. @item fullhd
  18648. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  18649. instead. Default value is @code{1}.
  18650. @item sono_v, volume
  18651. Specify the sonogram volume expression. It can contain variables:
  18652. @table @option
  18653. @item bar_v
  18654. the @var{bar_v} evaluated expression
  18655. @item frequency, freq, f
  18656. the frequency where it is evaluated
  18657. @item timeclamp, tc
  18658. the value of @var{timeclamp} option
  18659. @end table
  18660. and functions:
  18661. @table @option
  18662. @item a_weighting(f)
  18663. A-weighting of equal loudness
  18664. @item b_weighting(f)
  18665. B-weighting of equal loudness
  18666. @item c_weighting(f)
  18667. C-weighting of equal loudness.
  18668. @end table
  18669. Default value is @code{16}.
  18670. @item bar_v, volume2
  18671. Specify the bargraph volume expression. It can contain variables:
  18672. @table @option
  18673. @item sono_v
  18674. the @var{sono_v} evaluated expression
  18675. @item frequency, freq, f
  18676. the frequency where it is evaluated
  18677. @item timeclamp, tc
  18678. the value of @var{timeclamp} option
  18679. @end table
  18680. and functions:
  18681. @table @option
  18682. @item a_weighting(f)
  18683. A-weighting of equal loudness
  18684. @item b_weighting(f)
  18685. B-weighting of equal loudness
  18686. @item c_weighting(f)
  18687. C-weighting of equal loudness.
  18688. @end table
  18689. Default value is @code{sono_v}.
  18690. @item sono_g, gamma
  18691. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  18692. higher gamma makes the spectrum having more range. Default value is @code{3}.
  18693. Acceptable range is @code{[1, 7]}.
  18694. @item bar_g, gamma2
  18695. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  18696. @code{[1, 7]}.
  18697. @item bar_t
  18698. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  18699. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  18700. @item timeclamp, tc
  18701. Specify the transform timeclamp. At low frequency, there is trade-off between
  18702. accuracy in time domain and frequency domain. If timeclamp is lower,
  18703. event in time domain is represented more accurately (such as fast bass drum),
  18704. otherwise event in frequency domain is represented more accurately
  18705. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  18706. @item attack
  18707. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  18708. limits future samples by applying asymmetric windowing in time domain, useful
  18709. when low latency is required. Accepted range is @code{[0, 1]}.
  18710. @item basefreq
  18711. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  18712. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  18713. @item endfreq
  18714. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  18715. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  18716. @item coeffclamp
  18717. This option is deprecated and ignored.
  18718. @item tlength
  18719. Specify the transform length in time domain. Use this option to control accuracy
  18720. trade-off between time domain and frequency domain at every frequency sample.
  18721. It can contain variables:
  18722. @table @option
  18723. @item frequency, freq, f
  18724. the frequency where it is evaluated
  18725. @item timeclamp, tc
  18726. the value of @var{timeclamp} option.
  18727. @end table
  18728. Default value is @code{384*tc/(384+tc*f)}.
  18729. @item count
  18730. Specify the transform count for every video frame. Default value is @code{6}.
  18731. Acceptable range is @code{[1, 30]}.
  18732. @item fcount
  18733. Specify the transform count for every single pixel. Default value is @code{0},
  18734. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  18735. @item fontfile
  18736. Specify font file for use with freetype to draw the axis. If not specified,
  18737. use embedded font. Note that drawing with font file or embedded font is not
  18738. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  18739. option instead.
  18740. @item font
  18741. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  18742. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  18743. escaping.
  18744. @item fontcolor
  18745. Specify font color expression. This is arithmetic expression that should return
  18746. integer value 0xRRGGBB. It can contain variables:
  18747. @table @option
  18748. @item frequency, freq, f
  18749. the frequency where it is evaluated
  18750. @item timeclamp, tc
  18751. the value of @var{timeclamp} option
  18752. @end table
  18753. and functions:
  18754. @table @option
  18755. @item midi(f)
  18756. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  18757. @item r(x), g(x), b(x)
  18758. red, green, and blue value of intensity x.
  18759. @end table
  18760. Default value is @code{st(0, (midi(f)-59.5)/12);
  18761. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  18762. r(1-ld(1)) + b(ld(1))}.
  18763. @item axisfile
  18764. Specify image file to draw the axis. This option override @var{fontfile} and
  18765. @var{fontcolor} option.
  18766. @item axis, text
  18767. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  18768. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  18769. Default value is @code{1}.
  18770. @item csp
  18771. Set colorspace. The accepted values are:
  18772. @table @samp
  18773. @item unspecified
  18774. Unspecified (default)
  18775. @item bt709
  18776. BT.709
  18777. @item fcc
  18778. FCC
  18779. @item bt470bg
  18780. BT.470BG or BT.601-6 625
  18781. @item smpte170m
  18782. SMPTE-170M or BT.601-6 525
  18783. @item smpte240m
  18784. SMPTE-240M
  18785. @item bt2020ncl
  18786. BT.2020 with non-constant luminance
  18787. @end table
  18788. @item cscheme
  18789. Set spectrogram color scheme. This is list of floating point values with format
  18790. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  18791. The default is @code{1|0.5|0|0|0.5|1}.
  18792. @end table
  18793. @subsection Examples
  18794. @itemize
  18795. @item
  18796. Playing audio while showing the spectrum:
  18797. @example
  18798. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  18799. @end example
  18800. @item
  18801. Same as above, but with frame rate 30 fps:
  18802. @example
  18803. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  18804. @end example
  18805. @item
  18806. Playing at 1280x720:
  18807. @example
  18808. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  18809. @end example
  18810. @item
  18811. Disable sonogram display:
  18812. @example
  18813. sono_h=0
  18814. @end example
  18815. @item
  18816. A1 and its harmonics: A1, A2, (near)E3, A3:
  18817. @example
  18818. 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),
  18819. asplit[a][out1]; [a] showcqt [out0]'
  18820. @end example
  18821. @item
  18822. Same as above, but with more accuracy in frequency domain:
  18823. @example
  18824. 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),
  18825. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  18826. @end example
  18827. @item
  18828. Custom volume:
  18829. @example
  18830. bar_v=10:sono_v=bar_v*a_weighting(f)
  18831. @end example
  18832. @item
  18833. Custom gamma, now spectrum is linear to the amplitude.
  18834. @example
  18835. bar_g=2:sono_g=2
  18836. @end example
  18837. @item
  18838. Custom tlength equation:
  18839. @example
  18840. 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)))'
  18841. @end example
  18842. @item
  18843. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  18844. @example
  18845. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  18846. @end example
  18847. @item
  18848. Custom font using fontconfig:
  18849. @example
  18850. font='Courier New,Monospace,mono|bold'
  18851. @end example
  18852. @item
  18853. Custom frequency range with custom axis using image file:
  18854. @example
  18855. axisfile=myaxis.png:basefreq=40:endfreq=10000
  18856. @end example
  18857. @end itemize
  18858. @section showfreqs
  18859. Convert input audio to video output representing the audio power spectrum.
  18860. Audio amplitude is on Y-axis while frequency is on X-axis.
  18861. The filter accepts the following options:
  18862. @table @option
  18863. @item size, s
  18864. Specify size of video. For the syntax of this option, check the
  18865. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18866. Default is @code{1024x512}.
  18867. @item mode
  18868. Set display mode.
  18869. This set how each frequency bin will be represented.
  18870. It accepts the following values:
  18871. @table @samp
  18872. @item line
  18873. @item bar
  18874. @item dot
  18875. @end table
  18876. Default is @code{bar}.
  18877. @item ascale
  18878. Set amplitude scale.
  18879. It accepts the following values:
  18880. @table @samp
  18881. @item lin
  18882. Linear scale.
  18883. @item sqrt
  18884. Square root scale.
  18885. @item cbrt
  18886. Cubic root scale.
  18887. @item log
  18888. Logarithmic scale.
  18889. @end table
  18890. Default is @code{log}.
  18891. @item fscale
  18892. Set frequency scale.
  18893. It accepts the following values:
  18894. @table @samp
  18895. @item lin
  18896. Linear scale.
  18897. @item log
  18898. Logarithmic scale.
  18899. @item rlog
  18900. Reverse logarithmic scale.
  18901. @end table
  18902. Default is @code{lin}.
  18903. @item win_size
  18904. Set window size. Allowed range is from 16 to 65536.
  18905. Default is @code{2048}
  18906. @item win_func
  18907. Set windowing function.
  18908. It accepts the following values:
  18909. @table @samp
  18910. @item rect
  18911. @item bartlett
  18912. @item hanning
  18913. @item hamming
  18914. @item blackman
  18915. @item welch
  18916. @item flattop
  18917. @item bharris
  18918. @item bnuttall
  18919. @item bhann
  18920. @item sine
  18921. @item nuttall
  18922. @item lanczos
  18923. @item gauss
  18924. @item tukey
  18925. @item dolph
  18926. @item cauchy
  18927. @item parzen
  18928. @item poisson
  18929. @item bohman
  18930. @end table
  18931. Default is @code{hanning}.
  18932. @item overlap
  18933. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18934. which means optimal overlap for selected window function will be picked.
  18935. @item averaging
  18936. Set time averaging. Setting this to 0 will display current maximal peaks.
  18937. Default is @code{1}, which means time averaging is disabled.
  18938. @item colors
  18939. Specify list of colors separated by space or by '|' which will be used to
  18940. draw channel frequencies. Unrecognized or missing colors will be replaced
  18941. by white color.
  18942. @item cmode
  18943. Set channel display mode.
  18944. It accepts the following values:
  18945. @table @samp
  18946. @item combined
  18947. @item separate
  18948. @end table
  18949. Default is @code{combined}.
  18950. @item minamp
  18951. Set minimum amplitude used in @code{log} amplitude scaler.
  18952. @end table
  18953. @section showspatial
  18954. Convert stereo input audio to a video output, representing the spatial relationship
  18955. between two channels.
  18956. The filter accepts the following options:
  18957. @table @option
  18958. @item size, s
  18959. Specify the video size for the output. For the syntax of this option, check the
  18960. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18961. Default value is @code{512x512}.
  18962. @item win_size
  18963. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  18964. @item win_func
  18965. Set window function.
  18966. It accepts the following values:
  18967. @table @samp
  18968. @item rect
  18969. @item bartlett
  18970. @item hann
  18971. @item hanning
  18972. @item hamming
  18973. @item blackman
  18974. @item welch
  18975. @item flattop
  18976. @item bharris
  18977. @item bnuttall
  18978. @item bhann
  18979. @item sine
  18980. @item nuttall
  18981. @item lanczos
  18982. @item gauss
  18983. @item tukey
  18984. @item dolph
  18985. @item cauchy
  18986. @item parzen
  18987. @item poisson
  18988. @item bohman
  18989. @end table
  18990. Default value is @code{hann}.
  18991. @item overlap
  18992. Set ratio of overlap window. Default value is @code{0.5}.
  18993. When value is @code{1} overlap is set to recommended size for specific
  18994. window function currently used.
  18995. @end table
  18996. @anchor{showspectrum}
  18997. @section showspectrum
  18998. Convert input audio to a video output, representing the audio frequency
  18999. spectrum.
  19000. The filter accepts the following options:
  19001. @table @option
  19002. @item size, s
  19003. Specify the video size for the output. For the syntax of this option, check the
  19004. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19005. Default value is @code{640x512}.
  19006. @item slide
  19007. Specify how the spectrum should slide along the window.
  19008. It accepts the following values:
  19009. @table @samp
  19010. @item replace
  19011. the samples start again on the left when they reach the right
  19012. @item scroll
  19013. the samples scroll from right to left
  19014. @item fullframe
  19015. frames are only produced when the samples reach the right
  19016. @item rscroll
  19017. the samples scroll from left to right
  19018. @end table
  19019. Default value is @code{replace}.
  19020. @item mode
  19021. Specify display mode.
  19022. It accepts the following values:
  19023. @table @samp
  19024. @item combined
  19025. all channels are displayed in the same row
  19026. @item separate
  19027. all channels are displayed in separate rows
  19028. @end table
  19029. Default value is @samp{combined}.
  19030. @item color
  19031. Specify display color mode.
  19032. It accepts the following values:
  19033. @table @samp
  19034. @item channel
  19035. each channel is displayed in a separate color
  19036. @item intensity
  19037. each channel is displayed using the same color scheme
  19038. @item rainbow
  19039. each channel is displayed using the rainbow color scheme
  19040. @item moreland
  19041. each channel is displayed using the moreland color scheme
  19042. @item nebulae
  19043. each channel is displayed using the nebulae color scheme
  19044. @item fire
  19045. each channel is displayed using the fire color scheme
  19046. @item fiery
  19047. each channel is displayed using the fiery color scheme
  19048. @item fruit
  19049. each channel is displayed using the fruit color scheme
  19050. @item cool
  19051. each channel is displayed using the cool color scheme
  19052. @item magma
  19053. each channel is displayed using the magma color scheme
  19054. @item green
  19055. each channel is displayed using the green color scheme
  19056. @item viridis
  19057. each channel is displayed using the viridis color scheme
  19058. @item plasma
  19059. each channel is displayed using the plasma color scheme
  19060. @item cividis
  19061. each channel is displayed using the cividis color scheme
  19062. @item terrain
  19063. each channel is displayed using the terrain color scheme
  19064. @end table
  19065. Default value is @samp{channel}.
  19066. @item scale
  19067. Specify scale used for calculating intensity color values.
  19068. It accepts the following values:
  19069. @table @samp
  19070. @item lin
  19071. linear
  19072. @item sqrt
  19073. square root, default
  19074. @item cbrt
  19075. cubic root
  19076. @item log
  19077. logarithmic
  19078. @item 4thrt
  19079. 4th root
  19080. @item 5thrt
  19081. 5th root
  19082. @end table
  19083. Default value is @samp{sqrt}.
  19084. @item fscale
  19085. Specify frequency scale.
  19086. It accepts the following values:
  19087. @table @samp
  19088. @item lin
  19089. linear
  19090. @item log
  19091. logarithmic
  19092. @end table
  19093. Default value is @samp{lin}.
  19094. @item saturation
  19095. Set saturation modifier for displayed colors. Negative values provide
  19096. alternative color scheme. @code{0} is no saturation at all.
  19097. Saturation must be in [-10.0, 10.0] range.
  19098. Default value is @code{1}.
  19099. @item win_func
  19100. Set window function.
  19101. It accepts the following values:
  19102. @table @samp
  19103. @item rect
  19104. @item bartlett
  19105. @item hann
  19106. @item hanning
  19107. @item hamming
  19108. @item blackman
  19109. @item welch
  19110. @item flattop
  19111. @item bharris
  19112. @item bnuttall
  19113. @item bhann
  19114. @item sine
  19115. @item nuttall
  19116. @item lanczos
  19117. @item gauss
  19118. @item tukey
  19119. @item dolph
  19120. @item cauchy
  19121. @item parzen
  19122. @item poisson
  19123. @item bohman
  19124. @end table
  19125. Default value is @code{hann}.
  19126. @item orientation
  19127. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19128. @code{horizontal}. Default is @code{vertical}.
  19129. @item overlap
  19130. Set ratio of overlap window. Default value is @code{0}.
  19131. When value is @code{1} overlap is set to recommended size for specific
  19132. window function currently used.
  19133. @item gain
  19134. Set scale gain for calculating intensity color values.
  19135. Default value is @code{1}.
  19136. @item data
  19137. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  19138. @item rotation
  19139. Set color rotation, must be in [-1.0, 1.0] range.
  19140. Default value is @code{0}.
  19141. @item start
  19142. Set start frequency from which to display spectrogram. Default is @code{0}.
  19143. @item stop
  19144. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19145. @item fps
  19146. Set upper frame rate limit. Default is @code{auto}, unlimited.
  19147. @item legend
  19148. Draw time and frequency axes and legends. Default is disabled.
  19149. @end table
  19150. The usage is very similar to the showwaves filter; see the examples in that
  19151. section.
  19152. @subsection Examples
  19153. @itemize
  19154. @item
  19155. Large window with logarithmic color scaling:
  19156. @example
  19157. showspectrum=s=1280x480:scale=log
  19158. @end example
  19159. @item
  19160. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  19161. @example
  19162. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  19163. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  19164. @end example
  19165. @end itemize
  19166. @section showspectrumpic
  19167. Convert input audio to a single video frame, representing the audio frequency
  19168. spectrum.
  19169. The filter accepts the following options:
  19170. @table @option
  19171. @item size, s
  19172. Specify the video size for the output. For the syntax of this option, check the
  19173. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19174. Default value is @code{4096x2048}.
  19175. @item mode
  19176. Specify display mode.
  19177. It accepts the following values:
  19178. @table @samp
  19179. @item combined
  19180. all channels are displayed in the same row
  19181. @item separate
  19182. all channels are displayed in separate rows
  19183. @end table
  19184. Default value is @samp{combined}.
  19185. @item color
  19186. Specify display color mode.
  19187. It accepts the following values:
  19188. @table @samp
  19189. @item channel
  19190. each channel is displayed in a separate color
  19191. @item intensity
  19192. each channel is displayed using the same color scheme
  19193. @item rainbow
  19194. each channel is displayed using the rainbow color scheme
  19195. @item moreland
  19196. each channel is displayed using the moreland color scheme
  19197. @item nebulae
  19198. each channel is displayed using the nebulae color scheme
  19199. @item fire
  19200. each channel is displayed using the fire color scheme
  19201. @item fiery
  19202. each channel is displayed using the fiery color scheme
  19203. @item fruit
  19204. each channel is displayed using the fruit color scheme
  19205. @item cool
  19206. each channel is displayed using the cool color scheme
  19207. @item magma
  19208. each channel is displayed using the magma color scheme
  19209. @item green
  19210. each channel is displayed using the green color scheme
  19211. @item viridis
  19212. each channel is displayed using the viridis color scheme
  19213. @item plasma
  19214. each channel is displayed using the plasma color scheme
  19215. @item cividis
  19216. each channel is displayed using the cividis color scheme
  19217. @item terrain
  19218. each channel is displayed using the terrain color scheme
  19219. @end table
  19220. Default value is @samp{intensity}.
  19221. @item scale
  19222. Specify scale used for calculating intensity color values.
  19223. It accepts the following values:
  19224. @table @samp
  19225. @item lin
  19226. linear
  19227. @item sqrt
  19228. square root, default
  19229. @item cbrt
  19230. cubic root
  19231. @item log
  19232. logarithmic
  19233. @item 4thrt
  19234. 4th root
  19235. @item 5thrt
  19236. 5th root
  19237. @end table
  19238. Default value is @samp{log}.
  19239. @item fscale
  19240. Specify frequency scale.
  19241. It accepts the following values:
  19242. @table @samp
  19243. @item lin
  19244. linear
  19245. @item log
  19246. logarithmic
  19247. @end table
  19248. Default value is @samp{lin}.
  19249. @item saturation
  19250. Set saturation modifier for displayed colors. Negative values provide
  19251. alternative color scheme. @code{0} is no saturation at all.
  19252. Saturation must be in [-10.0, 10.0] range.
  19253. Default value is @code{1}.
  19254. @item win_func
  19255. Set window function.
  19256. It accepts the following values:
  19257. @table @samp
  19258. @item rect
  19259. @item bartlett
  19260. @item hann
  19261. @item hanning
  19262. @item hamming
  19263. @item blackman
  19264. @item welch
  19265. @item flattop
  19266. @item bharris
  19267. @item bnuttall
  19268. @item bhann
  19269. @item sine
  19270. @item nuttall
  19271. @item lanczos
  19272. @item gauss
  19273. @item tukey
  19274. @item dolph
  19275. @item cauchy
  19276. @item parzen
  19277. @item poisson
  19278. @item bohman
  19279. @end table
  19280. Default value is @code{hann}.
  19281. @item orientation
  19282. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19283. @code{horizontal}. Default is @code{vertical}.
  19284. @item gain
  19285. Set scale gain for calculating intensity color values.
  19286. Default value is @code{1}.
  19287. @item legend
  19288. Draw time and frequency axes and legends. Default is enabled.
  19289. @item rotation
  19290. Set color rotation, must be in [-1.0, 1.0] range.
  19291. Default value is @code{0}.
  19292. @item start
  19293. Set start frequency from which to display spectrogram. Default is @code{0}.
  19294. @item stop
  19295. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19296. @end table
  19297. @subsection Examples
  19298. @itemize
  19299. @item
  19300. Extract an audio spectrogram of a whole audio track
  19301. in a 1024x1024 picture using @command{ffmpeg}:
  19302. @example
  19303. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  19304. @end example
  19305. @end itemize
  19306. @section showvolume
  19307. Convert input audio volume to a video output.
  19308. The filter accepts the following options:
  19309. @table @option
  19310. @item rate, r
  19311. Set video rate.
  19312. @item b
  19313. Set border width, allowed range is [0, 5]. Default is 1.
  19314. @item w
  19315. Set channel width, allowed range is [80, 8192]. Default is 400.
  19316. @item h
  19317. Set channel height, allowed range is [1, 900]. Default is 20.
  19318. @item f
  19319. Set fade, allowed range is [0, 1]. Default is 0.95.
  19320. @item c
  19321. Set volume color expression.
  19322. The expression can use the following variables:
  19323. @table @option
  19324. @item VOLUME
  19325. Current max volume of channel in dB.
  19326. @item PEAK
  19327. Current peak.
  19328. @item CHANNEL
  19329. Current channel number, starting from 0.
  19330. @end table
  19331. @item t
  19332. If set, displays channel names. Default is enabled.
  19333. @item v
  19334. If set, displays volume values. Default is enabled.
  19335. @item o
  19336. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  19337. default is @code{h}.
  19338. @item s
  19339. Set step size, allowed range is [0, 5]. Default is 0, which means
  19340. step is disabled.
  19341. @item p
  19342. Set background opacity, allowed range is [0, 1]. Default is 0.
  19343. @item m
  19344. Set metering mode, can be peak: @code{p} or rms: @code{r},
  19345. default is @code{p}.
  19346. @item ds
  19347. Set display scale, can be linear: @code{lin} or log: @code{log},
  19348. default is @code{lin}.
  19349. @item dm
  19350. In second.
  19351. If set to > 0., display a line for the max level
  19352. in the previous seconds.
  19353. default is disabled: @code{0.}
  19354. @item dmc
  19355. The color of the max line. Use when @code{dm} option is set to > 0.
  19356. default is: @code{orange}
  19357. @end table
  19358. @section showwaves
  19359. Convert input audio to a video output, representing the samples waves.
  19360. The filter accepts the following options:
  19361. @table @option
  19362. @item size, s
  19363. Specify the video size for the output. For the syntax of this option, check the
  19364. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19365. Default value is @code{600x240}.
  19366. @item mode
  19367. Set display mode.
  19368. Available values are:
  19369. @table @samp
  19370. @item point
  19371. Draw a point for each sample.
  19372. @item line
  19373. Draw a vertical line for each sample.
  19374. @item p2p
  19375. Draw a point for each sample and a line between them.
  19376. @item cline
  19377. Draw a centered vertical line for each sample.
  19378. @end table
  19379. Default value is @code{point}.
  19380. @item n
  19381. Set the number of samples which are printed on the same column. A
  19382. larger value will decrease the frame rate. Must be a positive
  19383. integer. This option can be set only if the value for @var{rate}
  19384. is not explicitly specified.
  19385. @item rate, r
  19386. Set the (approximate) output frame rate. This is done by setting the
  19387. option @var{n}. Default value is "25".
  19388. @item split_channels
  19389. Set if channels should be drawn separately or overlap. Default value is 0.
  19390. @item colors
  19391. Set colors separated by '|' which are going to be used for drawing of each channel.
  19392. @item scale
  19393. Set amplitude scale.
  19394. Available values are:
  19395. @table @samp
  19396. @item lin
  19397. Linear.
  19398. @item log
  19399. Logarithmic.
  19400. @item sqrt
  19401. Square root.
  19402. @item cbrt
  19403. Cubic root.
  19404. @end table
  19405. Default is linear.
  19406. @item draw
  19407. Set the draw mode. This is mostly useful to set for high @var{n}.
  19408. Available values are:
  19409. @table @samp
  19410. @item scale
  19411. Scale pixel values for each drawn sample.
  19412. @item full
  19413. Draw every sample directly.
  19414. @end table
  19415. Default value is @code{scale}.
  19416. @end table
  19417. @subsection Examples
  19418. @itemize
  19419. @item
  19420. Output the input file audio and the corresponding video representation
  19421. at the same time:
  19422. @example
  19423. amovie=a.mp3,asplit[out0],showwaves[out1]
  19424. @end example
  19425. @item
  19426. Create a synthetic signal and show it with showwaves, forcing a
  19427. frame rate of 30 frames per second:
  19428. @example
  19429. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  19430. @end example
  19431. @end itemize
  19432. @section showwavespic
  19433. Convert input audio to a single video frame, representing the samples waves.
  19434. The filter accepts the following options:
  19435. @table @option
  19436. @item size, s
  19437. Specify the video size for the output. For the syntax of this option, check the
  19438. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19439. Default value is @code{600x240}.
  19440. @item split_channels
  19441. Set if channels should be drawn separately or overlap. Default value is 0.
  19442. @item colors
  19443. Set colors separated by '|' which are going to be used for drawing of each channel.
  19444. @item scale
  19445. Set amplitude scale.
  19446. Available values are:
  19447. @table @samp
  19448. @item lin
  19449. Linear.
  19450. @item log
  19451. Logarithmic.
  19452. @item sqrt
  19453. Square root.
  19454. @item cbrt
  19455. Cubic root.
  19456. @end table
  19457. Default is linear.
  19458. @item draw
  19459. Set the draw mode.
  19460. Available values are:
  19461. @table @samp
  19462. @item scale
  19463. Scale pixel values for each drawn sample.
  19464. @item full
  19465. Draw every sample directly.
  19466. @end table
  19467. Default value is @code{scale}.
  19468. @item filter
  19469. Set the filter mode.
  19470. Available values are:
  19471. @table @samp
  19472. @item average
  19473. Use average samples values for each drawn sample.
  19474. @item peak
  19475. Use peak samples values for each drawn sample.
  19476. @end table
  19477. Default value is @code{average}.
  19478. @end table
  19479. @subsection Examples
  19480. @itemize
  19481. @item
  19482. Extract a channel split representation of the wave form of a whole audio track
  19483. in a 1024x800 picture using @command{ffmpeg}:
  19484. @example
  19485. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  19486. @end example
  19487. @end itemize
  19488. @section sidedata, asidedata
  19489. Delete frame side data, or select frames based on it.
  19490. This filter accepts the following options:
  19491. @table @option
  19492. @item mode
  19493. Set mode of operation of the filter.
  19494. Can be one of the following:
  19495. @table @samp
  19496. @item select
  19497. Select every frame with side data of @code{type}.
  19498. @item delete
  19499. Delete side data of @code{type}. If @code{type} is not set, delete all side
  19500. data in the frame.
  19501. @end table
  19502. @item type
  19503. Set side data type used with all modes. Must be set for @code{select} mode. For
  19504. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  19505. in @file{libavutil/frame.h}. For example, to choose
  19506. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  19507. @end table
  19508. @section spectrumsynth
  19509. Synthesize audio from 2 input video spectrums, first input stream represents
  19510. magnitude across time and second represents phase across time.
  19511. The filter will transform from frequency domain as displayed in videos back
  19512. to time domain as presented in audio output.
  19513. This filter is primarily created for reversing processed @ref{showspectrum}
  19514. filter outputs, but can synthesize sound from other spectrograms too.
  19515. But in such case results are going to be poor if the phase data is not
  19516. available, because in such cases phase data need to be recreated, usually
  19517. it's just recreated from random noise.
  19518. For best results use gray only output (@code{channel} color mode in
  19519. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  19520. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  19521. @code{data} option. Inputs videos should generally use @code{fullframe}
  19522. slide mode as that saves resources needed for decoding video.
  19523. The filter accepts the following options:
  19524. @table @option
  19525. @item sample_rate
  19526. Specify sample rate of output audio, the sample rate of audio from which
  19527. spectrum was generated may differ.
  19528. @item channels
  19529. Set number of channels represented in input video spectrums.
  19530. @item scale
  19531. Set scale which was used when generating magnitude input spectrum.
  19532. Can be @code{lin} or @code{log}. Default is @code{log}.
  19533. @item slide
  19534. Set slide which was used when generating inputs spectrums.
  19535. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  19536. Default is @code{fullframe}.
  19537. @item win_func
  19538. Set window function used for resynthesis.
  19539. @item overlap
  19540. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19541. which means optimal overlap for selected window function will be picked.
  19542. @item orientation
  19543. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  19544. Default is @code{vertical}.
  19545. @end table
  19546. @subsection Examples
  19547. @itemize
  19548. @item
  19549. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  19550. then resynthesize videos back to audio with spectrumsynth:
  19551. @example
  19552. 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
  19553. 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
  19554. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  19555. @end example
  19556. @end itemize
  19557. @section split, asplit
  19558. Split input into several identical outputs.
  19559. @code{asplit} works with audio input, @code{split} with video.
  19560. The filter accepts a single parameter which specifies the number of outputs. If
  19561. unspecified, it defaults to 2.
  19562. @subsection Examples
  19563. @itemize
  19564. @item
  19565. Create two separate outputs from the same input:
  19566. @example
  19567. [in] split [out0][out1]
  19568. @end example
  19569. @item
  19570. To create 3 or more outputs, you need to specify the number of
  19571. outputs, like in:
  19572. @example
  19573. [in] asplit=3 [out0][out1][out2]
  19574. @end example
  19575. @item
  19576. Create two separate outputs from the same input, one cropped and
  19577. one padded:
  19578. @example
  19579. [in] split [splitout1][splitout2];
  19580. [splitout1] crop=100:100:0:0 [cropout];
  19581. [splitout2] pad=200:200:100:100 [padout];
  19582. @end example
  19583. @item
  19584. Create 5 copies of the input audio with @command{ffmpeg}:
  19585. @example
  19586. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  19587. @end example
  19588. @end itemize
  19589. @section zmq, azmq
  19590. Receive commands sent through a libzmq client, and forward them to
  19591. filters in the filtergraph.
  19592. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  19593. must be inserted between two video filters, @code{azmq} between two
  19594. audio filters. Both are capable to send messages to any filter type.
  19595. To enable these filters you need to install the libzmq library and
  19596. headers and configure FFmpeg with @code{--enable-libzmq}.
  19597. For more information about libzmq see:
  19598. @url{http://www.zeromq.org/}
  19599. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  19600. receives messages sent through a network interface defined by the
  19601. @option{bind_address} (or the abbreviation "@option{b}") option.
  19602. Default value of this option is @file{tcp://localhost:5555}. You may
  19603. want to alter this value to your needs, but do not forget to escape any
  19604. ':' signs (see @ref{filtergraph escaping}).
  19605. The received message must be in the form:
  19606. @example
  19607. @var{TARGET} @var{COMMAND} [@var{ARG}]
  19608. @end example
  19609. @var{TARGET} specifies the target of the command, usually the name of
  19610. the filter class or a specific filter instance name. The default
  19611. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  19612. but you can override this by using the @samp{filter_name@@id} syntax
  19613. (see @ref{Filtergraph syntax}).
  19614. @var{COMMAND} specifies the name of the command for the target filter.
  19615. @var{ARG} is optional and specifies the optional argument list for the
  19616. given @var{COMMAND}.
  19617. Upon reception, the message is processed and the corresponding command
  19618. is injected into the filtergraph. Depending on the result, the filter
  19619. will send a reply to the client, adopting the format:
  19620. @example
  19621. @var{ERROR_CODE} @var{ERROR_REASON}
  19622. @var{MESSAGE}
  19623. @end example
  19624. @var{MESSAGE} is optional.
  19625. @subsection Examples
  19626. Look at @file{tools/zmqsend} for an example of a zmq client which can
  19627. be used to send commands processed by these filters.
  19628. Consider the following filtergraph generated by @command{ffplay}.
  19629. In this example the last overlay filter has an instance name. All other
  19630. filters will have default instance names.
  19631. @example
  19632. ffplay -dumpgraph 1 -f lavfi "
  19633. color=s=100x100:c=red [l];
  19634. color=s=100x100:c=blue [r];
  19635. nullsrc=s=200x100, zmq [bg];
  19636. [bg][l] overlay [bg+l];
  19637. [bg+l][r] overlay@@my=x=100 "
  19638. @end example
  19639. To change the color of the left side of the video, the following
  19640. command can be used:
  19641. @example
  19642. echo Parsed_color_0 c yellow | tools/zmqsend
  19643. @end example
  19644. To change the right side:
  19645. @example
  19646. echo Parsed_color_1 c pink | tools/zmqsend
  19647. @end example
  19648. To change the position of the right side:
  19649. @example
  19650. echo overlay@@my x 150 | tools/zmqsend
  19651. @end example
  19652. @c man end MULTIMEDIA FILTERS
  19653. @chapter Multimedia Sources
  19654. @c man begin MULTIMEDIA SOURCES
  19655. Below is a description of the currently available multimedia sources.
  19656. @section amovie
  19657. This is the same as @ref{movie} source, except it selects an audio
  19658. stream by default.
  19659. @anchor{movie}
  19660. @section movie
  19661. Read audio and/or video stream(s) from a movie container.
  19662. It accepts the following parameters:
  19663. @table @option
  19664. @item filename
  19665. The name of the resource to read (not necessarily a file; it can also be a
  19666. device or a stream accessed through some protocol).
  19667. @item format_name, f
  19668. Specifies the format assumed for the movie to read, and can be either
  19669. the name of a container or an input device. If not specified, the
  19670. format is guessed from @var{movie_name} or by probing.
  19671. @item seek_point, sp
  19672. Specifies the seek point in seconds. The frames will be output
  19673. starting from this seek point. The parameter is evaluated with
  19674. @code{av_strtod}, so the numerical value may be suffixed by an IS
  19675. postfix. The default value is "0".
  19676. @item streams, s
  19677. Specifies the streams to read. Several streams can be specified,
  19678. separated by "+". The source will then have as many outputs, in the
  19679. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  19680. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  19681. respectively the default (best suited) video and audio stream. Default
  19682. is "dv", or "da" if the filter is called as "amovie".
  19683. @item stream_index, si
  19684. Specifies the index of the video stream to read. If the value is -1,
  19685. the most suitable video stream will be automatically selected. The default
  19686. value is "-1". Deprecated. If the filter is called "amovie", it will select
  19687. audio instead of video.
  19688. @item loop
  19689. Specifies how many times to read the stream in sequence.
  19690. If the value is 0, the stream will be looped infinitely.
  19691. Default value is "1".
  19692. Note that when the movie is looped the source timestamps are not
  19693. changed, so it will generate non monotonically increasing timestamps.
  19694. @item discontinuity
  19695. Specifies the time difference between frames above which the point is
  19696. considered a timestamp discontinuity which is removed by adjusting the later
  19697. timestamps.
  19698. @end table
  19699. It allows overlaying a second video on top of the main input of
  19700. a filtergraph, as shown in this graph:
  19701. @example
  19702. input -----------> deltapts0 --> overlay --> output
  19703. ^
  19704. |
  19705. movie --> scale--> deltapts1 -------+
  19706. @end example
  19707. @subsection Examples
  19708. @itemize
  19709. @item
  19710. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  19711. on top of the input labelled "in":
  19712. @example
  19713. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19714. [in] setpts=PTS-STARTPTS [main];
  19715. [main][over] overlay=16:16 [out]
  19716. @end example
  19717. @item
  19718. Read from a video4linux2 device, and overlay it on top of the input
  19719. labelled "in":
  19720. @example
  19721. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19722. [in] setpts=PTS-STARTPTS [main];
  19723. [main][over] overlay=16:16 [out]
  19724. @end example
  19725. @item
  19726. Read the first video stream and the audio stream with id 0x81 from
  19727. dvd.vob; the video is connected to the pad named "video" and the audio is
  19728. connected to the pad named "audio":
  19729. @example
  19730. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  19731. @end example
  19732. @end itemize
  19733. @subsection Commands
  19734. Both movie and amovie support the following commands:
  19735. @table @option
  19736. @item seek
  19737. Perform seek using "av_seek_frame".
  19738. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  19739. @itemize
  19740. @item
  19741. @var{stream_index}: If stream_index is -1, a default
  19742. stream is selected, and @var{timestamp} is automatically converted
  19743. from AV_TIME_BASE units to the stream specific time_base.
  19744. @item
  19745. @var{timestamp}: Timestamp in AVStream.time_base units
  19746. or, if no stream is specified, in AV_TIME_BASE units.
  19747. @item
  19748. @var{flags}: Flags which select direction and seeking mode.
  19749. @end itemize
  19750. @item get_duration
  19751. Get movie duration in AV_TIME_BASE units.
  19752. @end table
  19753. @c man end MULTIMEDIA SOURCES