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.

26065 lines
692KB

  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 afreqshift
  1018. Apply frequency shift to input audio samples.
  1019. The filter accepts the following options:
  1020. @table @option
  1021. @item shift
  1022. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1023. Default value is 0.0.
  1024. @end table
  1025. @subsection Commands
  1026. This filter supports the above option as @ref{commands}.
  1027. @section agate
  1028. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1029. processing reduces disturbing noise between useful signals.
  1030. Gating is done by detecting the volume below a chosen level @var{threshold}
  1031. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1032. floor is set via @var{range}. Because an exact manipulation of the signal
  1033. would cause distortion of the waveform the reduction can be levelled over
  1034. time. This is done by setting @var{attack} and @var{release}.
  1035. @var{attack} determines how long the signal has to fall below the threshold
  1036. before any reduction will occur and @var{release} sets the time the signal
  1037. has to rise above the threshold to reduce the reduction again.
  1038. Shorter signals than the chosen attack time will be left untouched.
  1039. @table @option
  1040. @item level_in
  1041. Set input level before filtering.
  1042. Default is 1. Allowed range is from 0.015625 to 64.
  1043. @item mode
  1044. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1045. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1046. will be amplified, expanding dynamic range in upward direction.
  1047. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1048. @item range
  1049. Set the level of gain reduction when the signal is below the threshold.
  1050. Default is 0.06125. Allowed range is from 0 to 1.
  1051. Setting this to 0 disables reduction and then filter behaves like expander.
  1052. @item threshold
  1053. If a signal rises above this level the gain reduction is released.
  1054. Default is 0.125. Allowed range is from 0 to 1.
  1055. @item ratio
  1056. Set a ratio by which the signal is reduced.
  1057. Default is 2. Allowed range is from 1 to 9000.
  1058. @item attack
  1059. Amount of milliseconds the signal has to rise above the threshold before gain
  1060. reduction stops.
  1061. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1062. @item release
  1063. Amount of milliseconds the signal has to fall below the threshold before the
  1064. reduction is increased again. Default is 250 milliseconds.
  1065. Allowed range is from 0.01 to 9000.
  1066. @item makeup
  1067. Set amount of amplification of signal after processing.
  1068. Default is 1. Allowed range is from 1 to 64.
  1069. @item knee
  1070. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1071. Default is 2.828427125. Allowed range is from 1 to 8.
  1072. @item detection
  1073. Choose if exact signal should be taken for detection or an RMS like one.
  1074. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1075. @item link
  1076. Choose if the average level between all channels or the louder channel affects
  1077. the reduction.
  1078. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1079. @end table
  1080. @section aiir
  1081. Apply an arbitrary Infinite Impulse Response filter.
  1082. It accepts the following parameters:
  1083. @table @option
  1084. @item zeros, z
  1085. Set numerator/zeros coefficients.
  1086. @item poles, p
  1087. Set denominator/poles coefficients.
  1088. @item gains, k
  1089. Set channels gains.
  1090. @item dry_gain
  1091. Set input gain.
  1092. @item wet_gain
  1093. Set output gain.
  1094. @item format, f
  1095. Set coefficients format.
  1096. @table @samp
  1097. @item sf
  1098. analog transfer function
  1099. @item tf
  1100. digital transfer function
  1101. @item zp
  1102. Z-plane zeros/poles, cartesian (default)
  1103. @item pr
  1104. Z-plane zeros/poles, polar radians
  1105. @item pd
  1106. Z-plane zeros/poles, polar degrees
  1107. @item sp
  1108. S-plane zeros/poles
  1109. @end table
  1110. @item process, r
  1111. Set type of processing.
  1112. @table @samp
  1113. @item d
  1114. direct processing
  1115. @item s
  1116. serial processing
  1117. @item p
  1118. parallel processing
  1119. @end table
  1120. @item precision, e
  1121. Set filtering precision.
  1122. @table @samp
  1123. @item dbl
  1124. double-precision floating-point (default)
  1125. @item flt
  1126. single-precision floating-point
  1127. @item i32
  1128. 32-bit integers
  1129. @item i16
  1130. 16-bit integers
  1131. @end table
  1132. @item normalize, n
  1133. Normalize filter coefficients, by default is enabled.
  1134. Enabling it will normalize magnitude response at DC to 0dB.
  1135. @item mix
  1136. How much to use filtered signal in output. Default is 1.
  1137. Range is between 0 and 1.
  1138. @item response
  1139. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1140. By default it is disabled.
  1141. @item channel
  1142. Set for which IR channel to display frequency response. By default is first channel
  1143. displayed. This option is used only when @var{response} is enabled.
  1144. @item size
  1145. Set video stream size. This option is used only when @var{response} is enabled.
  1146. @end table
  1147. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1148. order.
  1149. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1150. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1151. imaginary unit.
  1152. Different coefficients and gains can be provided for every channel, in such case
  1153. use '|' to separate coefficients or gains. Last provided coefficients will be
  1154. used for all remaining channels.
  1155. @subsection Examples
  1156. @itemize
  1157. @item
  1158. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1159. @example
  1160. 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
  1161. @end example
  1162. @item
  1163. Same as above but in @code{zp} format:
  1164. @example
  1165. 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
  1166. @end example
  1167. @item
  1168. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1169. @example
  1170. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1171. @end example
  1172. @end itemize
  1173. @section alimiter
  1174. The limiter prevents an input signal from rising over a desired threshold.
  1175. This limiter uses lookahead technology to prevent your signal from distorting.
  1176. It means that there is a small delay after the signal is processed. Keep in mind
  1177. that the delay it produces is the attack time you set.
  1178. The filter accepts the following options:
  1179. @table @option
  1180. @item level_in
  1181. Set input gain. Default is 1.
  1182. @item level_out
  1183. Set output gain. Default is 1.
  1184. @item limit
  1185. Don't let signals above this level pass the limiter. Default is 1.
  1186. @item attack
  1187. The limiter will reach its attenuation level in this amount of time in
  1188. milliseconds. Default is 5 milliseconds.
  1189. @item release
  1190. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1191. Default is 50 milliseconds.
  1192. @item asc
  1193. When gain reduction is always needed ASC takes care of releasing to an
  1194. average reduction level rather than reaching a reduction of 0 in the release
  1195. time.
  1196. @item asc_level
  1197. Select how much the release time is affected by ASC, 0 means nearly no changes
  1198. in release time while 1 produces higher release times.
  1199. @item level
  1200. Auto level output signal. Default is enabled.
  1201. This normalizes audio back to 0dB if enabled.
  1202. @end table
  1203. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1204. with @ref{aresample} before applying this filter.
  1205. @section allpass
  1206. Apply a two-pole all-pass filter with central frequency (in Hz)
  1207. @var{frequency}, and filter-width @var{width}.
  1208. An all-pass filter changes the audio's frequency to phase relationship
  1209. without changing its frequency to amplitude relationship.
  1210. The filter accepts the following options:
  1211. @table @option
  1212. @item frequency, f
  1213. Set frequency in Hz.
  1214. @item width_type, t
  1215. Set method to specify band-width of filter.
  1216. @table @option
  1217. @item h
  1218. Hz
  1219. @item q
  1220. Q-Factor
  1221. @item o
  1222. octave
  1223. @item s
  1224. slope
  1225. @item k
  1226. kHz
  1227. @end table
  1228. @item width, w
  1229. Specify the band-width of a filter in width_type units.
  1230. @item mix, m
  1231. How much to use filtered signal in output. Default is 1.
  1232. Range is between 0 and 1.
  1233. @item channels, c
  1234. Specify which channels to filter, by default all available are filtered.
  1235. @item normalize, n
  1236. Normalize biquad coefficients, by default is disabled.
  1237. Enabling it will normalize magnitude response at DC to 0dB.
  1238. @item order, o
  1239. Set the filter order, can be 1 or 2. Default is 2.
  1240. @item transform, a
  1241. Set transform type of IIR filter.
  1242. @table @option
  1243. @item di
  1244. @item dii
  1245. @item tdii
  1246. @end table
  1247. @end table
  1248. @subsection Commands
  1249. This filter supports the following commands:
  1250. @table @option
  1251. @item frequency, f
  1252. Change allpass frequency.
  1253. Syntax for the command is : "@var{frequency}"
  1254. @item width_type, t
  1255. Change allpass width_type.
  1256. Syntax for the command is : "@var{width_type}"
  1257. @item width, w
  1258. Change allpass width.
  1259. Syntax for the command is : "@var{width}"
  1260. @item mix, m
  1261. Change allpass mix.
  1262. Syntax for the command is : "@var{mix}"
  1263. @end table
  1264. @section aloop
  1265. Loop audio samples.
  1266. The filter accepts the following options:
  1267. @table @option
  1268. @item loop
  1269. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1270. Default is 0.
  1271. @item size
  1272. Set maximal number of samples. Default is 0.
  1273. @item start
  1274. Set first sample of loop. Default is 0.
  1275. @end table
  1276. @anchor{amerge}
  1277. @section amerge
  1278. Merge two or more audio streams into a single multi-channel stream.
  1279. The filter accepts the following options:
  1280. @table @option
  1281. @item inputs
  1282. Set the number of inputs. Default is 2.
  1283. @end table
  1284. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1285. the channel layout of the output will be set accordingly and the channels
  1286. will be reordered as necessary. If the channel layouts of the inputs are not
  1287. disjoint, the output will have all the channels of the first input then all
  1288. the channels of the second input, in that order, and the channel layout of
  1289. the output will be the default value corresponding to the total number of
  1290. channels.
  1291. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1292. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1293. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1294. first input, b1 is the first channel of the second input).
  1295. On the other hand, if both input are in stereo, the output channels will be
  1296. in the default order: a1, a2, b1, b2, and the channel layout will be
  1297. arbitrarily set to 4.0, which may or may not be the expected value.
  1298. All inputs must have the same sample rate, and format.
  1299. If inputs do not have the same duration, the output will stop with the
  1300. shortest.
  1301. @subsection Examples
  1302. @itemize
  1303. @item
  1304. Merge two mono files into a stereo stream:
  1305. @example
  1306. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1307. @end example
  1308. @item
  1309. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1310. @example
  1311. 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
  1312. @end example
  1313. @end itemize
  1314. @section amix
  1315. Mixes multiple audio inputs into a single output.
  1316. Note that this filter only supports float samples (the @var{amerge}
  1317. and @var{pan} audio filters support many formats). If the @var{amix}
  1318. input has integer samples then @ref{aresample} will be automatically
  1319. inserted to perform the conversion to float samples.
  1320. For example
  1321. @example
  1322. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1323. @end example
  1324. will mix 3 input audio streams to a single output with the same duration as the
  1325. first input and a dropout transition time of 3 seconds.
  1326. It accepts the following parameters:
  1327. @table @option
  1328. @item inputs
  1329. The number of inputs. If unspecified, it defaults to 2.
  1330. @item duration
  1331. How to determine the end-of-stream.
  1332. @table @option
  1333. @item longest
  1334. The duration of the longest input. (default)
  1335. @item shortest
  1336. The duration of the shortest input.
  1337. @item first
  1338. The duration of the first input.
  1339. @end table
  1340. @item dropout_transition
  1341. The transition time, in seconds, for volume renormalization when an input
  1342. stream ends. The default value is 2 seconds.
  1343. @item weights
  1344. Specify weight of each input audio stream as sequence.
  1345. Each weight is separated by space. By default all inputs have same weight.
  1346. @end table
  1347. @subsection Commands
  1348. This filter supports the following commands:
  1349. @table @option
  1350. @item weights
  1351. Syntax is same as option with same name.
  1352. @end table
  1353. @section amultiply
  1354. Multiply first audio stream with second audio stream and store result
  1355. in output audio stream. Multiplication is done by multiplying each
  1356. sample from first stream with sample at same position from second stream.
  1357. With this element-wise multiplication one can create amplitude fades and
  1358. amplitude modulations.
  1359. @section anequalizer
  1360. High-order parametric multiband equalizer for each channel.
  1361. It accepts the following parameters:
  1362. @table @option
  1363. @item params
  1364. This option string is in format:
  1365. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1366. Each equalizer band is separated by '|'.
  1367. @table @option
  1368. @item chn
  1369. Set channel number to which equalization will be applied.
  1370. If input doesn't have that channel the entry is ignored.
  1371. @item f
  1372. Set central frequency for band.
  1373. If input doesn't have that frequency the entry is ignored.
  1374. @item w
  1375. Set band width in hertz.
  1376. @item g
  1377. Set band gain in dB.
  1378. @item t
  1379. Set filter type for band, optional, can be:
  1380. @table @samp
  1381. @item 0
  1382. Butterworth, this is default.
  1383. @item 1
  1384. Chebyshev type 1.
  1385. @item 2
  1386. Chebyshev type 2.
  1387. @end table
  1388. @end table
  1389. @item curves
  1390. With this option activated frequency response of anequalizer is displayed
  1391. in video stream.
  1392. @item size
  1393. Set video stream size. Only useful if curves option is activated.
  1394. @item mgain
  1395. Set max gain that will be displayed. Only useful if curves option is activated.
  1396. Setting this to a reasonable value makes it possible to display gain which is derived from
  1397. neighbour bands which are too close to each other and thus produce higher gain
  1398. when both are activated.
  1399. @item fscale
  1400. Set frequency scale used to draw frequency response in video output.
  1401. Can be linear or logarithmic. Default is logarithmic.
  1402. @item colors
  1403. Set color for each channel curve which is going to be displayed in video stream.
  1404. This is list of color names separated by space or by '|'.
  1405. Unrecognised or missing colors will be replaced by white color.
  1406. @end table
  1407. @subsection Examples
  1408. @itemize
  1409. @item
  1410. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1411. for first 2 channels using Chebyshev type 1 filter:
  1412. @example
  1413. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1414. @end example
  1415. @end itemize
  1416. @subsection Commands
  1417. This filter supports the following commands:
  1418. @table @option
  1419. @item change
  1420. Alter existing filter parameters.
  1421. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1422. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1423. error is returned.
  1424. @var{freq} set new frequency parameter.
  1425. @var{width} set new width parameter in herz.
  1426. @var{gain} set new gain parameter in dB.
  1427. Full filter invocation with asendcmd may look like this:
  1428. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1429. @end table
  1430. @section anlmdn
  1431. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1432. Each sample is adjusted by looking for other samples with similar contexts. This
  1433. context similarity is defined by comparing their surrounding patches of size
  1434. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1435. The filter accepts the following options:
  1436. @table @option
  1437. @item s
  1438. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1439. @item p
  1440. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1441. Default value is 2 milliseconds.
  1442. @item r
  1443. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1444. Default value is 6 milliseconds.
  1445. @item o
  1446. Set the output mode.
  1447. It accepts the following values:
  1448. @table @option
  1449. @item i
  1450. Pass input unchanged.
  1451. @item o
  1452. Pass noise filtered out.
  1453. @item n
  1454. Pass only noise.
  1455. Default value is @var{o}.
  1456. @end table
  1457. @item m
  1458. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1459. @end table
  1460. @subsection Commands
  1461. This filter supports the following commands:
  1462. @table @option
  1463. @item s
  1464. Change denoise strength. Argument is single float number.
  1465. Syntax for the command is : "@var{s}"
  1466. @item o
  1467. Change output mode.
  1468. Syntax for the command is : "i", "o" or "n" string.
  1469. @end table
  1470. @section anlms
  1471. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1472. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1473. relate to producing the least mean square of the error signal (difference between the desired,
  1474. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1475. A description of the accepted options follows.
  1476. @table @option
  1477. @item order
  1478. Set filter order.
  1479. @item mu
  1480. Set filter mu.
  1481. @item eps
  1482. Set the filter eps.
  1483. @item leakage
  1484. Set the filter leakage.
  1485. @item out_mode
  1486. It accepts the following values:
  1487. @table @option
  1488. @item i
  1489. Pass the 1st input.
  1490. @item d
  1491. Pass the 2nd input.
  1492. @item o
  1493. Pass filtered samples.
  1494. @item n
  1495. Pass difference between desired and filtered samples.
  1496. Default value is @var{o}.
  1497. @end table
  1498. @end table
  1499. @subsection Examples
  1500. @itemize
  1501. @item
  1502. One of many usages of this filter is noise reduction, input audio is filtered
  1503. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1504. @example
  1505. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1506. @end example
  1507. @end itemize
  1508. @subsection Commands
  1509. This filter supports the same commands as options, excluding option @code{order}.
  1510. @section anull
  1511. Pass the audio source unchanged to the output.
  1512. @section apad
  1513. Pad the end of an audio stream with silence.
  1514. This can be used together with @command{ffmpeg} @option{-shortest} to
  1515. extend audio streams to the same length as the video stream.
  1516. A description of the accepted options follows.
  1517. @table @option
  1518. @item packet_size
  1519. Set silence packet size. Default value is 4096.
  1520. @item pad_len
  1521. Set the number of samples of silence to add to the end. After the
  1522. value is reached, the stream is terminated. This option is mutually
  1523. exclusive with @option{whole_len}.
  1524. @item whole_len
  1525. Set the minimum total number of samples in the output audio stream. If
  1526. the value is longer than the input audio length, silence is added to
  1527. the end, until the value is reached. This option is mutually exclusive
  1528. with @option{pad_len}.
  1529. @item pad_dur
  1530. Specify the duration of samples of silence to add. See
  1531. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1532. for the accepted syntax. Used only if set to non-zero value.
  1533. @item whole_dur
  1534. Specify the minimum total duration in the output audio stream. See
  1535. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1536. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1537. the input audio length, silence is added to the end, until the value is reached.
  1538. This option is mutually exclusive with @option{pad_dur}
  1539. @end table
  1540. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1541. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1542. the input stream indefinitely.
  1543. @subsection Examples
  1544. @itemize
  1545. @item
  1546. Add 1024 samples of silence to the end of the input:
  1547. @example
  1548. apad=pad_len=1024
  1549. @end example
  1550. @item
  1551. Make sure the audio output will contain at least 10000 samples, pad
  1552. the input with silence if required:
  1553. @example
  1554. apad=whole_len=10000
  1555. @end example
  1556. @item
  1557. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1558. video stream will always result the shortest and will be converted
  1559. until the end in the output file when using the @option{shortest}
  1560. option:
  1561. @example
  1562. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1563. @end example
  1564. @end itemize
  1565. @section aphaser
  1566. Add a phasing effect to the input audio.
  1567. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1568. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1569. A description of the accepted parameters follows.
  1570. @table @option
  1571. @item in_gain
  1572. Set input gain. Default is 0.4.
  1573. @item out_gain
  1574. Set output gain. Default is 0.74
  1575. @item delay
  1576. Set delay in milliseconds. Default is 3.0.
  1577. @item decay
  1578. Set decay. Default is 0.4.
  1579. @item speed
  1580. Set modulation speed in Hz. Default is 0.5.
  1581. @item type
  1582. Set modulation type. Default is triangular.
  1583. It accepts the following values:
  1584. @table @samp
  1585. @item triangular, t
  1586. @item sinusoidal, s
  1587. @end table
  1588. @end table
  1589. @section aphaseshift
  1590. Apply phase shift to input audio samples.
  1591. The filter accepts the following options:
  1592. @table @option
  1593. @item shift
  1594. Specify phase shift. Allowed range is from -1.0 to 1.0.
  1595. Default value is 0.0.
  1596. @end table
  1597. @subsection Commands
  1598. This filter supports the above option as @ref{commands}.
  1599. @section apulsator
  1600. Audio pulsator is something between an autopanner and a tremolo.
  1601. But it can produce funny stereo effects as well. Pulsator changes the volume
  1602. of the left and right channel based on a LFO (low frequency oscillator) with
  1603. different waveforms and shifted phases.
  1604. This filter have the ability to define an offset between left and right
  1605. channel. An offset of 0 means that both LFO shapes match each other.
  1606. The left and right channel are altered equally - a conventional tremolo.
  1607. An offset of 50% means that the shape of the right channel is exactly shifted
  1608. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1609. an autopanner. At 1 both curves match again. Every setting in between moves the
  1610. phase shift gapless between all stages and produces some "bypassing" sounds with
  1611. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1612. the 0.5) the faster the signal passes from the left to the right speaker.
  1613. The filter accepts the following options:
  1614. @table @option
  1615. @item level_in
  1616. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1617. @item level_out
  1618. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1619. @item mode
  1620. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1621. sawup or sawdown. Default is sine.
  1622. @item amount
  1623. Set modulation. Define how much of original signal is affected by the LFO.
  1624. @item offset_l
  1625. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1626. @item offset_r
  1627. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1628. @item width
  1629. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1630. @item timing
  1631. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1632. @item bpm
  1633. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1634. is set to bpm.
  1635. @item ms
  1636. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1637. is set to ms.
  1638. @item hz
  1639. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1640. if timing is set to hz.
  1641. @end table
  1642. @anchor{aresample}
  1643. @section aresample
  1644. Resample the input audio to the specified parameters, using the
  1645. libswresample library. If none are specified then the filter will
  1646. automatically convert between its input and output.
  1647. This filter is also able to stretch/squeeze the audio data to make it match
  1648. the timestamps or to inject silence / cut out audio to make it match the
  1649. timestamps, do a combination of both or do neither.
  1650. The filter accepts the syntax
  1651. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1652. expresses a sample rate and @var{resampler_options} is a list of
  1653. @var{key}=@var{value} pairs, separated by ":". See the
  1654. @ref{Resampler Options,,"Resampler Options" section in the
  1655. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1656. for the complete list of supported options.
  1657. @subsection Examples
  1658. @itemize
  1659. @item
  1660. Resample the input audio to 44100Hz:
  1661. @example
  1662. aresample=44100
  1663. @end example
  1664. @item
  1665. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1666. samples per second compensation:
  1667. @example
  1668. aresample=async=1000
  1669. @end example
  1670. @end itemize
  1671. @section areverse
  1672. Reverse an audio clip.
  1673. Warning: This filter requires memory to buffer the entire clip, so trimming
  1674. is suggested.
  1675. @subsection Examples
  1676. @itemize
  1677. @item
  1678. Take the first 5 seconds of a clip, and reverse it.
  1679. @example
  1680. atrim=end=5,areverse
  1681. @end example
  1682. @end itemize
  1683. @section arnndn
  1684. Reduce noise from speech using Recurrent Neural Networks.
  1685. This filter accepts the following options:
  1686. @table @option
  1687. @item model, m
  1688. Set train model file to load. This option is always required.
  1689. @end table
  1690. @section asetnsamples
  1691. Set the number of samples per each output audio frame.
  1692. The last output packet may contain a different number of samples, as
  1693. the filter will flush all the remaining samples when the input audio
  1694. signals its end.
  1695. The filter accepts the following options:
  1696. @table @option
  1697. @item nb_out_samples, n
  1698. Set the number of frames per each output audio frame. The number is
  1699. intended as the number of samples @emph{per each channel}.
  1700. Default value is 1024.
  1701. @item pad, p
  1702. If set to 1, the filter will pad the last audio frame with zeroes, so
  1703. that the last frame will contain the same number of samples as the
  1704. previous ones. Default value is 1.
  1705. @end table
  1706. For example, to set the number of per-frame samples to 1234 and
  1707. disable padding for the last frame, use:
  1708. @example
  1709. asetnsamples=n=1234:p=0
  1710. @end example
  1711. @section asetrate
  1712. Set the sample rate without altering the PCM data.
  1713. This will result in a change of speed and pitch.
  1714. The filter accepts the following options:
  1715. @table @option
  1716. @item sample_rate, r
  1717. Set the output sample rate. Default is 44100 Hz.
  1718. @end table
  1719. @section ashowinfo
  1720. Show a line containing various information for each input audio frame.
  1721. The input audio is not modified.
  1722. The shown line contains a sequence of key/value pairs of the form
  1723. @var{key}:@var{value}.
  1724. The following values are shown in the output:
  1725. @table @option
  1726. @item n
  1727. The (sequential) number of the input frame, starting from 0.
  1728. @item pts
  1729. The presentation timestamp of the input frame, in time base units; the time base
  1730. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1731. @item pts_time
  1732. The presentation timestamp of the input frame in seconds.
  1733. @item pos
  1734. position of the frame in the input stream, -1 if this information in
  1735. unavailable and/or meaningless (for example in case of synthetic audio)
  1736. @item fmt
  1737. The sample format.
  1738. @item chlayout
  1739. The channel layout.
  1740. @item rate
  1741. The sample rate for the audio frame.
  1742. @item nb_samples
  1743. The number of samples (per channel) in the frame.
  1744. @item checksum
  1745. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1746. audio, the data is treated as if all the planes were concatenated.
  1747. @item plane_checksums
  1748. A list of Adler-32 checksums for each data plane.
  1749. @end table
  1750. @section asoftclip
  1751. Apply audio soft clipping.
  1752. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1753. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1754. This filter accepts the following options:
  1755. @table @option
  1756. @item type
  1757. Set type of soft-clipping.
  1758. It accepts the following values:
  1759. @table @option
  1760. @item tanh
  1761. @item atan
  1762. @item cubic
  1763. @item exp
  1764. @item alg
  1765. @item quintic
  1766. @item sin
  1767. @end table
  1768. @item param
  1769. Set additional parameter which controls sigmoid function.
  1770. @end table
  1771. @subsection Commands
  1772. This filter supports the all above options as @ref{commands}.
  1773. @section asr
  1774. Automatic Speech Recognition
  1775. This filter uses PocketSphinx for speech recognition. To enable
  1776. compilation of this filter, you need to configure FFmpeg with
  1777. @code{--enable-pocketsphinx}.
  1778. It accepts the following options:
  1779. @table @option
  1780. @item rate
  1781. Set sampling rate of input audio. Defaults is @code{16000}.
  1782. This need to match speech models, otherwise one will get poor results.
  1783. @item hmm
  1784. Set dictionary containing acoustic model files.
  1785. @item dict
  1786. Set pronunciation dictionary.
  1787. @item lm
  1788. Set language model file.
  1789. @item lmctl
  1790. Set language model set.
  1791. @item lmname
  1792. Set which language model to use.
  1793. @item logfn
  1794. Set output for log messages.
  1795. @end table
  1796. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1797. @anchor{astats}
  1798. @section astats
  1799. Display time domain statistical information about the audio channels.
  1800. Statistics are calculated and displayed for each audio channel and,
  1801. where applicable, an overall figure is also given.
  1802. It accepts the following option:
  1803. @table @option
  1804. @item length
  1805. Short window length in seconds, used for peak and trough RMS measurement.
  1806. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1807. @item metadata
  1808. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1809. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1810. disabled.
  1811. Available keys for each channel are:
  1812. DC_offset
  1813. Min_level
  1814. Max_level
  1815. Min_difference
  1816. Max_difference
  1817. Mean_difference
  1818. RMS_difference
  1819. Peak_level
  1820. RMS_peak
  1821. RMS_trough
  1822. Crest_factor
  1823. Flat_factor
  1824. Peak_count
  1825. Noise_floor
  1826. Noise_floor_count
  1827. Bit_depth
  1828. Dynamic_range
  1829. Zero_crossings
  1830. Zero_crossings_rate
  1831. Number_of_NaNs
  1832. Number_of_Infs
  1833. Number_of_denormals
  1834. and for Overall:
  1835. DC_offset
  1836. Min_level
  1837. Max_level
  1838. Min_difference
  1839. Max_difference
  1840. Mean_difference
  1841. RMS_difference
  1842. Peak_level
  1843. RMS_level
  1844. RMS_peak
  1845. RMS_trough
  1846. Flat_factor
  1847. Peak_count
  1848. Noise_floor
  1849. Noise_floor_count
  1850. Bit_depth
  1851. Number_of_samples
  1852. Number_of_NaNs
  1853. Number_of_Infs
  1854. Number_of_denormals
  1855. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1856. this @code{lavfi.astats.Overall.Peak_count}.
  1857. For description what each key means read below.
  1858. @item reset
  1859. Set number of frame after which stats are going to be recalculated.
  1860. Default is disabled.
  1861. @item measure_perchannel
  1862. Select the entries which need to be measured per channel. The metadata keys can
  1863. be used as flags, default is @option{all} which measures everything.
  1864. @option{none} disables all per channel measurement.
  1865. @item measure_overall
  1866. Select the entries which need to be measured overall. The metadata keys can
  1867. be used as flags, default is @option{all} which measures everything.
  1868. @option{none} disables all overall measurement.
  1869. @end table
  1870. A description of each shown parameter follows:
  1871. @table @option
  1872. @item DC offset
  1873. Mean amplitude displacement from zero.
  1874. @item Min level
  1875. Minimal sample level.
  1876. @item Max level
  1877. Maximal sample level.
  1878. @item Min difference
  1879. Minimal difference between two consecutive samples.
  1880. @item Max difference
  1881. Maximal difference between two consecutive samples.
  1882. @item Mean difference
  1883. Mean difference between two consecutive samples.
  1884. The average of each difference between two consecutive samples.
  1885. @item RMS difference
  1886. Root Mean Square difference between two consecutive samples.
  1887. @item Peak level dB
  1888. @item RMS level dB
  1889. Standard peak and RMS level measured in dBFS.
  1890. @item RMS peak dB
  1891. @item RMS trough dB
  1892. Peak and trough values for RMS level measured over a short window.
  1893. @item Crest factor
  1894. Standard ratio of peak to RMS level (note: not in dB).
  1895. @item Flat factor
  1896. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1897. (i.e. either @var{Min level} or @var{Max level}).
  1898. @item Peak count
  1899. Number of occasions (not the number of samples) that the signal attained either
  1900. @var{Min level} or @var{Max level}.
  1901. @item Noise floor dB
  1902. Minimum local peak measured in dBFS over a short window.
  1903. @item Noise floor count
  1904. Number of occasions (not the number of samples) that the signal attained
  1905. @var{Noise floor}.
  1906. @item Bit depth
  1907. Overall bit depth of audio. Number of bits used for each sample.
  1908. @item Dynamic range
  1909. Measured dynamic range of audio in dB.
  1910. @item Zero crossings
  1911. Number of points where the waveform crosses the zero level axis.
  1912. @item Zero crossings rate
  1913. Rate of Zero crossings and number of audio samples.
  1914. @end table
  1915. @section asubboost
  1916. Boost subwoofer frequencies.
  1917. The filter accepts the following options:
  1918. @table @option
  1919. @item dry
  1920. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  1921. Default value is 0.5.
  1922. @item wet
  1923. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  1924. Default value is 0.8.
  1925. @item decay
  1926. Set delay line decay gain value. Allowed range is from 0 to 1.
  1927. Default value is 0.7.
  1928. @item feedback
  1929. Set delay line feedback gain value. Allowed range is from 0 to 1.
  1930. Default value is 0.5.
  1931. @item cutoff
  1932. Set cutoff frequency in herz. Allowed range is 50 to 900.
  1933. Default value is 100.
  1934. @item slope
  1935. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  1936. Default value is 0.5.
  1937. @item delay
  1938. Set delay. Allowed range is from 1 to 100.
  1939. Default value is 20.
  1940. @end table
  1941. @subsection Commands
  1942. This filter supports the all above options as @ref{commands}.
  1943. @section atempo
  1944. Adjust audio tempo.
  1945. The filter accepts exactly one parameter, the audio tempo. If not
  1946. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1947. be in the [0.5, 100.0] range.
  1948. Note that tempo greater than 2 will skip some samples rather than
  1949. blend them in. If for any reason this is a concern it is always
  1950. possible to daisy-chain several instances of atempo to achieve the
  1951. desired product tempo.
  1952. @subsection Examples
  1953. @itemize
  1954. @item
  1955. Slow down audio to 80% tempo:
  1956. @example
  1957. atempo=0.8
  1958. @end example
  1959. @item
  1960. To speed up audio to 300% tempo:
  1961. @example
  1962. atempo=3
  1963. @end example
  1964. @item
  1965. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1966. @example
  1967. atempo=sqrt(3),atempo=sqrt(3)
  1968. @end example
  1969. @end itemize
  1970. @subsection Commands
  1971. This filter supports the following commands:
  1972. @table @option
  1973. @item tempo
  1974. Change filter tempo scale factor.
  1975. Syntax for the command is : "@var{tempo}"
  1976. @end table
  1977. @section atrim
  1978. Trim the input so that the output contains one continuous subpart of the input.
  1979. It accepts the following parameters:
  1980. @table @option
  1981. @item start
  1982. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1983. sample with the timestamp @var{start} will be the first sample in the output.
  1984. @item end
  1985. Specify time of the first audio sample that will be dropped, i.e. the
  1986. audio sample immediately preceding the one with the timestamp @var{end} will be
  1987. the last sample in the output.
  1988. @item start_pts
  1989. Same as @var{start}, except this option sets the start timestamp in samples
  1990. instead of seconds.
  1991. @item end_pts
  1992. Same as @var{end}, except this option sets the end timestamp in samples instead
  1993. of seconds.
  1994. @item duration
  1995. The maximum duration of the output in seconds.
  1996. @item start_sample
  1997. The number of the first sample that should be output.
  1998. @item end_sample
  1999. The number of the first sample that should be dropped.
  2000. @end table
  2001. @option{start}, @option{end}, and @option{duration} are expressed as time
  2002. duration specifications; see
  2003. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2004. Note that the first two sets of the start/end options and the @option{duration}
  2005. option look at the frame timestamp, while the _sample options simply count the
  2006. samples that pass through the filter. So start/end_pts and start/end_sample will
  2007. give different results when the timestamps are wrong, inexact or do not start at
  2008. zero. Also note that this filter does not modify the timestamps. If you wish
  2009. to have the output timestamps start at zero, insert the asetpts filter after the
  2010. atrim filter.
  2011. If multiple start or end options are set, this filter tries to be greedy and
  2012. keep all samples that match at least one of the specified constraints. To keep
  2013. only the part that matches all the constraints at once, chain multiple atrim
  2014. filters.
  2015. The defaults are such that all the input is kept. So it is possible to set e.g.
  2016. just the end values to keep everything before the specified time.
  2017. Examples:
  2018. @itemize
  2019. @item
  2020. Drop everything except the second minute of input:
  2021. @example
  2022. ffmpeg -i INPUT -af atrim=60:120
  2023. @end example
  2024. @item
  2025. Keep only the first 1000 samples:
  2026. @example
  2027. ffmpeg -i INPUT -af atrim=end_sample=1000
  2028. @end example
  2029. @end itemize
  2030. @section axcorrelate
  2031. Calculate normalized cross-correlation between two input audio streams.
  2032. Resulted samples are always between -1 and 1 inclusive.
  2033. If result is 1 it means two input samples are highly correlated in that selected segment.
  2034. Result 0 means they are not correlated at all.
  2035. If result is -1 it means two input samples are out of phase, which means they cancel each
  2036. other.
  2037. The filter accepts the following options:
  2038. @table @option
  2039. @item size
  2040. Set size of segment over which cross-correlation is calculated.
  2041. Default is 256. Allowed range is from 2 to 131072.
  2042. @item algo
  2043. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2044. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2045. are always zero and thus need much less calculations to make.
  2046. This is generally not true, but is valid for typical audio streams.
  2047. @end table
  2048. @subsection Examples
  2049. @itemize
  2050. @item
  2051. Calculate correlation between channels in stereo audio stream:
  2052. @example
  2053. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2054. @end example
  2055. @end itemize
  2056. @section bandpass
  2057. Apply a two-pole Butterworth band-pass filter with central
  2058. frequency @var{frequency}, and (3dB-point) band-width width.
  2059. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2060. instead of the default: constant 0dB peak gain.
  2061. The filter roll off at 6dB per octave (20dB per decade).
  2062. The filter accepts the following options:
  2063. @table @option
  2064. @item frequency, f
  2065. Set the filter's central frequency. Default is @code{3000}.
  2066. @item csg
  2067. Constant skirt gain if set to 1. Defaults to 0.
  2068. @item width_type, t
  2069. Set method to specify band-width of filter.
  2070. @table @option
  2071. @item h
  2072. Hz
  2073. @item q
  2074. Q-Factor
  2075. @item o
  2076. octave
  2077. @item s
  2078. slope
  2079. @item k
  2080. kHz
  2081. @end table
  2082. @item width, w
  2083. Specify the band-width of a filter in width_type units.
  2084. @item mix, m
  2085. How much to use filtered signal in output. Default is 1.
  2086. Range is between 0 and 1.
  2087. @item channels, c
  2088. Specify which channels to filter, by default all available are filtered.
  2089. @item normalize, n
  2090. Normalize biquad coefficients, by default is disabled.
  2091. Enabling it will normalize magnitude response at DC to 0dB.
  2092. @item transform, a
  2093. Set transform type of IIR filter.
  2094. @table @option
  2095. @item di
  2096. @item dii
  2097. @item tdii
  2098. @end table
  2099. @end table
  2100. @subsection Commands
  2101. This filter supports the following commands:
  2102. @table @option
  2103. @item frequency, f
  2104. Change bandpass frequency.
  2105. Syntax for the command is : "@var{frequency}"
  2106. @item width_type, t
  2107. Change bandpass width_type.
  2108. Syntax for the command is : "@var{width_type}"
  2109. @item width, w
  2110. Change bandpass width.
  2111. Syntax for the command is : "@var{width}"
  2112. @item mix, m
  2113. Change bandpass mix.
  2114. Syntax for the command is : "@var{mix}"
  2115. @end table
  2116. @section bandreject
  2117. Apply a two-pole Butterworth band-reject filter with central
  2118. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2119. The filter roll off at 6dB per octave (20dB per decade).
  2120. The filter accepts the following options:
  2121. @table @option
  2122. @item frequency, f
  2123. Set the filter's central frequency. Default is @code{3000}.
  2124. @item width_type, t
  2125. Set method to specify band-width of filter.
  2126. @table @option
  2127. @item h
  2128. Hz
  2129. @item q
  2130. Q-Factor
  2131. @item o
  2132. octave
  2133. @item s
  2134. slope
  2135. @item k
  2136. kHz
  2137. @end table
  2138. @item width, w
  2139. Specify the band-width of a filter in width_type units.
  2140. @item mix, m
  2141. How much to use filtered signal in output. Default is 1.
  2142. Range is between 0 and 1.
  2143. @item channels, c
  2144. Specify which channels to filter, by default all available are filtered.
  2145. @item normalize, n
  2146. Normalize biquad coefficients, by default is disabled.
  2147. Enabling it will normalize magnitude response at DC to 0dB.
  2148. @item transform, a
  2149. Set transform type of IIR filter.
  2150. @table @option
  2151. @item di
  2152. @item dii
  2153. @item tdii
  2154. @end table
  2155. @end table
  2156. @subsection Commands
  2157. This filter supports the following commands:
  2158. @table @option
  2159. @item frequency, f
  2160. Change bandreject frequency.
  2161. Syntax for the command is : "@var{frequency}"
  2162. @item width_type, t
  2163. Change bandreject width_type.
  2164. Syntax for the command is : "@var{width_type}"
  2165. @item width, w
  2166. Change bandreject width.
  2167. Syntax for the command is : "@var{width}"
  2168. @item mix, m
  2169. Change bandreject mix.
  2170. Syntax for the command is : "@var{mix}"
  2171. @end table
  2172. @section bass, lowshelf
  2173. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2174. shelving filter with a response similar to that of a standard
  2175. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2176. The filter accepts the following options:
  2177. @table @option
  2178. @item gain, g
  2179. Give the gain at 0 Hz. Its useful range is about -20
  2180. (for a large cut) to +20 (for a large boost).
  2181. Beware of clipping when using a positive gain.
  2182. @item frequency, f
  2183. Set the filter's central frequency and so can be used
  2184. to extend or reduce the frequency range to be boosted or cut.
  2185. The default value is @code{100} Hz.
  2186. @item width_type, t
  2187. Set method to specify band-width of filter.
  2188. @table @option
  2189. @item h
  2190. Hz
  2191. @item q
  2192. Q-Factor
  2193. @item o
  2194. octave
  2195. @item s
  2196. slope
  2197. @item k
  2198. kHz
  2199. @end table
  2200. @item width, w
  2201. Determine how steep is the filter's shelf transition.
  2202. @item mix, m
  2203. How much to use filtered signal in output. Default is 1.
  2204. Range is between 0 and 1.
  2205. @item channels, c
  2206. Specify which channels to filter, by default all available are filtered.
  2207. @item normalize, n
  2208. Normalize biquad coefficients, by default is disabled.
  2209. Enabling it will normalize magnitude response at DC to 0dB.
  2210. @item transform, a
  2211. Set transform type of IIR filter.
  2212. @table @option
  2213. @item di
  2214. @item dii
  2215. @item tdii
  2216. @end table
  2217. @end table
  2218. @subsection Commands
  2219. This filter supports the following commands:
  2220. @table @option
  2221. @item frequency, f
  2222. Change bass frequency.
  2223. Syntax for the command is : "@var{frequency}"
  2224. @item width_type, t
  2225. Change bass width_type.
  2226. Syntax for the command is : "@var{width_type}"
  2227. @item width, w
  2228. Change bass width.
  2229. Syntax for the command is : "@var{width}"
  2230. @item gain, g
  2231. Change bass gain.
  2232. Syntax for the command is : "@var{gain}"
  2233. @item mix, m
  2234. Change bass mix.
  2235. Syntax for the command is : "@var{mix}"
  2236. @end table
  2237. @section biquad
  2238. Apply a biquad IIR filter with the given coefficients.
  2239. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2240. are the numerator and denominator coefficients respectively.
  2241. and @var{channels}, @var{c} specify which channels to filter, by default all
  2242. available are filtered.
  2243. @subsection Commands
  2244. This filter supports the following commands:
  2245. @table @option
  2246. @item a0
  2247. @item a1
  2248. @item a2
  2249. @item b0
  2250. @item b1
  2251. @item b2
  2252. Change biquad parameter.
  2253. Syntax for the command is : "@var{value}"
  2254. @item mix, m
  2255. How much to use filtered signal in output. Default is 1.
  2256. Range is between 0 and 1.
  2257. @item channels, c
  2258. Specify which channels to filter, by default all available are filtered.
  2259. @item normalize, n
  2260. Normalize biquad coefficients, by default is disabled.
  2261. Enabling it will normalize magnitude response at DC to 0dB.
  2262. @item transform, a
  2263. Set transform type of IIR filter.
  2264. @table @option
  2265. @item di
  2266. @item dii
  2267. @item tdii
  2268. @end table
  2269. @end table
  2270. @section bs2b
  2271. Bauer stereo to binaural transformation, which improves headphone listening of
  2272. stereo audio records.
  2273. To enable compilation of this filter you need to configure FFmpeg with
  2274. @code{--enable-libbs2b}.
  2275. It accepts the following parameters:
  2276. @table @option
  2277. @item profile
  2278. Pre-defined crossfeed level.
  2279. @table @option
  2280. @item default
  2281. Default level (fcut=700, feed=50).
  2282. @item cmoy
  2283. Chu Moy circuit (fcut=700, feed=60).
  2284. @item jmeier
  2285. Jan Meier circuit (fcut=650, feed=95).
  2286. @end table
  2287. @item fcut
  2288. Cut frequency (in Hz).
  2289. @item feed
  2290. Feed level (in Hz).
  2291. @end table
  2292. @section channelmap
  2293. Remap input channels to new locations.
  2294. It accepts the following parameters:
  2295. @table @option
  2296. @item map
  2297. Map channels from input to output. The argument is a '|'-separated list of
  2298. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2299. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2300. channel (e.g. FL for front left) or its index in the input channel layout.
  2301. @var{out_channel} is the name of the output channel or its index in the output
  2302. channel layout. If @var{out_channel} is not given then it is implicitly an
  2303. index, starting with zero and increasing by one for each mapping.
  2304. @item channel_layout
  2305. The channel layout of the output stream.
  2306. @end table
  2307. If no mapping is present, the filter will implicitly map input channels to
  2308. output channels, preserving indices.
  2309. @subsection Examples
  2310. @itemize
  2311. @item
  2312. For example, assuming a 5.1+downmix input MOV file,
  2313. @example
  2314. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2315. @end example
  2316. will create an output WAV file tagged as stereo from the downmix channels of
  2317. the input.
  2318. @item
  2319. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2320. @example
  2321. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2322. @end example
  2323. @end itemize
  2324. @section channelsplit
  2325. Split each channel from an input audio stream into a separate output stream.
  2326. It accepts the following parameters:
  2327. @table @option
  2328. @item channel_layout
  2329. The channel layout of the input stream. The default is "stereo".
  2330. @item channels
  2331. A channel layout describing the channels to be extracted as separate output streams
  2332. or "all" to extract each input channel as a separate stream. The default is "all".
  2333. Choosing channels not present in channel layout in the input will result in an error.
  2334. @end table
  2335. @subsection Examples
  2336. @itemize
  2337. @item
  2338. For example, assuming a stereo input MP3 file,
  2339. @example
  2340. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2341. @end example
  2342. will create an output Matroska file with two audio streams, one containing only
  2343. the left channel and the other the right channel.
  2344. @item
  2345. Split a 5.1 WAV file into per-channel files:
  2346. @example
  2347. ffmpeg -i in.wav -filter_complex
  2348. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2349. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2350. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2351. side_right.wav
  2352. @end example
  2353. @item
  2354. Extract only LFE from a 5.1 WAV file:
  2355. @example
  2356. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2357. -map '[LFE]' lfe.wav
  2358. @end example
  2359. @end itemize
  2360. @section chorus
  2361. Add a chorus effect to the audio.
  2362. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2363. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2364. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2365. The modulation depth defines the range the modulated delay is played before or after
  2366. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2367. sound tuned around the original one, like in a chorus where some vocals are slightly
  2368. off key.
  2369. It accepts the following parameters:
  2370. @table @option
  2371. @item in_gain
  2372. Set input gain. Default is 0.4.
  2373. @item out_gain
  2374. Set output gain. Default is 0.4.
  2375. @item delays
  2376. Set delays. A typical delay is around 40ms to 60ms.
  2377. @item decays
  2378. Set decays.
  2379. @item speeds
  2380. Set speeds.
  2381. @item depths
  2382. Set depths.
  2383. @end table
  2384. @subsection Examples
  2385. @itemize
  2386. @item
  2387. A single delay:
  2388. @example
  2389. chorus=0.7:0.9:55:0.4:0.25:2
  2390. @end example
  2391. @item
  2392. Two delays:
  2393. @example
  2394. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2395. @end example
  2396. @item
  2397. Fuller sounding chorus with three delays:
  2398. @example
  2399. 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
  2400. @end example
  2401. @end itemize
  2402. @section compand
  2403. Compress or expand the audio's dynamic range.
  2404. It accepts the following parameters:
  2405. @table @option
  2406. @item attacks
  2407. @item decays
  2408. A list of times in seconds for each channel over which the instantaneous level
  2409. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2410. increase of volume and @var{decays} refers to decrease of volume. For most
  2411. situations, the attack time (response to the audio getting louder) should be
  2412. shorter than the decay time, because the human ear is more sensitive to sudden
  2413. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2414. a typical value for decay is 0.8 seconds.
  2415. If specified number of attacks & decays is lower than number of channels, the last
  2416. set attack/decay will be used for all remaining channels.
  2417. @item points
  2418. A list of points for the transfer function, specified in dB relative to the
  2419. maximum possible signal amplitude. Each key points list must be defined using
  2420. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2421. @code{x0/y0 x1/y1 x2/y2 ....}
  2422. The input values must be in strictly increasing order but the transfer function
  2423. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2424. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2425. function are @code{-70/-70|-60/-20|1/0}.
  2426. @item soft-knee
  2427. Set the curve radius in dB for all joints. It defaults to 0.01.
  2428. @item gain
  2429. Set the additional gain in dB to be applied at all points on the transfer
  2430. function. This allows for easy adjustment of the overall gain.
  2431. It defaults to 0.
  2432. @item volume
  2433. Set an initial volume, in dB, to be assumed for each channel when filtering
  2434. starts. This permits the user to supply a nominal level initially, so that, for
  2435. example, a very large gain is not applied to initial signal levels before the
  2436. companding has begun to operate. A typical value for audio which is initially
  2437. quiet is -90 dB. It defaults to 0.
  2438. @item delay
  2439. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2440. delayed before being fed to the volume adjuster. Specifying a delay
  2441. approximately equal to the attack/decay times allows the filter to effectively
  2442. operate in predictive rather than reactive mode. It defaults to 0.
  2443. @end table
  2444. @subsection Examples
  2445. @itemize
  2446. @item
  2447. Make music with both quiet and loud passages suitable for listening to in a
  2448. noisy environment:
  2449. @example
  2450. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2451. @end example
  2452. Another example for audio with whisper and explosion parts:
  2453. @example
  2454. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2455. @end example
  2456. @item
  2457. A noise gate for when the noise is at a lower level than the signal:
  2458. @example
  2459. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2460. @end example
  2461. @item
  2462. Here is another noise gate, this time for when the noise is at a higher level
  2463. than the signal (making it, in some ways, similar to squelch):
  2464. @example
  2465. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2466. @end example
  2467. @item
  2468. 2:1 compression starting at -6dB:
  2469. @example
  2470. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2471. @end example
  2472. @item
  2473. 2:1 compression starting at -9dB:
  2474. @example
  2475. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2476. @end example
  2477. @item
  2478. 2:1 compression starting at -12dB:
  2479. @example
  2480. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2481. @end example
  2482. @item
  2483. 2:1 compression starting at -18dB:
  2484. @example
  2485. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2486. @end example
  2487. @item
  2488. 3:1 compression starting at -15dB:
  2489. @example
  2490. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2491. @end example
  2492. @item
  2493. Compressor/Gate:
  2494. @example
  2495. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2496. @end example
  2497. @item
  2498. Expander:
  2499. @example
  2500. 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
  2501. @end example
  2502. @item
  2503. Hard limiter at -6dB:
  2504. @example
  2505. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2506. @end example
  2507. @item
  2508. Hard limiter at -12dB:
  2509. @example
  2510. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2511. @end example
  2512. @item
  2513. Hard noise gate at -35 dB:
  2514. @example
  2515. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2516. @end example
  2517. @item
  2518. Soft limiter:
  2519. @example
  2520. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2521. @end example
  2522. @end itemize
  2523. @section compensationdelay
  2524. Compensation Delay Line is a metric based delay to compensate differing
  2525. positions of microphones or speakers.
  2526. For example, you have recorded guitar with two microphones placed in
  2527. different locations. Because the front of sound wave has fixed speed in
  2528. normal conditions, the phasing of microphones can vary and depends on
  2529. their location and interposition. The best sound mix can be achieved when
  2530. these microphones are in phase (synchronized). Note that a distance of
  2531. ~30 cm between microphones makes one microphone capture the signal in
  2532. antiphase to the other microphone. That makes the final mix sound moody.
  2533. This filter helps to solve phasing problems by adding different delays
  2534. to each microphone track and make them synchronized.
  2535. The best result can be reached when you take one track as base and
  2536. synchronize other tracks one by one with it.
  2537. Remember that synchronization/delay tolerance depends on sample rate, too.
  2538. Higher sample rates will give more tolerance.
  2539. The filter accepts the following parameters:
  2540. @table @option
  2541. @item mm
  2542. Set millimeters distance. This is compensation distance for fine tuning.
  2543. Default is 0.
  2544. @item cm
  2545. Set cm distance. This is compensation distance for tightening distance setup.
  2546. Default is 0.
  2547. @item m
  2548. Set meters distance. This is compensation distance for hard distance setup.
  2549. Default is 0.
  2550. @item dry
  2551. Set dry amount. Amount of unprocessed (dry) signal.
  2552. Default is 0.
  2553. @item wet
  2554. Set wet amount. Amount of processed (wet) signal.
  2555. Default is 1.
  2556. @item temp
  2557. Set temperature in degrees Celsius. This is the temperature of the environment.
  2558. Default is 20.
  2559. @end table
  2560. @section crossfeed
  2561. Apply headphone crossfeed filter.
  2562. Crossfeed is the process of blending the left and right channels of stereo
  2563. audio recording.
  2564. It is mainly used to reduce extreme stereo separation of low frequencies.
  2565. The intent is to produce more speaker like sound to the listener.
  2566. The filter accepts the following options:
  2567. @table @option
  2568. @item strength
  2569. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2570. This sets gain of low shelf filter for side part of stereo image.
  2571. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2572. @item range
  2573. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2574. This sets cut off frequency of low shelf filter. Default is cut off near
  2575. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2576. @item slope
  2577. Set curve slope of low shelf filter. Default is 0.5.
  2578. Allowed range is from 0.01 to 1.
  2579. @item level_in
  2580. Set input gain. Default is 0.9.
  2581. @item level_out
  2582. Set output gain. Default is 1.
  2583. @end table
  2584. @subsection Commands
  2585. This filter supports the all above options as @ref{commands}.
  2586. @section crystalizer
  2587. Simple algorithm to expand audio dynamic range.
  2588. The filter accepts the following options:
  2589. @table @option
  2590. @item i
  2591. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2592. (unchanged sound) to 10.0 (maximum effect).
  2593. @item c
  2594. Enable clipping. By default is enabled.
  2595. @end table
  2596. @subsection Commands
  2597. This filter supports the all above options as @ref{commands}.
  2598. @section dcshift
  2599. Apply a DC shift to the audio.
  2600. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2601. in the recording chain) from the audio. The effect of a DC offset is reduced
  2602. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2603. a signal has a DC offset.
  2604. @table @option
  2605. @item shift
  2606. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2607. the audio.
  2608. @item limitergain
  2609. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2610. used to prevent clipping.
  2611. @end table
  2612. @section deesser
  2613. Apply de-essing to the audio samples.
  2614. @table @option
  2615. @item i
  2616. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2617. Default is 0.
  2618. @item m
  2619. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2620. Default is 0.5.
  2621. @item f
  2622. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2623. Default is 0.5.
  2624. @item s
  2625. Set the output mode.
  2626. It accepts the following values:
  2627. @table @option
  2628. @item i
  2629. Pass input unchanged.
  2630. @item o
  2631. Pass ess filtered out.
  2632. @item e
  2633. Pass only ess.
  2634. Default value is @var{o}.
  2635. @end table
  2636. @end table
  2637. @section drmeter
  2638. Measure audio dynamic range.
  2639. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2640. is found in transition material. And anything less that 8 have very poor dynamics
  2641. and is very compressed.
  2642. The filter accepts the following options:
  2643. @table @option
  2644. @item length
  2645. Set window length in seconds used to split audio into segments of equal length.
  2646. Default is 3 seconds.
  2647. @end table
  2648. @section dynaudnorm
  2649. Dynamic Audio Normalizer.
  2650. This filter applies a certain amount of gain to the input audio in order
  2651. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2652. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2653. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2654. This allows for applying extra gain to the "quiet" sections of the audio
  2655. while avoiding distortions or clipping the "loud" sections. In other words:
  2656. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2657. sections, in the sense that the volume of each section is brought to the
  2658. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2659. this goal *without* applying "dynamic range compressing". It will retain 100%
  2660. of the dynamic range *within* each section of the audio file.
  2661. @table @option
  2662. @item framelen, f
  2663. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2664. Default is 500 milliseconds.
  2665. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2666. referred to as frames. This is required, because a peak magnitude has no
  2667. meaning for just a single sample value. Instead, we need to determine the
  2668. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2669. normalizer would simply use the peak magnitude of the complete file, the
  2670. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2671. frame. The length of a frame is specified in milliseconds. By default, the
  2672. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2673. been found to give good results with most files.
  2674. Note that the exact frame length, in number of samples, will be determined
  2675. automatically, based on the sampling rate of the individual input audio file.
  2676. @item gausssize, g
  2677. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2678. number. Default is 31.
  2679. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2680. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2681. is specified in frames, centered around the current frame. For the sake of
  2682. simplicity, this must be an odd number. Consequently, the default value of 31
  2683. takes into account the current frame, as well as the 15 preceding frames and
  2684. the 15 subsequent frames. Using a larger window results in a stronger
  2685. smoothing effect and thus in less gain variation, i.e. slower gain
  2686. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2687. effect and thus in more gain variation, i.e. faster gain adaptation.
  2688. In other words, the more you increase this value, the more the Dynamic Audio
  2689. Normalizer will behave like a "traditional" normalization filter. On the
  2690. contrary, the more you decrease this value, the more the Dynamic Audio
  2691. Normalizer will behave like a dynamic range compressor.
  2692. @item peak, p
  2693. Set the target peak value. This specifies the highest permissible magnitude
  2694. level for the normalized audio input. This filter will try to approach the
  2695. target peak magnitude as closely as possible, but at the same time it also
  2696. makes sure that the normalized signal will never exceed the peak magnitude.
  2697. A frame's maximum local gain factor is imposed directly by the target peak
  2698. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2699. It is not recommended to go above this value.
  2700. @item maxgain, m
  2701. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2702. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2703. factor for each input frame, i.e. the maximum gain factor that does not
  2704. result in clipping or distortion. The maximum gain factor is determined by
  2705. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2706. additionally bounds the frame's maximum gain factor by a predetermined
  2707. (global) maximum gain factor. This is done in order to avoid excessive gain
  2708. factors in "silent" or almost silent frames. By default, the maximum gain
  2709. factor is 10.0, For most inputs the default value should be sufficient and
  2710. it usually is not recommended to increase this value. Though, for input
  2711. with an extremely low overall volume level, it may be necessary to allow even
  2712. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2713. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2714. Instead, a "sigmoid" threshold function will be applied. This way, the
  2715. gain factors will smoothly approach the threshold value, but never exceed that
  2716. value.
  2717. @item targetrms, r
  2718. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2719. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2720. This means that the maximum local gain factor for each frame is defined
  2721. (only) by the frame's highest magnitude sample. This way, the samples can
  2722. be amplified as much as possible without exceeding the maximum signal
  2723. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2724. Normalizer can also take into account the frame's root mean square,
  2725. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2726. determine the power of a time-varying signal. It is therefore considered
  2727. that the RMS is a better approximation of the "perceived loudness" than
  2728. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2729. frames to a constant RMS value, a uniform "perceived loudness" can be
  2730. established. If a target RMS value has been specified, a frame's local gain
  2731. factor is defined as the factor that would result in exactly that RMS value.
  2732. Note, however, that the maximum local gain factor is still restricted by the
  2733. frame's highest magnitude sample, in order to prevent clipping.
  2734. @item coupling, n
  2735. Enable channels coupling. By default is enabled.
  2736. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2737. amount. This means the same gain factor will be applied to all channels, i.e.
  2738. the maximum possible gain factor is determined by the "loudest" channel.
  2739. However, in some recordings, it may happen that the volume of the different
  2740. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2741. In this case, this option can be used to disable the channel coupling. This way,
  2742. the gain factor will be determined independently for each channel, depending
  2743. only on the individual channel's highest magnitude sample. This allows for
  2744. harmonizing the volume of the different channels.
  2745. @item correctdc, c
  2746. Enable DC bias correction. By default is disabled.
  2747. An audio signal (in the time domain) is a sequence of sample values.
  2748. In the Dynamic Audio Normalizer these sample values are represented in the
  2749. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2750. audio signal, or "waveform", should be centered around the zero point.
  2751. That means if we calculate the mean value of all samples in a file, or in a
  2752. single frame, then the result should be 0.0 or at least very close to that
  2753. value. If, however, there is a significant deviation of the mean value from
  2754. 0.0, in either positive or negative direction, this is referred to as a
  2755. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2756. Audio Normalizer provides optional DC bias correction.
  2757. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2758. the mean value, or "DC correction" offset, of each input frame and subtract
  2759. that value from all of the frame's sample values which ensures those samples
  2760. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2761. boundaries, the DC correction offset values will be interpolated smoothly
  2762. between neighbouring frames.
  2763. @item altboundary, b
  2764. Enable alternative boundary mode. By default is disabled.
  2765. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2766. around each frame. This includes the preceding frames as well as the
  2767. subsequent frames. However, for the "boundary" frames, located at the very
  2768. beginning and at the very end of the audio file, not all neighbouring
  2769. frames are available. In particular, for the first few frames in the audio
  2770. file, the preceding frames are not known. And, similarly, for the last few
  2771. frames in the audio file, the subsequent frames are not known. Thus, the
  2772. question arises which gain factors should be assumed for the missing frames
  2773. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2774. to deal with this situation. The default boundary mode assumes a gain factor
  2775. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2776. "fade out" at the beginning and at the end of the input, respectively.
  2777. @item compress, s
  2778. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2779. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2780. compression. This means that signal peaks will not be pruned and thus the
  2781. full dynamic range will be retained within each local neighbourhood. However,
  2782. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2783. normalization algorithm with a more "traditional" compression.
  2784. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2785. (thresholding) function. If (and only if) the compression feature is enabled,
  2786. all input frames will be processed by a soft knee thresholding function prior
  2787. to the actual normalization process. Put simply, the thresholding function is
  2788. going to prune all samples whose magnitude exceeds a certain threshold value.
  2789. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2790. value. Instead, the threshold value will be adjusted for each individual
  2791. frame.
  2792. In general, smaller parameters result in stronger compression, and vice versa.
  2793. Values below 3.0 are not recommended, because audible distortion may appear.
  2794. @item threshold, t
  2795. Set the target threshold value. This specifies the lowest permissible
  2796. magnitude level for the audio input which will be normalized.
  2797. If input frame volume is above this value frame will be normalized.
  2798. Otherwise frame may not be normalized at all. The default value is set
  2799. to 0, which means all input frames will be normalized.
  2800. This option is mostly useful if digital noise is not wanted to be amplified.
  2801. @end table
  2802. @subsection Commands
  2803. This filter supports the all above options as @ref{commands}.
  2804. @section earwax
  2805. Make audio easier to listen to on headphones.
  2806. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2807. so that when listened to on headphones the stereo image is moved from
  2808. inside your head (standard for headphones) to outside and in front of
  2809. the listener (standard for speakers).
  2810. Ported from SoX.
  2811. @section equalizer
  2812. Apply a two-pole peaking equalisation (EQ) filter. With this
  2813. filter, the signal-level at and around a selected frequency can
  2814. be increased or decreased, whilst (unlike bandpass and bandreject
  2815. filters) that at all other frequencies is unchanged.
  2816. In order to produce complex equalisation curves, this filter can
  2817. be given several times, each with a different central frequency.
  2818. The filter accepts the following options:
  2819. @table @option
  2820. @item frequency, f
  2821. Set the filter's central frequency in Hz.
  2822. @item width_type, t
  2823. Set method to specify band-width of filter.
  2824. @table @option
  2825. @item h
  2826. Hz
  2827. @item q
  2828. Q-Factor
  2829. @item o
  2830. octave
  2831. @item s
  2832. slope
  2833. @item k
  2834. kHz
  2835. @end table
  2836. @item width, w
  2837. Specify the band-width of a filter in width_type units.
  2838. @item gain, g
  2839. Set the required gain or attenuation in dB.
  2840. Beware of clipping when using a positive gain.
  2841. @item mix, m
  2842. How much to use filtered signal in output. Default is 1.
  2843. Range is between 0 and 1.
  2844. @item channels, c
  2845. Specify which channels to filter, by default all available are filtered.
  2846. @item normalize, n
  2847. Normalize biquad coefficients, by default is disabled.
  2848. Enabling it will normalize magnitude response at DC to 0dB.
  2849. @item transform, a
  2850. Set transform type of IIR filter.
  2851. @table @option
  2852. @item di
  2853. @item dii
  2854. @item tdii
  2855. @end table
  2856. @end table
  2857. @subsection Examples
  2858. @itemize
  2859. @item
  2860. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2861. @example
  2862. equalizer=f=1000:t=h:width=200:g=-10
  2863. @end example
  2864. @item
  2865. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2866. @example
  2867. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2868. @end example
  2869. @end itemize
  2870. @subsection Commands
  2871. This filter supports the following commands:
  2872. @table @option
  2873. @item frequency, f
  2874. Change equalizer frequency.
  2875. Syntax for the command is : "@var{frequency}"
  2876. @item width_type, t
  2877. Change equalizer width_type.
  2878. Syntax for the command is : "@var{width_type}"
  2879. @item width, w
  2880. Change equalizer width.
  2881. Syntax for the command is : "@var{width}"
  2882. @item gain, g
  2883. Change equalizer gain.
  2884. Syntax for the command is : "@var{gain}"
  2885. @item mix, m
  2886. Change equalizer mix.
  2887. Syntax for the command is : "@var{mix}"
  2888. @end table
  2889. @section extrastereo
  2890. Linearly increases the difference between left and right channels which
  2891. adds some sort of "live" effect to playback.
  2892. The filter accepts the following options:
  2893. @table @option
  2894. @item m
  2895. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2896. (average of both channels), with 1.0 sound will be unchanged, with
  2897. -1.0 left and right channels will be swapped.
  2898. @item c
  2899. Enable clipping. By default is enabled.
  2900. @end table
  2901. @subsection Commands
  2902. This filter supports the all above options as @ref{commands}.
  2903. @section firequalizer
  2904. Apply FIR Equalization using arbitrary frequency response.
  2905. The filter accepts the following option:
  2906. @table @option
  2907. @item gain
  2908. Set gain curve equation (in dB). The expression can contain variables:
  2909. @table @option
  2910. @item f
  2911. the evaluated frequency
  2912. @item sr
  2913. sample rate
  2914. @item ch
  2915. channel number, set to 0 when multichannels evaluation is disabled
  2916. @item chid
  2917. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2918. multichannels evaluation is disabled
  2919. @item chs
  2920. number of channels
  2921. @item chlayout
  2922. channel_layout, see libavutil/channel_layout.h
  2923. @end table
  2924. and functions:
  2925. @table @option
  2926. @item gain_interpolate(f)
  2927. interpolate gain on frequency f based on gain_entry
  2928. @item cubic_interpolate(f)
  2929. same as gain_interpolate, but smoother
  2930. @end table
  2931. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2932. @item gain_entry
  2933. Set gain entry for gain_interpolate function. The expression can
  2934. contain functions:
  2935. @table @option
  2936. @item entry(f, g)
  2937. store gain entry at frequency f with value g
  2938. @end table
  2939. This option is also available as command.
  2940. @item delay
  2941. Set filter delay in seconds. Higher value means more accurate.
  2942. Default is @code{0.01}.
  2943. @item accuracy
  2944. Set filter accuracy in Hz. Lower value means more accurate.
  2945. Default is @code{5}.
  2946. @item wfunc
  2947. Set window function. Acceptable values are:
  2948. @table @option
  2949. @item rectangular
  2950. rectangular window, useful when gain curve is already smooth
  2951. @item hann
  2952. hann window (default)
  2953. @item hamming
  2954. hamming window
  2955. @item blackman
  2956. blackman window
  2957. @item nuttall3
  2958. 3-terms continuous 1st derivative nuttall window
  2959. @item mnuttall3
  2960. minimum 3-terms discontinuous nuttall window
  2961. @item nuttall
  2962. 4-terms continuous 1st derivative nuttall window
  2963. @item bnuttall
  2964. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2965. @item bharris
  2966. blackman-harris window
  2967. @item tukey
  2968. tukey window
  2969. @end table
  2970. @item fixed
  2971. If enabled, use fixed number of audio samples. This improves speed when
  2972. filtering with large delay. Default is disabled.
  2973. @item multi
  2974. Enable multichannels evaluation on gain. Default is disabled.
  2975. @item zero_phase
  2976. Enable zero phase mode by subtracting timestamp to compensate delay.
  2977. Default is disabled.
  2978. @item scale
  2979. Set scale used by gain. Acceptable values are:
  2980. @table @option
  2981. @item linlin
  2982. linear frequency, linear gain
  2983. @item linlog
  2984. linear frequency, logarithmic (in dB) gain (default)
  2985. @item loglin
  2986. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2987. @item loglog
  2988. logarithmic frequency, logarithmic gain
  2989. @end table
  2990. @item dumpfile
  2991. Set file for dumping, suitable for gnuplot.
  2992. @item dumpscale
  2993. Set scale for dumpfile. Acceptable values are same with scale option.
  2994. Default is linlog.
  2995. @item fft2
  2996. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2997. Default is disabled.
  2998. @item min_phase
  2999. Enable minimum phase impulse response. Default is disabled.
  3000. @end table
  3001. @subsection Examples
  3002. @itemize
  3003. @item
  3004. lowpass at 1000 Hz:
  3005. @example
  3006. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  3007. @end example
  3008. @item
  3009. lowpass at 1000 Hz with gain_entry:
  3010. @example
  3011. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  3012. @end example
  3013. @item
  3014. custom equalization:
  3015. @example
  3016. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  3017. @end example
  3018. @item
  3019. higher delay with zero phase to compensate delay:
  3020. @example
  3021. firequalizer=delay=0.1:fixed=on:zero_phase=on
  3022. @end example
  3023. @item
  3024. lowpass on left channel, highpass on right channel:
  3025. @example
  3026. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  3027. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  3028. @end example
  3029. @end itemize
  3030. @section flanger
  3031. Apply a flanging effect to the audio.
  3032. The filter accepts the following options:
  3033. @table @option
  3034. @item delay
  3035. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3036. @item depth
  3037. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3038. @item regen
  3039. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3040. Default value is 0.
  3041. @item width
  3042. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3043. Default value is 71.
  3044. @item speed
  3045. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3046. @item shape
  3047. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3048. Default value is @var{sinusoidal}.
  3049. @item phase
  3050. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3051. Default value is 25.
  3052. @item interp
  3053. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3054. Default is @var{linear}.
  3055. @end table
  3056. @section haas
  3057. Apply Haas effect to audio.
  3058. Note that this makes most sense to apply on mono signals.
  3059. With this filter applied to mono signals it give some directionality and
  3060. stretches its stereo image.
  3061. The filter accepts the following options:
  3062. @table @option
  3063. @item level_in
  3064. Set input level. By default is @var{1}, or 0dB
  3065. @item level_out
  3066. Set output level. By default is @var{1}, or 0dB.
  3067. @item side_gain
  3068. Set gain applied to side part of signal. By default is @var{1}.
  3069. @item middle_source
  3070. Set kind of middle source. Can be one of the following:
  3071. @table @samp
  3072. @item left
  3073. Pick left channel.
  3074. @item right
  3075. Pick right channel.
  3076. @item mid
  3077. Pick middle part signal of stereo image.
  3078. @item side
  3079. Pick side part signal of stereo image.
  3080. @end table
  3081. @item middle_phase
  3082. Change middle phase. By default is disabled.
  3083. @item left_delay
  3084. Set left channel delay. By default is @var{2.05} milliseconds.
  3085. @item left_balance
  3086. Set left channel balance. By default is @var{-1}.
  3087. @item left_gain
  3088. Set left channel gain. By default is @var{1}.
  3089. @item left_phase
  3090. Change left phase. By default is disabled.
  3091. @item right_delay
  3092. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3093. @item right_balance
  3094. Set right channel balance. By default is @var{1}.
  3095. @item right_gain
  3096. Set right channel gain. By default is @var{1}.
  3097. @item right_phase
  3098. Change right phase. By default is enabled.
  3099. @end table
  3100. @section hdcd
  3101. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3102. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3103. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3104. of HDCD, and detects the Transient Filter flag.
  3105. @example
  3106. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3107. @end example
  3108. When using the filter with wav, note the default encoding for wav is 16-bit,
  3109. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3110. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3111. @example
  3112. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3113. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3114. @end example
  3115. The filter accepts the following options:
  3116. @table @option
  3117. @item disable_autoconvert
  3118. Disable any automatic format conversion or resampling in the filter graph.
  3119. @item process_stereo
  3120. Process the stereo channels together. If target_gain does not match between
  3121. channels, consider it invalid and use the last valid target_gain.
  3122. @item cdt_ms
  3123. Set the code detect timer period in ms.
  3124. @item force_pe
  3125. Always extend peaks above -3dBFS even if PE isn't signaled.
  3126. @item analyze_mode
  3127. Replace audio with a solid tone and adjust the amplitude to signal some
  3128. specific aspect of the decoding process. The output file can be loaded in
  3129. an audio editor alongside the original to aid analysis.
  3130. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3131. Modes are:
  3132. @table @samp
  3133. @item 0, off
  3134. Disabled
  3135. @item 1, lle
  3136. Gain adjustment level at each sample
  3137. @item 2, pe
  3138. Samples where peak extend occurs
  3139. @item 3, cdt
  3140. Samples where the code detect timer is active
  3141. @item 4, tgm
  3142. Samples where the target gain does not match between channels
  3143. @end table
  3144. @end table
  3145. @section headphone
  3146. Apply head-related transfer functions (HRTFs) to create virtual
  3147. loudspeakers around the user for binaural listening via headphones.
  3148. The HRIRs are provided via additional streams, for each channel
  3149. one stereo input stream is needed.
  3150. The filter accepts the following options:
  3151. @table @option
  3152. @item map
  3153. Set mapping of input streams for convolution.
  3154. The argument is a '|'-separated list of channel names in order as they
  3155. are given as additional stream inputs for filter.
  3156. This also specify number of input streams. Number of input streams
  3157. must be not less than number of channels in first stream plus one.
  3158. @item gain
  3159. Set gain applied to audio. Value is in dB. Default is 0.
  3160. @item type
  3161. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3162. processing audio in time domain which is slow.
  3163. @var{freq} is processing audio in frequency domain which is fast.
  3164. Default is @var{freq}.
  3165. @item lfe
  3166. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3167. @item size
  3168. Set size of frame in number of samples which will be processed at once.
  3169. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3170. @item hrir
  3171. Set format of hrir stream.
  3172. Default value is @var{stereo}. Alternative value is @var{multich}.
  3173. If value is set to @var{stereo}, number of additional streams should
  3174. be greater or equal to number of input channels in first input stream.
  3175. Also each additional stream should have stereo number of channels.
  3176. If value is set to @var{multich}, number of additional streams should
  3177. be exactly one. Also number of input channels of additional stream
  3178. should be equal or greater than twice number of channels of first input
  3179. stream.
  3180. @end table
  3181. @subsection Examples
  3182. @itemize
  3183. @item
  3184. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3185. each amovie filter use stereo file with IR coefficients as input.
  3186. The files give coefficients for each position of virtual loudspeaker:
  3187. @example
  3188. ffmpeg -i input.wav
  3189. -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"
  3190. output.wav
  3191. @end example
  3192. @item
  3193. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3194. but now in @var{multich} @var{hrir} format.
  3195. @example
  3196. 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"
  3197. output.wav
  3198. @end example
  3199. @end itemize
  3200. @section highpass
  3201. Apply a high-pass filter with 3dB point frequency.
  3202. The filter can be either single-pole, or double-pole (the default).
  3203. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3204. The filter accepts the following options:
  3205. @table @option
  3206. @item frequency, f
  3207. Set frequency in Hz. Default is 3000.
  3208. @item poles, p
  3209. Set number of poles. Default is 2.
  3210. @item width_type, t
  3211. Set method to specify band-width of filter.
  3212. @table @option
  3213. @item h
  3214. Hz
  3215. @item q
  3216. Q-Factor
  3217. @item o
  3218. octave
  3219. @item s
  3220. slope
  3221. @item k
  3222. kHz
  3223. @end table
  3224. @item width, w
  3225. Specify the band-width of a filter in width_type units.
  3226. Applies only to double-pole filter.
  3227. The default is 0.707q and gives a Butterworth response.
  3228. @item mix, m
  3229. How much to use filtered signal in output. Default is 1.
  3230. Range is between 0 and 1.
  3231. @item channels, c
  3232. Specify which channels to filter, by default all available are filtered.
  3233. @item normalize, n
  3234. Normalize biquad coefficients, by default is disabled.
  3235. Enabling it will normalize magnitude response at DC to 0dB.
  3236. @item transform, a
  3237. Set transform type of IIR filter.
  3238. @table @option
  3239. @item di
  3240. @item dii
  3241. @item tdii
  3242. @end table
  3243. @end table
  3244. @subsection Commands
  3245. This filter supports the following commands:
  3246. @table @option
  3247. @item frequency, f
  3248. Change highpass frequency.
  3249. Syntax for the command is : "@var{frequency}"
  3250. @item width_type, t
  3251. Change highpass width_type.
  3252. Syntax for the command is : "@var{width_type}"
  3253. @item width, w
  3254. Change highpass width.
  3255. Syntax for the command is : "@var{width}"
  3256. @item mix, m
  3257. Change highpass mix.
  3258. Syntax for the command is : "@var{mix}"
  3259. @end table
  3260. @section join
  3261. Join multiple input streams into one multi-channel stream.
  3262. It accepts the following parameters:
  3263. @table @option
  3264. @item inputs
  3265. The number of input streams. It defaults to 2.
  3266. @item channel_layout
  3267. The desired output channel layout. It defaults to stereo.
  3268. @item map
  3269. Map channels from inputs to output. The argument is a '|'-separated list of
  3270. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3271. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3272. can be either the name of the input channel (e.g. FL for front left) or its
  3273. index in the specified input stream. @var{out_channel} is the name of the output
  3274. channel.
  3275. @end table
  3276. The filter will attempt to guess the mappings when they are not specified
  3277. explicitly. It does so by first trying to find an unused matching input channel
  3278. and if that fails it picks the first unused input channel.
  3279. Join 3 inputs (with properly set channel layouts):
  3280. @example
  3281. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3282. @end example
  3283. Build a 5.1 output from 6 single-channel streams:
  3284. @example
  3285. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3286. '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'
  3287. out
  3288. @end example
  3289. @section ladspa
  3290. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3291. To enable compilation of this filter you need to configure FFmpeg with
  3292. @code{--enable-ladspa}.
  3293. @table @option
  3294. @item file, f
  3295. Specifies the name of LADSPA plugin library to load. If the environment
  3296. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3297. each one of the directories specified by the colon separated list in
  3298. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3299. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3300. @file{/usr/lib/ladspa/}.
  3301. @item plugin, p
  3302. Specifies the plugin within the library. Some libraries contain only
  3303. one plugin, but others contain many of them. If this is not set filter
  3304. will list all available plugins within the specified library.
  3305. @item controls, c
  3306. Set the '|' separated list of controls which are zero or more floating point
  3307. values that determine the behavior of the loaded plugin (for example delay,
  3308. threshold or gain).
  3309. Controls need to be defined using the following syntax:
  3310. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3311. @var{valuei} is the value set on the @var{i}-th control.
  3312. Alternatively they can be also defined using the following syntax:
  3313. @var{value0}|@var{value1}|@var{value2}|..., where
  3314. @var{valuei} is the value set on the @var{i}-th control.
  3315. If @option{controls} is set to @code{help}, all available controls and
  3316. their valid ranges are printed.
  3317. @item sample_rate, s
  3318. Specify the sample rate, default to 44100. Only used if plugin have
  3319. zero inputs.
  3320. @item nb_samples, n
  3321. Set the number of samples per channel per each output frame, default
  3322. is 1024. Only used if plugin have zero inputs.
  3323. @item duration, d
  3324. Set the minimum duration of the sourced audio. See
  3325. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3326. for the accepted syntax.
  3327. Note that the resulting duration may be greater than the specified duration,
  3328. as the generated audio is always cut at the end of a complete frame.
  3329. If not specified, or the expressed duration is negative, the audio is
  3330. supposed to be generated forever.
  3331. Only used if plugin have zero inputs.
  3332. @item latency, l
  3333. Enable latency compensation, by default is disabled.
  3334. Only used if plugin have inputs.
  3335. @end table
  3336. @subsection Examples
  3337. @itemize
  3338. @item
  3339. List all available plugins within amp (LADSPA example plugin) library:
  3340. @example
  3341. ladspa=file=amp
  3342. @end example
  3343. @item
  3344. List all available controls and their valid ranges for @code{vcf_notch}
  3345. plugin from @code{VCF} library:
  3346. @example
  3347. ladspa=f=vcf:p=vcf_notch:c=help
  3348. @end example
  3349. @item
  3350. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3351. plugin library:
  3352. @example
  3353. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3354. @end example
  3355. @item
  3356. Add reverberation to the audio using TAP-plugins
  3357. (Tom's Audio Processing plugins):
  3358. @example
  3359. ladspa=file=tap_reverb:tap_reverb
  3360. @end example
  3361. @item
  3362. Generate white noise, with 0.2 amplitude:
  3363. @example
  3364. ladspa=file=cmt:noise_source_white:c=c0=.2
  3365. @end example
  3366. @item
  3367. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3368. @code{C* Audio Plugin Suite} (CAPS) library:
  3369. @example
  3370. ladspa=file=caps:Click:c=c1=20'
  3371. @end example
  3372. @item
  3373. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3374. @example
  3375. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3376. @end example
  3377. @item
  3378. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3379. @code{SWH Plugins} collection:
  3380. @example
  3381. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3382. @end example
  3383. @item
  3384. Attenuate low frequencies using Multiband EQ from Steve Harris
  3385. @code{SWH Plugins} collection:
  3386. @example
  3387. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3388. @end example
  3389. @item
  3390. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3391. (CAPS) library:
  3392. @example
  3393. ladspa=caps:Narrower
  3394. @end example
  3395. @item
  3396. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3397. @example
  3398. ladspa=caps:White:.2
  3399. @end example
  3400. @item
  3401. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3402. @example
  3403. ladspa=caps:Fractal:c=c1=1
  3404. @end example
  3405. @item
  3406. Dynamic volume normalization using @code{VLevel} plugin:
  3407. @example
  3408. ladspa=vlevel-ladspa:vlevel_mono
  3409. @end example
  3410. @end itemize
  3411. @subsection Commands
  3412. This filter supports the following commands:
  3413. @table @option
  3414. @item cN
  3415. Modify the @var{N}-th control value.
  3416. If the specified value is not valid, it is ignored and prior one is kept.
  3417. @end table
  3418. @section loudnorm
  3419. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3420. Support for both single pass (livestreams, files) and double pass (files) modes.
  3421. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  3422. detect true peaks, the audio stream will be upsampled to 192 kHz.
  3423. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3424. The filter accepts the following options:
  3425. @table @option
  3426. @item I, i
  3427. Set integrated loudness target.
  3428. Range is -70.0 - -5.0. Default value is -24.0.
  3429. @item LRA, lra
  3430. Set loudness range target.
  3431. Range is 1.0 - 20.0. Default value is 7.0.
  3432. @item TP, tp
  3433. Set maximum true peak.
  3434. Range is -9.0 - +0.0. Default value is -2.0.
  3435. @item measured_I, measured_i
  3436. Measured IL of input file.
  3437. Range is -99.0 - +0.0.
  3438. @item measured_LRA, measured_lra
  3439. Measured LRA of input file.
  3440. Range is 0.0 - 99.0.
  3441. @item measured_TP, measured_tp
  3442. Measured true peak of input file.
  3443. Range is -99.0 - +99.0.
  3444. @item measured_thresh
  3445. Measured threshold of input file.
  3446. Range is -99.0 - +0.0.
  3447. @item offset
  3448. Set offset gain. Gain is applied before the true-peak limiter.
  3449. Range is -99.0 - +99.0. Default is +0.0.
  3450. @item linear
  3451. Normalize by linearly scaling the source audio.
  3452. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  3453. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  3454. be lower than source LRA and the change in integrated loudness shouldn't
  3455. result in a true peak which exceeds the target TP. If any of these
  3456. conditions aren't met, normalization mode will revert to @var{dynamic}.
  3457. Options are @code{true} or @code{false}. Default is @code{true}.
  3458. @item dual_mono
  3459. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3460. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3461. If set to @code{true}, this option will compensate for this effect.
  3462. Multi-channel input files are not affected by this option.
  3463. Options are true or false. Default is false.
  3464. @item print_format
  3465. Set print format for stats. Options are summary, json, or none.
  3466. Default value is none.
  3467. @end table
  3468. @section lowpass
  3469. Apply a low-pass filter with 3dB point frequency.
  3470. The filter can be either single-pole or double-pole (the default).
  3471. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3472. The filter accepts the following options:
  3473. @table @option
  3474. @item frequency, f
  3475. Set frequency in Hz. Default is 500.
  3476. @item poles, p
  3477. Set number of poles. Default is 2.
  3478. @item width_type, t
  3479. Set method to specify band-width of filter.
  3480. @table @option
  3481. @item h
  3482. Hz
  3483. @item q
  3484. Q-Factor
  3485. @item o
  3486. octave
  3487. @item s
  3488. slope
  3489. @item k
  3490. kHz
  3491. @end table
  3492. @item width, w
  3493. Specify the band-width of a filter in width_type units.
  3494. Applies only to double-pole filter.
  3495. The default is 0.707q and gives a Butterworth response.
  3496. @item mix, m
  3497. How much to use filtered signal in output. Default is 1.
  3498. Range is between 0 and 1.
  3499. @item channels, c
  3500. Specify which channels to filter, by default all available are filtered.
  3501. @item normalize, n
  3502. Normalize biquad coefficients, by default is disabled.
  3503. Enabling it will normalize magnitude response at DC to 0dB.
  3504. @item transform, a
  3505. Set transform type of IIR filter.
  3506. @table @option
  3507. @item di
  3508. @item dii
  3509. @item tdii
  3510. @end table
  3511. @end table
  3512. @subsection Examples
  3513. @itemize
  3514. @item
  3515. Lowpass only LFE channel, it LFE is not present it does nothing:
  3516. @example
  3517. lowpass=c=LFE
  3518. @end example
  3519. @end itemize
  3520. @subsection Commands
  3521. This filter supports the following commands:
  3522. @table @option
  3523. @item frequency, f
  3524. Change lowpass frequency.
  3525. Syntax for the command is : "@var{frequency}"
  3526. @item width_type, t
  3527. Change lowpass width_type.
  3528. Syntax for the command is : "@var{width_type}"
  3529. @item width, w
  3530. Change lowpass width.
  3531. Syntax for the command is : "@var{width}"
  3532. @item mix, m
  3533. Change lowpass mix.
  3534. Syntax for the command is : "@var{mix}"
  3535. @end table
  3536. @section lv2
  3537. Load a LV2 (LADSPA Version 2) plugin.
  3538. To enable compilation of this filter you need to configure FFmpeg with
  3539. @code{--enable-lv2}.
  3540. @table @option
  3541. @item plugin, p
  3542. Specifies the plugin URI. You may need to escape ':'.
  3543. @item controls, c
  3544. Set the '|' separated list of controls which are zero or more floating point
  3545. values that determine the behavior of the loaded plugin (for example delay,
  3546. threshold or gain).
  3547. If @option{controls} is set to @code{help}, all available controls and
  3548. their valid ranges are printed.
  3549. @item sample_rate, s
  3550. Specify the sample rate, default to 44100. Only used if plugin have
  3551. zero inputs.
  3552. @item nb_samples, n
  3553. Set the number of samples per channel per each output frame, default
  3554. is 1024. Only used if plugin have zero inputs.
  3555. @item duration, d
  3556. Set the minimum duration of the sourced audio. See
  3557. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3558. for the accepted syntax.
  3559. Note that the resulting duration may be greater than the specified duration,
  3560. as the generated audio is always cut at the end of a complete frame.
  3561. If not specified, or the expressed duration is negative, the audio is
  3562. supposed to be generated forever.
  3563. Only used if plugin have zero inputs.
  3564. @end table
  3565. @subsection Examples
  3566. @itemize
  3567. @item
  3568. Apply bass enhancer plugin from Calf:
  3569. @example
  3570. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3571. @end example
  3572. @item
  3573. Apply vinyl plugin from Calf:
  3574. @example
  3575. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3576. @end example
  3577. @item
  3578. Apply bit crusher plugin from ArtyFX:
  3579. @example
  3580. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3581. @end example
  3582. @end itemize
  3583. @section mcompand
  3584. Multiband Compress or expand the audio's dynamic range.
  3585. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3586. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3587. response when absent compander action.
  3588. It accepts the following parameters:
  3589. @table @option
  3590. @item args
  3591. This option syntax is:
  3592. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3593. For explanation of each item refer to compand filter documentation.
  3594. @end table
  3595. @anchor{pan}
  3596. @section pan
  3597. Mix channels with specific gain levels. The filter accepts the output
  3598. channel layout followed by a set of channels definitions.
  3599. This filter is also designed to efficiently remap the channels of an audio
  3600. stream.
  3601. The filter accepts parameters of the form:
  3602. "@var{l}|@var{outdef}|@var{outdef}|..."
  3603. @table @option
  3604. @item l
  3605. output channel layout or number of channels
  3606. @item outdef
  3607. output channel specification, of the form:
  3608. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3609. @item out_name
  3610. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3611. number (c0, c1, etc.)
  3612. @item gain
  3613. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3614. @item in_name
  3615. input channel to use, see out_name for details; it is not possible to mix
  3616. named and numbered input channels
  3617. @end table
  3618. If the `=' in a channel specification is replaced by `<', then the gains for
  3619. that specification will be renormalized so that the total is 1, thus
  3620. avoiding clipping noise.
  3621. @subsection Mixing examples
  3622. For example, if you want to down-mix from stereo to mono, but with a bigger
  3623. factor for the left channel:
  3624. @example
  3625. pan=1c|c0=0.9*c0+0.1*c1
  3626. @end example
  3627. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3628. 7-channels surround:
  3629. @example
  3630. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3631. @end example
  3632. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3633. that should be preferred (see "-ac" option) unless you have very specific
  3634. needs.
  3635. @subsection Remapping examples
  3636. The channel remapping will be effective if, and only if:
  3637. @itemize
  3638. @item gain coefficients are zeroes or ones,
  3639. @item only one input per channel output,
  3640. @end itemize
  3641. If all these conditions are satisfied, the filter will notify the user ("Pure
  3642. channel mapping detected"), and use an optimized and lossless method to do the
  3643. remapping.
  3644. For example, if you have a 5.1 source and want a stereo audio stream by
  3645. dropping the extra channels:
  3646. @example
  3647. pan="stereo| c0=FL | c1=FR"
  3648. @end example
  3649. Given the same source, you can also switch front left and front right channels
  3650. and keep the input channel layout:
  3651. @example
  3652. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3653. @end example
  3654. If the input is a stereo audio stream, you can mute the front left channel (and
  3655. still keep the stereo channel layout) with:
  3656. @example
  3657. pan="stereo|c1=c1"
  3658. @end example
  3659. Still with a stereo audio stream input, you can copy the right channel in both
  3660. front left and right:
  3661. @example
  3662. pan="stereo| c0=FR | c1=FR"
  3663. @end example
  3664. @section replaygain
  3665. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3666. outputs it unchanged.
  3667. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3668. @section resample
  3669. Convert the audio sample format, sample rate and channel layout. It is
  3670. not meant to be used directly.
  3671. @section rubberband
  3672. Apply time-stretching and pitch-shifting with librubberband.
  3673. To enable compilation of this filter, you need to configure FFmpeg with
  3674. @code{--enable-librubberband}.
  3675. The filter accepts the following options:
  3676. @table @option
  3677. @item tempo
  3678. Set tempo scale factor.
  3679. @item pitch
  3680. Set pitch scale factor.
  3681. @item transients
  3682. Set transients detector.
  3683. Possible values are:
  3684. @table @var
  3685. @item crisp
  3686. @item mixed
  3687. @item smooth
  3688. @end table
  3689. @item detector
  3690. Set detector.
  3691. Possible values are:
  3692. @table @var
  3693. @item compound
  3694. @item percussive
  3695. @item soft
  3696. @end table
  3697. @item phase
  3698. Set phase.
  3699. Possible values are:
  3700. @table @var
  3701. @item laminar
  3702. @item independent
  3703. @end table
  3704. @item window
  3705. Set processing window size.
  3706. Possible values are:
  3707. @table @var
  3708. @item standard
  3709. @item short
  3710. @item long
  3711. @end table
  3712. @item smoothing
  3713. Set smoothing.
  3714. Possible values are:
  3715. @table @var
  3716. @item off
  3717. @item on
  3718. @end table
  3719. @item formant
  3720. Enable formant preservation when shift pitching.
  3721. Possible values are:
  3722. @table @var
  3723. @item shifted
  3724. @item preserved
  3725. @end table
  3726. @item pitchq
  3727. Set pitch quality.
  3728. Possible values are:
  3729. @table @var
  3730. @item quality
  3731. @item speed
  3732. @item consistency
  3733. @end table
  3734. @item channels
  3735. Set channels.
  3736. Possible values are:
  3737. @table @var
  3738. @item apart
  3739. @item together
  3740. @end table
  3741. @end table
  3742. @subsection Commands
  3743. This filter supports the following commands:
  3744. @table @option
  3745. @item tempo
  3746. Change filter tempo scale factor.
  3747. Syntax for the command is : "@var{tempo}"
  3748. @item pitch
  3749. Change filter pitch scale factor.
  3750. Syntax for the command is : "@var{pitch}"
  3751. @end table
  3752. @section sidechaincompress
  3753. This filter acts like normal compressor but has the ability to compress
  3754. detected signal using second input signal.
  3755. It needs two input streams and returns one output stream.
  3756. First input stream will be processed depending on second stream signal.
  3757. The filtered signal then can be filtered with other filters in later stages of
  3758. processing. See @ref{pan} and @ref{amerge} filter.
  3759. The filter accepts the following options:
  3760. @table @option
  3761. @item level_in
  3762. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3763. @item mode
  3764. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3765. Default is @code{downward}.
  3766. @item threshold
  3767. If a signal of second stream raises above this level it will affect the gain
  3768. reduction of first stream.
  3769. By default is 0.125. Range is between 0.00097563 and 1.
  3770. @item ratio
  3771. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3772. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3773. Default is 2. Range is between 1 and 20.
  3774. @item attack
  3775. Amount of milliseconds the signal has to rise above the threshold before gain
  3776. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3777. @item release
  3778. Amount of milliseconds the signal has to fall below the threshold before
  3779. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3780. @item makeup
  3781. Set the amount by how much signal will be amplified after processing.
  3782. Default is 1. Range is from 1 to 64.
  3783. @item knee
  3784. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3785. Default is 2.82843. Range is between 1 and 8.
  3786. @item link
  3787. Choose if the @code{average} level between all channels of side-chain stream
  3788. or the louder(@code{maximum}) channel of side-chain stream affects the
  3789. reduction. Default is @code{average}.
  3790. @item detection
  3791. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3792. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3793. @item level_sc
  3794. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3795. @item mix
  3796. How much to use compressed signal in output. Default is 1.
  3797. Range is between 0 and 1.
  3798. @end table
  3799. @subsection Commands
  3800. This filter supports the all above options as @ref{commands}.
  3801. @subsection Examples
  3802. @itemize
  3803. @item
  3804. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3805. depending on the signal of 2nd input and later compressed signal to be
  3806. merged with 2nd input:
  3807. @example
  3808. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3809. @end example
  3810. @end itemize
  3811. @section sidechaingate
  3812. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3813. filter the detected signal before sending it to the gain reduction stage.
  3814. Normally a gate uses the full range signal to detect a level above the
  3815. threshold.
  3816. For example: If you cut all lower frequencies from your sidechain signal
  3817. the gate will decrease the volume of your track only if not enough highs
  3818. appear. With this technique you are able to reduce the resonation of a
  3819. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3820. guitar.
  3821. It needs two input streams and returns one output stream.
  3822. First input stream will be processed depending on second stream signal.
  3823. The filter accepts the following options:
  3824. @table @option
  3825. @item level_in
  3826. Set input level before filtering.
  3827. Default is 1. Allowed range is from 0.015625 to 64.
  3828. @item mode
  3829. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3830. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3831. will be amplified, expanding dynamic range in upward direction.
  3832. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3833. @item range
  3834. Set the level of gain reduction when the signal is below the threshold.
  3835. Default is 0.06125. Allowed range is from 0 to 1.
  3836. Setting this to 0 disables reduction and then filter behaves like expander.
  3837. @item threshold
  3838. If a signal rises above this level the gain reduction is released.
  3839. Default is 0.125. Allowed range is from 0 to 1.
  3840. @item ratio
  3841. Set a ratio about which the signal is reduced.
  3842. Default is 2. Allowed range is from 1 to 9000.
  3843. @item attack
  3844. Amount of milliseconds the signal has to rise above the threshold before gain
  3845. reduction stops.
  3846. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3847. @item release
  3848. Amount of milliseconds the signal has to fall below the threshold before the
  3849. reduction is increased again. Default is 250 milliseconds.
  3850. Allowed range is from 0.01 to 9000.
  3851. @item makeup
  3852. Set amount of amplification of signal after processing.
  3853. Default is 1. Allowed range is from 1 to 64.
  3854. @item knee
  3855. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3856. Default is 2.828427125. Allowed range is from 1 to 8.
  3857. @item detection
  3858. Choose if exact signal should be taken for detection or an RMS like one.
  3859. Default is rms. Can be peak or rms.
  3860. @item link
  3861. Choose if the average level between all channels or the louder channel affects
  3862. the reduction.
  3863. Default is average. Can be average or maximum.
  3864. @item level_sc
  3865. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3866. @end table
  3867. @section silencedetect
  3868. Detect silence in an audio stream.
  3869. This filter logs a message when it detects that the input audio volume is less
  3870. or equal to a noise tolerance value for a duration greater or equal to the
  3871. minimum detected noise duration.
  3872. The printed times and duration are expressed in seconds. The
  3873. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  3874. is set on the first frame whose timestamp equals or exceeds the detection
  3875. duration and it contains the timestamp of the first frame of the silence.
  3876. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  3877. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  3878. keys are set on the first frame after the silence. If @option{mono} is
  3879. enabled, and each channel is evaluated separately, the @code{.X}
  3880. suffixed keys are used, and @code{X} corresponds to the channel number.
  3881. The filter accepts the following options:
  3882. @table @option
  3883. @item noise, n
  3884. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3885. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3886. @item duration, d
  3887. Set silence duration until notification (default is 2 seconds). See
  3888. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3889. for the accepted syntax.
  3890. @item mono, m
  3891. Process each channel separately, instead of combined. By default is disabled.
  3892. @end table
  3893. @subsection Examples
  3894. @itemize
  3895. @item
  3896. Detect 5 seconds of silence with -50dB noise tolerance:
  3897. @example
  3898. silencedetect=n=-50dB:d=5
  3899. @end example
  3900. @item
  3901. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3902. tolerance in @file{silence.mp3}:
  3903. @example
  3904. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3905. @end example
  3906. @end itemize
  3907. @section silenceremove
  3908. Remove silence from the beginning, middle or end of the audio.
  3909. The filter accepts the following options:
  3910. @table @option
  3911. @item start_periods
  3912. This value is used to indicate if audio should be trimmed at beginning of
  3913. the audio. A value of zero indicates no silence should be trimmed from the
  3914. beginning. When specifying a non-zero value, it trims audio up until it
  3915. finds non-silence. Normally, when trimming silence from beginning of audio
  3916. the @var{start_periods} will be @code{1} but it can be increased to higher
  3917. values to trim all audio up to specific count of non-silence periods.
  3918. Default value is @code{0}.
  3919. @item start_duration
  3920. Specify the amount of time that non-silence must be detected before it stops
  3921. trimming audio. By increasing the duration, bursts of noises can be treated
  3922. as silence and trimmed off. Default value is @code{0}.
  3923. @item start_threshold
  3924. This indicates what sample value should be treated as silence. For digital
  3925. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3926. you may wish to increase the value to account for background noise.
  3927. Can be specified in dB (in case "dB" is appended to the specified value)
  3928. or amplitude ratio. Default value is @code{0}.
  3929. @item start_silence
  3930. Specify max duration of silence at beginning that will be kept after
  3931. trimming. Default is 0, which is equal to trimming all samples detected
  3932. as silence.
  3933. @item start_mode
  3934. Specify mode of detection of silence end in start of multi-channel audio.
  3935. Can be @var{any} or @var{all}. Default is @var{any}.
  3936. With @var{any}, any sample that is detected as non-silence will cause
  3937. stopped trimming of silence.
  3938. With @var{all}, only if all channels are detected as non-silence will cause
  3939. stopped trimming of silence.
  3940. @item stop_periods
  3941. Set the count for trimming silence from the end of audio.
  3942. To remove silence from the middle of a file, specify a @var{stop_periods}
  3943. that is negative. This value is then treated as a positive value and is
  3944. used to indicate the effect should restart processing as specified by
  3945. @var{start_periods}, making it suitable for removing periods of silence
  3946. in the middle of the audio.
  3947. Default value is @code{0}.
  3948. @item stop_duration
  3949. Specify a duration of silence that must exist before audio is not copied any
  3950. more. By specifying a higher duration, silence that is wanted can be left in
  3951. the audio.
  3952. Default value is @code{0}.
  3953. @item stop_threshold
  3954. This is the same as @option{start_threshold} but for trimming silence from
  3955. the end of audio.
  3956. Can be specified in dB (in case "dB" is appended to the specified value)
  3957. or amplitude ratio. Default value is @code{0}.
  3958. @item stop_silence
  3959. Specify max duration of silence at end that will be kept after
  3960. trimming. Default is 0, which is equal to trimming all samples detected
  3961. as silence.
  3962. @item stop_mode
  3963. Specify mode of detection of silence start in end of multi-channel audio.
  3964. Can be @var{any} or @var{all}. Default is @var{any}.
  3965. With @var{any}, any sample that is detected as non-silence will cause
  3966. stopped trimming of silence.
  3967. With @var{all}, only if all channels are detected as non-silence will cause
  3968. stopped trimming of silence.
  3969. @item detection
  3970. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3971. and works better with digital silence which is exactly 0.
  3972. Default value is @code{rms}.
  3973. @item window
  3974. Set duration in number of seconds used to calculate size of window in number
  3975. of samples for detecting silence.
  3976. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3977. @end table
  3978. @subsection Examples
  3979. @itemize
  3980. @item
  3981. The following example shows how this filter can be used to start a recording
  3982. that does not contain the delay at the start which usually occurs between
  3983. pressing the record button and the start of the performance:
  3984. @example
  3985. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3986. @end example
  3987. @item
  3988. Trim all silence encountered from beginning to end where there is more than 1
  3989. second of silence in audio:
  3990. @example
  3991. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3992. @end example
  3993. @item
  3994. Trim all digital silence samples, using peak detection, from beginning to end
  3995. where there is more than 0 samples of digital silence in audio and digital
  3996. silence is detected in all channels at same positions in stream:
  3997. @example
  3998. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  3999. @end example
  4000. @end itemize
  4001. @section sofalizer
  4002. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  4003. loudspeakers around the user for binaural listening via headphones (audio
  4004. formats up to 9 channels supported).
  4005. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  4006. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  4007. Austrian Academy of Sciences.
  4008. To enable compilation of this filter you need to configure FFmpeg with
  4009. @code{--enable-libmysofa}.
  4010. The filter accepts the following options:
  4011. @table @option
  4012. @item sofa
  4013. Set the SOFA file used for rendering.
  4014. @item gain
  4015. Set gain applied to audio. Value is in dB. Default is 0.
  4016. @item rotation
  4017. Set rotation of virtual loudspeakers in deg. Default is 0.
  4018. @item elevation
  4019. Set elevation of virtual speakers in deg. Default is 0.
  4020. @item radius
  4021. Set distance in meters between loudspeakers and the listener with near-field
  4022. HRTFs. Default is 1.
  4023. @item type
  4024. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4025. processing audio in time domain which is slow.
  4026. @var{freq} is processing audio in frequency domain which is fast.
  4027. Default is @var{freq}.
  4028. @item speakers
  4029. Set custom positions of virtual loudspeakers. Syntax for this option is:
  4030. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  4031. Each virtual loudspeaker is described with short channel name following with
  4032. azimuth and elevation in degrees.
  4033. Each virtual loudspeaker description is separated by '|'.
  4034. For example to override front left and front right channel positions use:
  4035. 'speakers=FL 45 15|FR 345 15'.
  4036. Descriptions with unrecognised channel names are ignored.
  4037. @item lfegain
  4038. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4039. @item framesize
  4040. Set custom frame size in number of samples. Default is 1024.
  4041. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4042. is set to @var{freq}.
  4043. @item normalize
  4044. Should all IRs be normalized upon importing SOFA file.
  4045. By default is enabled.
  4046. @item interpolate
  4047. Should nearest IRs be interpolated with neighbor IRs if exact position
  4048. does not match. By default is disabled.
  4049. @item minphase
  4050. Minphase all IRs upon loading of SOFA file. By default is disabled.
  4051. @item anglestep
  4052. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  4053. @item radstep
  4054. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  4055. @end table
  4056. @subsection Examples
  4057. @itemize
  4058. @item
  4059. Using ClubFritz6 sofa file:
  4060. @example
  4061. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  4062. @end example
  4063. @item
  4064. Using ClubFritz12 sofa file and bigger radius with small rotation:
  4065. @example
  4066. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  4067. @end example
  4068. @item
  4069. Similar as above but with custom speaker positions for front left, front right, back left and back right
  4070. and also with custom gain:
  4071. @example
  4072. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  4073. @end example
  4074. @end itemize
  4075. @section stereotools
  4076. This filter has some handy utilities to manage stereo signals, for converting
  4077. M/S stereo recordings to L/R signal while having control over the parameters
  4078. or spreading the stereo image of master track.
  4079. The filter accepts the following options:
  4080. @table @option
  4081. @item level_in
  4082. Set input level before filtering for both channels. Defaults is 1.
  4083. Allowed range is from 0.015625 to 64.
  4084. @item level_out
  4085. Set output level after filtering for both channels. Defaults is 1.
  4086. Allowed range is from 0.015625 to 64.
  4087. @item balance_in
  4088. Set input balance between both channels. Default is 0.
  4089. Allowed range is from -1 to 1.
  4090. @item balance_out
  4091. Set output balance between both channels. Default is 0.
  4092. Allowed range is from -1 to 1.
  4093. @item softclip
  4094. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  4095. clipping. Disabled by default.
  4096. @item mutel
  4097. Mute the left channel. Disabled by default.
  4098. @item muter
  4099. Mute the right channel. Disabled by default.
  4100. @item phasel
  4101. Change the phase of the left channel. Disabled by default.
  4102. @item phaser
  4103. Change the phase of the right channel. Disabled by default.
  4104. @item mode
  4105. Set stereo mode. Available values are:
  4106. @table @samp
  4107. @item lr>lr
  4108. Left/Right to Left/Right, this is default.
  4109. @item lr>ms
  4110. Left/Right to Mid/Side.
  4111. @item ms>lr
  4112. Mid/Side to Left/Right.
  4113. @item lr>ll
  4114. Left/Right to Left/Left.
  4115. @item lr>rr
  4116. Left/Right to Right/Right.
  4117. @item lr>l+r
  4118. Left/Right to Left + Right.
  4119. @item lr>rl
  4120. Left/Right to Right/Left.
  4121. @item ms>ll
  4122. Mid/Side to Left/Left.
  4123. @item ms>rr
  4124. Mid/Side to Right/Right.
  4125. @end table
  4126. @item slev
  4127. Set level of side signal. Default is 1.
  4128. Allowed range is from 0.015625 to 64.
  4129. @item sbal
  4130. Set balance of side signal. Default is 0.
  4131. Allowed range is from -1 to 1.
  4132. @item mlev
  4133. Set level of the middle signal. Default is 1.
  4134. Allowed range is from 0.015625 to 64.
  4135. @item mpan
  4136. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4137. @item base
  4138. Set stereo base between mono and inversed channels. Default is 0.
  4139. Allowed range is from -1 to 1.
  4140. @item delay
  4141. Set delay in milliseconds how much to delay left from right channel and
  4142. vice versa. Default is 0. Allowed range is from -20 to 20.
  4143. @item sclevel
  4144. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4145. @item phase
  4146. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4147. @item bmode_in, bmode_out
  4148. Set balance mode for balance_in/balance_out option.
  4149. Can be one of the following:
  4150. @table @samp
  4151. @item balance
  4152. Classic balance mode. Attenuate one channel at time.
  4153. Gain is raised up to 1.
  4154. @item amplitude
  4155. Similar as classic mode above but gain is raised up to 2.
  4156. @item power
  4157. Equal power distribution, from -6dB to +6dB range.
  4158. @end table
  4159. @end table
  4160. @subsection Examples
  4161. @itemize
  4162. @item
  4163. Apply karaoke like effect:
  4164. @example
  4165. stereotools=mlev=0.015625
  4166. @end example
  4167. @item
  4168. Convert M/S signal to L/R:
  4169. @example
  4170. "stereotools=mode=ms>lr"
  4171. @end example
  4172. @end itemize
  4173. @section stereowiden
  4174. This filter enhance the stereo effect by suppressing signal common to both
  4175. channels and by delaying the signal of left into right and vice versa,
  4176. thereby widening the stereo effect.
  4177. The filter accepts the following options:
  4178. @table @option
  4179. @item delay
  4180. Time in milliseconds of the delay of left signal into right and vice versa.
  4181. Default is 20 milliseconds.
  4182. @item feedback
  4183. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4184. effect of left signal in right output and vice versa which gives widening
  4185. effect. Default is 0.3.
  4186. @item crossfeed
  4187. Cross feed of left into right with inverted phase. This helps in suppressing
  4188. the mono. If the value is 1 it will cancel all the signal common to both
  4189. channels. Default is 0.3.
  4190. @item drymix
  4191. Set level of input signal of original channel. Default is 0.8.
  4192. @end table
  4193. @subsection Commands
  4194. This filter supports the all above options except @code{delay} as @ref{commands}.
  4195. @section superequalizer
  4196. Apply 18 band equalizer.
  4197. The filter accepts the following options:
  4198. @table @option
  4199. @item 1b
  4200. Set 65Hz band gain.
  4201. @item 2b
  4202. Set 92Hz band gain.
  4203. @item 3b
  4204. Set 131Hz band gain.
  4205. @item 4b
  4206. Set 185Hz band gain.
  4207. @item 5b
  4208. Set 262Hz band gain.
  4209. @item 6b
  4210. Set 370Hz band gain.
  4211. @item 7b
  4212. Set 523Hz band gain.
  4213. @item 8b
  4214. Set 740Hz band gain.
  4215. @item 9b
  4216. Set 1047Hz band gain.
  4217. @item 10b
  4218. Set 1480Hz band gain.
  4219. @item 11b
  4220. Set 2093Hz band gain.
  4221. @item 12b
  4222. Set 2960Hz band gain.
  4223. @item 13b
  4224. Set 4186Hz band gain.
  4225. @item 14b
  4226. Set 5920Hz band gain.
  4227. @item 15b
  4228. Set 8372Hz band gain.
  4229. @item 16b
  4230. Set 11840Hz band gain.
  4231. @item 17b
  4232. Set 16744Hz band gain.
  4233. @item 18b
  4234. Set 20000Hz band gain.
  4235. @end table
  4236. @section surround
  4237. Apply audio surround upmix filter.
  4238. This filter allows to produce multichannel output from audio stream.
  4239. The filter accepts the following options:
  4240. @table @option
  4241. @item chl_out
  4242. Set output channel layout. By default, this is @var{5.1}.
  4243. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4244. for the required syntax.
  4245. @item chl_in
  4246. Set input channel layout. By default, this is @var{stereo}.
  4247. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4248. for the required syntax.
  4249. @item level_in
  4250. Set input volume level. By default, this is @var{1}.
  4251. @item level_out
  4252. Set output volume level. By default, this is @var{1}.
  4253. @item lfe
  4254. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4255. @item lfe_low
  4256. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4257. @item lfe_high
  4258. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4259. @item lfe_mode
  4260. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4261. In @var{add} mode, LFE channel is created from input audio and added to output.
  4262. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4263. also all non-LFE output channels are subtracted with output LFE channel.
  4264. @item angle
  4265. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4266. Default is @var{90}.
  4267. @item fc_in
  4268. Set front center input volume. By default, this is @var{1}.
  4269. @item fc_out
  4270. Set front center output volume. By default, this is @var{1}.
  4271. @item fl_in
  4272. Set front left input volume. By default, this is @var{1}.
  4273. @item fl_out
  4274. Set front left output volume. By default, this is @var{1}.
  4275. @item fr_in
  4276. Set front right input volume. By default, this is @var{1}.
  4277. @item fr_out
  4278. Set front right output volume. By default, this is @var{1}.
  4279. @item sl_in
  4280. Set side left input volume. By default, this is @var{1}.
  4281. @item sl_out
  4282. Set side left output volume. By default, this is @var{1}.
  4283. @item sr_in
  4284. Set side right input volume. By default, this is @var{1}.
  4285. @item sr_out
  4286. Set side right output volume. By default, this is @var{1}.
  4287. @item bl_in
  4288. Set back left input volume. By default, this is @var{1}.
  4289. @item bl_out
  4290. Set back left output volume. By default, this is @var{1}.
  4291. @item br_in
  4292. Set back right input volume. By default, this is @var{1}.
  4293. @item br_out
  4294. Set back right output volume. By default, this is @var{1}.
  4295. @item bc_in
  4296. Set back center input volume. By default, this is @var{1}.
  4297. @item bc_out
  4298. Set back center output volume. By default, this is @var{1}.
  4299. @item lfe_in
  4300. Set LFE input volume. By default, this is @var{1}.
  4301. @item lfe_out
  4302. Set LFE output volume. By default, this is @var{1}.
  4303. @item allx
  4304. Set spread usage of stereo image across X axis for all channels.
  4305. @item ally
  4306. Set spread usage of stereo image across Y axis for all channels.
  4307. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4308. Set spread usage of stereo image across X axis for each channel.
  4309. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4310. Set spread usage of stereo image across Y axis for each channel.
  4311. @item win_size
  4312. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4313. @item win_func
  4314. Set window function.
  4315. It accepts the following values:
  4316. @table @samp
  4317. @item rect
  4318. @item bartlett
  4319. @item hann, hanning
  4320. @item hamming
  4321. @item blackman
  4322. @item welch
  4323. @item flattop
  4324. @item bharris
  4325. @item bnuttall
  4326. @item bhann
  4327. @item sine
  4328. @item nuttall
  4329. @item lanczos
  4330. @item gauss
  4331. @item tukey
  4332. @item dolph
  4333. @item cauchy
  4334. @item parzen
  4335. @item poisson
  4336. @item bohman
  4337. @end table
  4338. Default is @code{hann}.
  4339. @item overlap
  4340. Set window overlap. If set to 1, the recommended overlap for selected
  4341. window function will be picked. Default is @code{0.5}.
  4342. @end table
  4343. @section treble, highshelf
  4344. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4345. shelving filter with a response similar to that of a standard
  4346. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4347. The filter accepts the following options:
  4348. @table @option
  4349. @item gain, g
  4350. Give the gain at whichever is the lower of ~22 kHz and the
  4351. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4352. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4353. @item frequency, f
  4354. Set the filter's central frequency and so can be used
  4355. to extend or reduce the frequency range to be boosted or cut.
  4356. The default value is @code{3000} Hz.
  4357. @item width_type, t
  4358. Set method to specify band-width of filter.
  4359. @table @option
  4360. @item h
  4361. Hz
  4362. @item q
  4363. Q-Factor
  4364. @item o
  4365. octave
  4366. @item s
  4367. slope
  4368. @item k
  4369. kHz
  4370. @end table
  4371. @item width, w
  4372. Determine how steep is the filter's shelf transition.
  4373. @item mix, m
  4374. How much to use filtered signal in output. Default is 1.
  4375. Range is between 0 and 1.
  4376. @item channels, c
  4377. Specify which channels to filter, by default all available are filtered.
  4378. @item normalize, n
  4379. Normalize biquad coefficients, by default is disabled.
  4380. Enabling it will normalize magnitude response at DC to 0dB.
  4381. @item transform, a
  4382. Set transform type of IIR filter.
  4383. @table @option
  4384. @item di
  4385. @item dii
  4386. @item tdii
  4387. @end table
  4388. @end table
  4389. @subsection Commands
  4390. This filter supports the following commands:
  4391. @table @option
  4392. @item frequency, f
  4393. Change treble frequency.
  4394. Syntax for the command is : "@var{frequency}"
  4395. @item width_type, t
  4396. Change treble width_type.
  4397. Syntax for the command is : "@var{width_type}"
  4398. @item width, w
  4399. Change treble width.
  4400. Syntax for the command is : "@var{width}"
  4401. @item gain, g
  4402. Change treble gain.
  4403. Syntax for the command is : "@var{gain}"
  4404. @item mix, m
  4405. Change treble mix.
  4406. Syntax for the command is : "@var{mix}"
  4407. @end table
  4408. @section tremolo
  4409. Sinusoidal amplitude modulation.
  4410. The filter accepts the following options:
  4411. @table @option
  4412. @item f
  4413. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4414. (20 Hz or lower) will result in a tremolo effect.
  4415. This filter may also be used as a ring modulator by specifying
  4416. a modulation frequency higher than 20 Hz.
  4417. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4418. @item d
  4419. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4420. Default value is 0.5.
  4421. @end table
  4422. @section vibrato
  4423. Sinusoidal phase modulation.
  4424. The filter accepts the following options:
  4425. @table @option
  4426. @item f
  4427. Modulation frequency in Hertz.
  4428. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4429. @item d
  4430. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4431. Default value is 0.5.
  4432. @end table
  4433. @section volume
  4434. Adjust the input audio volume.
  4435. It accepts the following parameters:
  4436. @table @option
  4437. @item volume
  4438. Set audio volume expression.
  4439. Output values are clipped to the maximum value.
  4440. The output audio volume is given by the relation:
  4441. @example
  4442. @var{output_volume} = @var{volume} * @var{input_volume}
  4443. @end example
  4444. The default value for @var{volume} is "1.0".
  4445. @item precision
  4446. This parameter represents the mathematical precision.
  4447. It determines which input sample formats will be allowed, which affects the
  4448. precision of the volume scaling.
  4449. @table @option
  4450. @item fixed
  4451. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4452. @item float
  4453. 32-bit floating-point; this limits input sample format to FLT. (default)
  4454. @item double
  4455. 64-bit floating-point; this limits input sample format to DBL.
  4456. @end table
  4457. @item replaygain
  4458. Choose the behaviour on encountering ReplayGain side data in input frames.
  4459. @table @option
  4460. @item drop
  4461. Remove ReplayGain side data, ignoring its contents (the default).
  4462. @item ignore
  4463. Ignore ReplayGain side data, but leave it in the frame.
  4464. @item track
  4465. Prefer the track gain, if present.
  4466. @item album
  4467. Prefer the album gain, if present.
  4468. @end table
  4469. @item replaygain_preamp
  4470. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4471. Default value for @var{replaygain_preamp} is 0.0.
  4472. @item replaygain_noclip
  4473. Prevent clipping by limiting the gain applied.
  4474. Default value for @var{replaygain_noclip} is 1.
  4475. @item eval
  4476. Set when the volume expression is evaluated.
  4477. It accepts the following values:
  4478. @table @samp
  4479. @item once
  4480. only evaluate expression once during the filter initialization, or
  4481. when the @samp{volume} command is sent
  4482. @item frame
  4483. evaluate expression for each incoming frame
  4484. @end table
  4485. Default value is @samp{once}.
  4486. @end table
  4487. The volume expression can contain the following parameters.
  4488. @table @option
  4489. @item n
  4490. frame number (starting at zero)
  4491. @item nb_channels
  4492. number of channels
  4493. @item nb_consumed_samples
  4494. number of samples consumed by the filter
  4495. @item nb_samples
  4496. number of samples in the current frame
  4497. @item pos
  4498. original frame position in the file
  4499. @item pts
  4500. frame PTS
  4501. @item sample_rate
  4502. sample rate
  4503. @item startpts
  4504. PTS at start of stream
  4505. @item startt
  4506. time at start of stream
  4507. @item t
  4508. frame time
  4509. @item tb
  4510. timestamp timebase
  4511. @item volume
  4512. last set volume value
  4513. @end table
  4514. Note that when @option{eval} is set to @samp{once} only the
  4515. @var{sample_rate} and @var{tb} variables are available, all other
  4516. variables will evaluate to NAN.
  4517. @subsection Commands
  4518. This filter supports the following commands:
  4519. @table @option
  4520. @item volume
  4521. Modify the volume expression.
  4522. The command accepts the same syntax of the corresponding option.
  4523. If the specified expression is not valid, it is kept at its current
  4524. value.
  4525. @end table
  4526. @subsection Examples
  4527. @itemize
  4528. @item
  4529. Halve the input audio volume:
  4530. @example
  4531. volume=volume=0.5
  4532. volume=volume=1/2
  4533. volume=volume=-6.0206dB
  4534. @end example
  4535. In all the above example the named key for @option{volume} can be
  4536. omitted, for example like in:
  4537. @example
  4538. volume=0.5
  4539. @end example
  4540. @item
  4541. Increase input audio power by 6 decibels using fixed-point precision:
  4542. @example
  4543. volume=volume=6dB:precision=fixed
  4544. @end example
  4545. @item
  4546. Fade volume after time 10 with an annihilation period of 5 seconds:
  4547. @example
  4548. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4549. @end example
  4550. @end itemize
  4551. @section volumedetect
  4552. Detect the volume of the input video.
  4553. The filter has no parameters. The input is not modified. Statistics about
  4554. the volume will be printed in the log when the input stream end is reached.
  4555. In particular it will show the mean volume (root mean square), maximum
  4556. volume (on a per-sample basis), and the beginning of a histogram of the
  4557. registered volume values (from the maximum value to a cumulated 1/1000 of
  4558. the samples).
  4559. All volumes are in decibels relative to the maximum PCM value.
  4560. @subsection Examples
  4561. Here is an excerpt of the output:
  4562. @example
  4563. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4564. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4565. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4566. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4567. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4568. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4569. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4570. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4571. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4572. @end example
  4573. It means that:
  4574. @itemize
  4575. @item
  4576. The mean square energy is approximately -27 dB, or 10^-2.7.
  4577. @item
  4578. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4579. @item
  4580. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4581. @end itemize
  4582. In other words, raising the volume by +4 dB does not cause any clipping,
  4583. raising it by +5 dB causes clipping for 6 samples, etc.
  4584. @c man end AUDIO FILTERS
  4585. @chapter Audio Sources
  4586. @c man begin AUDIO SOURCES
  4587. Below is a description of the currently available audio sources.
  4588. @section abuffer
  4589. Buffer audio frames, and make them available to the filter chain.
  4590. This source is mainly intended for a programmatic use, in particular
  4591. through the interface defined in @file{libavfilter/buffersrc.h}.
  4592. It accepts the following parameters:
  4593. @table @option
  4594. @item time_base
  4595. The timebase which will be used for timestamps of submitted frames. It must be
  4596. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4597. @item sample_rate
  4598. The sample rate of the incoming audio buffers.
  4599. @item sample_fmt
  4600. The sample format of the incoming audio buffers.
  4601. Either a sample format name or its corresponding integer representation from
  4602. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4603. @item channel_layout
  4604. The channel layout of the incoming audio buffers.
  4605. Either a channel layout name from channel_layout_map in
  4606. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4607. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4608. @item channels
  4609. The number of channels of the incoming audio buffers.
  4610. If both @var{channels} and @var{channel_layout} are specified, then they
  4611. must be consistent.
  4612. @end table
  4613. @subsection Examples
  4614. @example
  4615. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4616. @end example
  4617. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4618. Since the sample format with name "s16p" corresponds to the number
  4619. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4620. equivalent to:
  4621. @example
  4622. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4623. @end example
  4624. @section aevalsrc
  4625. Generate an audio signal specified by an expression.
  4626. This source accepts in input one or more expressions (one for each
  4627. channel), which are evaluated and used to generate a corresponding
  4628. audio signal.
  4629. This source accepts the following options:
  4630. @table @option
  4631. @item exprs
  4632. Set the '|'-separated expressions list for each separate channel. In case the
  4633. @option{channel_layout} option is not specified, the selected channel layout
  4634. depends on the number of provided expressions. Otherwise the last
  4635. specified expression is applied to the remaining output channels.
  4636. @item channel_layout, c
  4637. Set the channel layout. The number of channels in the specified layout
  4638. must be equal to the number of specified expressions.
  4639. @item duration, d
  4640. Set the minimum duration of the sourced audio. See
  4641. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4642. for the accepted syntax.
  4643. Note that the resulting duration may be greater than the specified
  4644. duration, as the generated audio is always cut at the end of a
  4645. complete frame.
  4646. If not specified, or the expressed duration is negative, the audio is
  4647. supposed to be generated forever.
  4648. @item nb_samples, n
  4649. Set the number of samples per channel per each output frame,
  4650. default to 1024.
  4651. @item sample_rate, s
  4652. Specify the sample rate, default to 44100.
  4653. @end table
  4654. Each expression in @var{exprs} can contain the following constants:
  4655. @table @option
  4656. @item n
  4657. number of the evaluated sample, starting from 0
  4658. @item t
  4659. time of the evaluated sample expressed in seconds, starting from 0
  4660. @item s
  4661. sample rate
  4662. @end table
  4663. @subsection Examples
  4664. @itemize
  4665. @item
  4666. Generate silence:
  4667. @example
  4668. aevalsrc=0
  4669. @end example
  4670. @item
  4671. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4672. 8000 Hz:
  4673. @example
  4674. aevalsrc="sin(440*2*PI*t):s=8000"
  4675. @end example
  4676. @item
  4677. Generate a two channels signal, specify the channel layout (Front
  4678. Center + Back Center) explicitly:
  4679. @example
  4680. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4681. @end example
  4682. @item
  4683. Generate white noise:
  4684. @example
  4685. aevalsrc="-2+random(0)"
  4686. @end example
  4687. @item
  4688. Generate an amplitude modulated signal:
  4689. @example
  4690. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4691. @end example
  4692. @item
  4693. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4694. @example
  4695. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4696. @end example
  4697. @end itemize
  4698. @section afirsrc
  4699. Generate a FIR coefficients using frequency sampling method.
  4700. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4701. The filter accepts the following options:
  4702. @table @option
  4703. @item taps, t
  4704. Set number of filter coefficents in output audio stream.
  4705. Default value is 1025.
  4706. @item frequency, f
  4707. Set frequency points from where magnitude and phase are set.
  4708. This must be in non decreasing order, and first element must be 0, while last element
  4709. must be 1. Elements are separated by white spaces.
  4710. @item magnitude, m
  4711. Set magnitude value for every frequency point set by @option{frequency}.
  4712. Number of values must be same as number of frequency points.
  4713. Values are separated by white spaces.
  4714. @item phase, p
  4715. Set phase value for every frequency point set by @option{frequency}.
  4716. Number of values must be same as number of frequency points.
  4717. Values are separated by white spaces.
  4718. @item sample_rate, r
  4719. Set sample rate, default is 44100.
  4720. @item nb_samples, n
  4721. Set number of samples per each frame. Default is 1024.
  4722. @item win_func, w
  4723. Set window function. Default is blackman.
  4724. @end table
  4725. @section anullsrc
  4726. The null audio source, return unprocessed audio frames. It is mainly useful
  4727. as a template and to be employed in analysis / debugging tools, or as
  4728. the source for filters which ignore the input data (for example the sox
  4729. synth filter).
  4730. This source accepts the following options:
  4731. @table @option
  4732. @item channel_layout, cl
  4733. Specifies the channel layout, and can be either an integer or a string
  4734. representing a channel layout. The default value of @var{channel_layout}
  4735. is "stereo".
  4736. Check the channel_layout_map definition in
  4737. @file{libavutil/channel_layout.c} for the mapping between strings and
  4738. channel layout values.
  4739. @item sample_rate, r
  4740. Specifies the sample rate, and defaults to 44100.
  4741. @item nb_samples, n
  4742. Set the number of samples per requested frames.
  4743. @item duration, d
  4744. Set the duration of the sourced audio. See
  4745. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4746. for the accepted syntax.
  4747. If not specified, or the expressed duration is negative, the audio is
  4748. supposed to be generated forever.
  4749. @end table
  4750. @subsection Examples
  4751. @itemize
  4752. @item
  4753. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4754. @example
  4755. anullsrc=r=48000:cl=4
  4756. @end example
  4757. @item
  4758. Do the same operation with a more obvious syntax:
  4759. @example
  4760. anullsrc=r=48000:cl=mono
  4761. @end example
  4762. @end itemize
  4763. All the parameters need to be explicitly defined.
  4764. @section flite
  4765. Synthesize a voice utterance using the libflite library.
  4766. To enable compilation of this filter you need to configure FFmpeg with
  4767. @code{--enable-libflite}.
  4768. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4769. The filter accepts the following options:
  4770. @table @option
  4771. @item list_voices
  4772. If set to 1, list the names of the available voices and exit
  4773. immediately. Default value is 0.
  4774. @item nb_samples, n
  4775. Set the maximum number of samples per frame. Default value is 512.
  4776. @item textfile
  4777. Set the filename containing the text to speak.
  4778. @item text
  4779. Set the text to speak.
  4780. @item voice, v
  4781. Set the voice to use for the speech synthesis. Default value is
  4782. @code{kal}. See also the @var{list_voices} option.
  4783. @end table
  4784. @subsection Examples
  4785. @itemize
  4786. @item
  4787. Read from file @file{speech.txt}, and synthesize the text using the
  4788. standard flite voice:
  4789. @example
  4790. flite=textfile=speech.txt
  4791. @end example
  4792. @item
  4793. Read the specified text selecting the @code{slt} voice:
  4794. @example
  4795. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4796. @end example
  4797. @item
  4798. Input text to ffmpeg:
  4799. @example
  4800. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4801. @end example
  4802. @item
  4803. Make @file{ffplay} speak the specified text, using @code{flite} and
  4804. the @code{lavfi} device:
  4805. @example
  4806. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4807. @end example
  4808. @end itemize
  4809. For more information about libflite, check:
  4810. @url{http://www.festvox.org/flite/}
  4811. @section anoisesrc
  4812. Generate a noise audio signal.
  4813. The filter accepts the following options:
  4814. @table @option
  4815. @item sample_rate, r
  4816. Specify the sample rate. Default value is 48000 Hz.
  4817. @item amplitude, a
  4818. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4819. is 1.0.
  4820. @item duration, d
  4821. Specify the duration of the generated audio stream. Not specifying this option
  4822. results in noise with an infinite length.
  4823. @item color, colour, c
  4824. Specify the color of noise. Available noise colors are white, pink, brown,
  4825. blue, violet and velvet. Default color is white.
  4826. @item seed, s
  4827. Specify a value used to seed the PRNG.
  4828. @item nb_samples, n
  4829. Set the number of samples per each output frame, default is 1024.
  4830. @end table
  4831. @subsection Examples
  4832. @itemize
  4833. @item
  4834. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4835. @example
  4836. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4837. @end example
  4838. @end itemize
  4839. @section hilbert
  4840. Generate odd-tap Hilbert transform FIR coefficients.
  4841. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4842. the signal by 90 degrees.
  4843. This is used in many matrix coding schemes and for analytic signal generation.
  4844. The process is often written as a multiplication by i (or j), the imaginary unit.
  4845. The filter accepts the following options:
  4846. @table @option
  4847. @item sample_rate, s
  4848. Set sample rate, default is 44100.
  4849. @item taps, t
  4850. Set length of FIR filter, default is 22051.
  4851. @item nb_samples, n
  4852. Set number of samples per each frame.
  4853. @item win_func, w
  4854. Set window function to be used when generating FIR coefficients.
  4855. @end table
  4856. @section sinc
  4857. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4858. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4859. The filter accepts the following options:
  4860. @table @option
  4861. @item sample_rate, r
  4862. Set sample rate, default is 44100.
  4863. @item nb_samples, n
  4864. Set number of samples per each frame. Default is 1024.
  4865. @item hp
  4866. Set high-pass frequency. Default is 0.
  4867. @item lp
  4868. Set low-pass frequency. Default is 0.
  4869. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4870. is higher than 0 then filter will create band-pass filter coefficients,
  4871. otherwise band-reject filter coefficients.
  4872. @item phase
  4873. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4874. @item beta
  4875. Set Kaiser window beta.
  4876. @item att
  4877. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4878. @item round
  4879. Enable rounding, by default is disabled.
  4880. @item hptaps
  4881. Set number of taps for high-pass filter.
  4882. @item lptaps
  4883. Set number of taps for low-pass filter.
  4884. @end table
  4885. @section sine
  4886. Generate an audio signal made of a sine wave with amplitude 1/8.
  4887. The audio signal is bit-exact.
  4888. The filter accepts the following options:
  4889. @table @option
  4890. @item frequency, f
  4891. Set the carrier frequency. Default is 440 Hz.
  4892. @item beep_factor, b
  4893. Enable a periodic beep every second with frequency @var{beep_factor} times
  4894. the carrier frequency. Default is 0, meaning the beep is disabled.
  4895. @item sample_rate, r
  4896. Specify the sample rate, default is 44100.
  4897. @item duration, d
  4898. Specify the duration of the generated audio stream.
  4899. @item samples_per_frame
  4900. Set the number of samples per output frame.
  4901. The expression can contain the following constants:
  4902. @table @option
  4903. @item n
  4904. The (sequential) number of the output audio frame, starting from 0.
  4905. @item pts
  4906. The PTS (Presentation TimeStamp) of the output audio frame,
  4907. expressed in @var{TB} units.
  4908. @item t
  4909. The PTS of the output audio frame, expressed in seconds.
  4910. @item TB
  4911. The timebase of the output audio frames.
  4912. @end table
  4913. Default is @code{1024}.
  4914. @end table
  4915. @subsection Examples
  4916. @itemize
  4917. @item
  4918. Generate a simple 440 Hz sine wave:
  4919. @example
  4920. sine
  4921. @end example
  4922. @item
  4923. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4924. @example
  4925. sine=220:4:d=5
  4926. sine=f=220:b=4:d=5
  4927. sine=frequency=220:beep_factor=4:duration=5
  4928. @end example
  4929. @item
  4930. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4931. pattern:
  4932. @example
  4933. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4934. @end example
  4935. @end itemize
  4936. @c man end AUDIO SOURCES
  4937. @chapter Audio Sinks
  4938. @c man begin AUDIO SINKS
  4939. Below is a description of the currently available audio sinks.
  4940. @section abuffersink
  4941. Buffer audio frames, and make them available to the end of filter chain.
  4942. This sink is mainly intended for programmatic use, in particular
  4943. through the interface defined in @file{libavfilter/buffersink.h}
  4944. or the options system.
  4945. It accepts a pointer to an AVABufferSinkContext structure, which
  4946. defines the incoming buffers' formats, to be passed as the opaque
  4947. parameter to @code{avfilter_init_filter} for initialization.
  4948. @section anullsink
  4949. Null audio sink; do absolutely nothing with the input audio. It is
  4950. mainly useful as a template and for use in analysis / debugging
  4951. tools.
  4952. @c man end AUDIO SINKS
  4953. @chapter Video Filters
  4954. @c man begin VIDEO FILTERS
  4955. When you configure your FFmpeg build, you can disable any of the
  4956. existing filters using @code{--disable-filters}.
  4957. The configure output will show the video filters included in your
  4958. build.
  4959. Below is a description of the currently available video filters.
  4960. @section addroi
  4961. Mark a region of interest in a video frame.
  4962. The frame data is passed through unchanged, but metadata is attached
  4963. to the frame indicating regions of interest which can affect the
  4964. behaviour of later encoding. Multiple regions can be marked by
  4965. applying the filter multiple times.
  4966. @table @option
  4967. @item x
  4968. Region distance in pixels from the left edge of the frame.
  4969. @item y
  4970. Region distance in pixels from the top edge of the frame.
  4971. @item w
  4972. Region width in pixels.
  4973. @item h
  4974. Region height in pixels.
  4975. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4976. and may contain the following variables:
  4977. @table @option
  4978. @item iw
  4979. Width of the input frame.
  4980. @item ih
  4981. Height of the input frame.
  4982. @end table
  4983. @item qoffset
  4984. Quantisation offset to apply within the region.
  4985. This must be a real value in the range -1 to +1. A value of zero
  4986. indicates no quality change. A negative value asks for better quality
  4987. (less quantisation), while a positive value asks for worse quality
  4988. (greater quantisation).
  4989. The range is calibrated so that the extreme values indicate the
  4990. largest possible offset - if the rest of the frame is encoded with the
  4991. worst possible quality, an offset of -1 indicates that this region
  4992. should be encoded with the best possible quality anyway. Intermediate
  4993. values are then interpolated in some codec-dependent way.
  4994. For example, in 10-bit H.264 the quantisation parameter varies between
  4995. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4996. this region should be encoded with a QP around one-tenth of the full
  4997. range better than the rest of the frame. So, if most of the frame
  4998. were to be encoded with a QP of around 30, this region would get a QP
  4999. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  5000. An extreme value of -1 would indicate that this region should be
  5001. encoded with the best possible quality regardless of the treatment of
  5002. the rest of the frame - that is, should be encoded at a QP of -12.
  5003. @item clear
  5004. If set to true, remove any existing regions of interest marked on the
  5005. frame before adding the new one.
  5006. @end table
  5007. @subsection Examples
  5008. @itemize
  5009. @item
  5010. Mark the centre quarter of the frame as interesting.
  5011. @example
  5012. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  5013. @end example
  5014. @item
  5015. Mark the 100-pixel-wide region on the left edge of the frame as very
  5016. uninteresting (to be encoded at much lower quality than the rest of
  5017. the frame).
  5018. @example
  5019. addroi=0:0:100:ih:+1/5
  5020. @end example
  5021. @end itemize
  5022. @section alphaextract
  5023. Extract the alpha component from the input as a grayscale video. This
  5024. is especially useful with the @var{alphamerge} filter.
  5025. @section alphamerge
  5026. Add or replace the alpha component of the primary input with the
  5027. grayscale value of a second input. This is intended for use with
  5028. @var{alphaextract} to allow the transmission or storage of frame
  5029. sequences that have alpha in a format that doesn't support an alpha
  5030. channel.
  5031. For example, to reconstruct full frames from a normal YUV-encoded video
  5032. and a separate video created with @var{alphaextract}, you might use:
  5033. @example
  5034. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  5035. @end example
  5036. @section amplify
  5037. Amplify differences between current pixel and pixels of adjacent frames in
  5038. same pixel location.
  5039. This filter accepts the following options:
  5040. @table @option
  5041. @item radius
  5042. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  5043. For example radius of 3 will instruct filter to calculate average of 7 frames.
  5044. @item factor
  5045. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  5046. @item threshold
  5047. Set threshold for difference amplification. Any difference greater or equal to
  5048. this value will not alter source pixel. Default is 10.
  5049. Allowed range is from 0 to 65535.
  5050. @item tolerance
  5051. Set tolerance for difference amplification. Any difference lower to
  5052. this value will not alter source pixel. Default is 0.
  5053. Allowed range is from 0 to 65535.
  5054. @item low
  5055. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5056. This option controls maximum possible value that will decrease source pixel value.
  5057. @item high
  5058. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5059. This option controls maximum possible value that will increase source pixel value.
  5060. @item planes
  5061. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  5062. @end table
  5063. @subsection Commands
  5064. This filter supports the following @ref{commands} that corresponds to option of same name:
  5065. @table @option
  5066. @item factor
  5067. @item threshold
  5068. @item tolerance
  5069. @item low
  5070. @item high
  5071. @item planes
  5072. @end table
  5073. @section ass
  5074. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  5075. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  5076. Substation Alpha) subtitles files.
  5077. This filter accepts the following option in addition to the common options from
  5078. the @ref{subtitles} filter:
  5079. @table @option
  5080. @item shaping
  5081. Set the shaping engine
  5082. Available values are:
  5083. @table @samp
  5084. @item auto
  5085. The default libass shaping engine, which is the best available.
  5086. @item simple
  5087. Fast, font-agnostic shaper that can do only substitutions
  5088. @item complex
  5089. Slower shaper using OpenType for substitutions and positioning
  5090. @end table
  5091. The default is @code{auto}.
  5092. @end table
  5093. @section atadenoise
  5094. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  5095. The filter accepts the following options:
  5096. @table @option
  5097. @item 0a
  5098. Set threshold A for 1st plane. Default is 0.02.
  5099. Valid range is 0 to 0.3.
  5100. @item 0b
  5101. Set threshold B for 1st plane. Default is 0.04.
  5102. Valid range is 0 to 5.
  5103. @item 1a
  5104. Set threshold A for 2nd plane. Default is 0.02.
  5105. Valid range is 0 to 0.3.
  5106. @item 1b
  5107. Set threshold B for 2nd plane. Default is 0.04.
  5108. Valid range is 0 to 5.
  5109. @item 2a
  5110. Set threshold A for 3rd plane. Default is 0.02.
  5111. Valid range is 0 to 0.3.
  5112. @item 2b
  5113. Set threshold B for 3rd plane. Default is 0.04.
  5114. Valid range is 0 to 5.
  5115. Threshold A is designed to react on abrupt changes in the input signal and
  5116. threshold B is designed to react on continuous changes in the input signal.
  5117. @item s
  5118. Set number of frames filter will use for averaging. Default is 9. Must be odd
  5119. number in range [5, 129].
  5120. @item p
  5121. Set what planes of frame filter will use for averaging. Default is all.
  5122. @item a
  5123. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  5124. Alternatively can be set to @code{s} serial.
  5125. Parallel can be faster then serial, while other way around is never true.
  5126. Parallel will abort early on first change being greater then thresholds, while serial
  5127. will continue processing other side of frames if they are equal or bellow thresholds.
  5128. @end table
  5129. @subsection Commands
  5130. This filter supports same @ref{commands} as options except option @code{s}.
  5131. The command accepts the same syntax of the corresponding option.
  5132. @section avgblur
  5133. Apply average blur filter.
  5134. The filter accepts the following options:
  5135. @table @option
  5136. @item sizeX
  5137. Set horizontal radius size.
  5138. @item planes
  5139. Set which planes to filter. By default all planes are filtered.
  5140. @item sizeY
  5141. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5142. Default is @code{0}.
  5143. @end table
  5144. @subsection Commands
  5145. This filter supports same commands as options.
  5146. The command accepts the same syntax of the corresponding option.
  5147. If the specified expression is not valid, it is kept at its current
  5148. value.
  5149. @section bbox
  5150. Compute the bounding box for the non-black pixels in the input frame
  5151. luminance plane.
  5152. This filter computes the bounding box containing all the pixels with a
  5153. luminance value greater than the minimum allowed value.
  5154. The parameters describing the bounding box are printed on the filter
  5155. log.
  5156. The filter accepts the following option:
  5157. @table @option
  5158. @item min_val
  5159. Set the minimal luminance value. Default is @code{16}.
  5160. @end table
  5161. @section bilateral
  5162. Apply bilateral filter, spatial smoothing while preserving edges.
  5163. The filter accepts the following options:
  5164. @table @option
  5165. @item sigmaS
  5166. Set sigma of gaussian function to calculate spatial weight.
  5167. Allowed range is 0 to 512. Default is 0.1.
  5168. @item sigmaR
  5169. Set sigma of gaussian function to calculate range weight.
  5170. Allowed range is 0 to 1. Default is 0.1.
  5171. @item planes
  5172. Set planes to filter. Default is first only.
  5173. @end table
  5174. @section bitplanenoise
  5175. Show and measure bit plane noise.
  5176. The filter accepts the following options:
  5177. @table @option
  5178. @item bitplane
  5179. Set which plane to analyze. Default is @code{1}.
  5180. @item filter
  5181. Filter out noisy pixels from @code{bitplane} set above.
  5182. Default is disabled.
  5183. @end table
  5184. @section blackdetect
  5185. Detect video intervals that are (almost) completely black. Can be
  5186. useful to detect chapter transitions, commercials, or invalid
  5187. recordings.
  5188. The filter outputs its detection analysis to both the log as well as
  5189. frame metadata. If a black segment of at least the specified minimum
  5190. duration is found, a line with the start and end timestamps as well
  5191. as duration is printed to the log with level @code{info}. In addition,
  5192. a log line with level @code{debug} is printed per frame showing the
  5193. black amount detected for that frame.
  5194. The filter also attaches metadata to the first frame of a black
  5195. segment with key @code{lavfi.black_start} and to the first frame
  5196. after the black segment ends with key @code{lavfi.black_end}. The
  5197. value is the frame's timestamp. This metadata is added regardless
  5198. of the minimum duration specified.
  5199. The filter accepts the following options:
  5200. @table @option
  5201. @item black_min_duration, d
  5202. Set the minimum detected black duration expressed in seconds. It must
  5203. be a non-negative floating point number.
  5204. Default value is 2.0.
  5205. @item picture_black_ratio_th, pic_th
  5206. Set the threshold for considering a picture "black".
  5207. Express the minimum value for the ratio:
  5208. @example
  5209. @var{nb_black_pixels} / @var{nb_pixels}
  5210. @end example
  5211. for which a picture is considered black.
  5212. Default value is 0.98.
  5213. @item pixel_black_th, pix_th
  5214. Set the threshold for considering a pixel "black".
  5215. The threshold expresses the maximum pixel luminance value for which a
  5216. pixel is considered "black". The provided value is scaled according to
  5217. the following equation:
  5218. @example
  5219. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5220. @end example
  5221. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5222. the input video format, the range is [0-255] for YUV full-range
  5223. formats and [16-235] for YUV non full-range formats.
  5224. Default value is 0.10.
  5225. @end table
  5226. The following example sets the maximum pixel threshold to the minimum
  5227. value, and detects only black intervals of 2 or more seconds:
  5228. @example
  5229. blackdetect=d=2:pix_th=0.00
  5230. @end example
  5231. @section blackframe
  5232. Detect frames that are (almost) completely black. Can be useful to
  5233. detect chapter transitions or commercials. Output lines consist of
  5234. the frame number of the detected frame, the percentage of blackness,
  5235. the position in the file if known or -1 and the timestamp in seconds.
  5236. In order to display the output lines, you need to set the loglevel at
  5237. least to the AV_LOG_INFO value.
  5238. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5239. The value represents the percentage of pixels in the picture that
  5240. are below the threshold value.
  5241. It accepts the following parameters:
  5242. @table @option
  5243. @item amount
  5244. The percentage of the pixels that have to be below the threshold; it defaults to
  5245. @code{98}.
  5246. @item threshold, thresh
  5247. The threshold below which a pixel value is considered black; it defaults to
  5248. @code{32}.
  5249. @end table
  5250. @anchor{blend}
  5251. @section blend
  5252. Blend two video frames into each other.
  5253. The @code{blend} filter takes two input streams and outputs one
  5254. stream, the first input is the "top" layer and second input is
  5255. "bottom" layer. By default, the output terminates when the longest input terminates.
  5256. The @code{tblend} (time blend) filter takes two consecutive frames
  5257. from one single stream, and outputs the result obtained by blending
  5258. the new frame on top of the old frame.
  5259. A description of the accepted options follows.
  5260. @table @option
  5261. @item c0_mode
  5262. @item c1_mode
  5263. @item c2_mode
  5264. @item c3_mode
  5265. @item all_mode
  5266. Set blend mode for specific pixel component or all pixel components in case
  5267. of @var{all_mode}. Default value is @code{normal}.
  5268. Available values for component modes are:
  5269. @table @samp
  5270. @item addition
  5271. @item grainmerge
  5272. @item and
  5273. @item average
  5274. @item burn
  5275. @item darken
  5276. @item difference
  5277. @item grainextract
  5278. @item divide
  5279. @item dodge
  5280. @item freeze
  5281. @item exclusion
  5282. @item extremity
  5283. @item glow
  5284. @item hardlight
  5285. @item hardmix
  5286. @item heat
  5287. @item lighten
  5288. @item linearlight
  5289. @item multiply
  5290. @item multiply128
  5291. @item negation
  5292. @item normal
  5293. @item or
  5294. @item overlay
  5295. @item phoenix
  5296. @item pinlight
  5297. @item reflect
  5298. @item screen
  5299. @item softlight
  5300. @item subtract
  5301. @item vividlight
  5302. @item xor
  5303. @end table
  5304. @item c0_opacity
  5305. @item c1_opacity
  5306. @item c2_opacity
  5307. @item c3_opacity
  5308. @item all_opacity
  5309. Set blend opacity for specific pixel component or all pixel components in case
  5310. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5311. @item c0_expr
  5312. @item c1_expr
  5313. @item c2_expr
  5314. @item c3_expr
  5315. @item all_expr
  5316. Set blend expression for specific pixel component or all pixel components in case
  5317. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5318. The expressions can use the following variables:
  5319. @table @option
  5320. @item N
  5321. The sequential number of the filtered frame, starting from @code{0}.
  5322. @item X
  5323. @item Y
  5324. the coordinates of the current sample
  5325. @item W
  5326. @item H
  5327. the width and height of currently filtered plane
  5328. @item SW
  5329. @item SH
  5330. Width and height scale for the plane being filtered. It is the
  5331. ratio between the dimensions of the current plane to the luma plane,
  5332. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5333. the luma plane and @code{0.5,0.5} for the chroma planes.
  5334. @item T
  5335. Time of the current frame, expressed in seconds.
  5336. @item TOP, A
  5337. Value of pixel component at current location for first video frame (top layer).
  5338. @item BOTTOM, B
  5339. Value of pixel component at current location for second video frame (bottom layer).
  5340. @end table
  5341. @end table
  5342. The @code{blend} filter also supports the @ref{framesync} options.
  5343. @subsection Examples
  5344. @itemize
  5345. @item
  5346. Apply transition from bottom layer to top layer in first 10 seconds:
  5347. @example
  5348. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5349. @end example
  5350. @item
  5351. Apply linear horizontal transition from top layer to bottom layer:
  5352. @example
  5353. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5354. @end example
  5355. @item
  5356. Apply 1x1 checkerboard effect:
  5357. @example
  5358. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5359. @end example
  5360. @item
  5361. Apply uncover left effect:
  5362. @example
  5363. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5364. @end example
  5365. @item
  5366. Apply uncover down effect:
  5367. @example
  5368. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5369. @end example
  5370. @item
  5371. Apply uncover up-left effect:
  5372. @example
  5373. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5374. @end example
  5375. @item
  5376. Split diagonally video and shows top and bottom layer on each side:
  5377. @example
  5378. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5379. @end example
  5380. @item
  5381. Display differences between the current and the previous frame:
  5382. @example
  5383. tblend=all_mode=grainextract
  5384. @end example
  5385. @end itemize
  5386. @section bm3d
  5387. Denoise frames using Block-Matching 3D algorithm.
  5388. The filter accepts the following options.
  5389. @table @option
  5390. @item sigma
  5391. Set denoising strength. Default value is 1.
  5392. Allowed range is from 0 to 999.9.
  5393. The denoising algorithm is very sensitive to sigma, so adjust it
  5394. according to the source.
  5395. @item block
  5396. Set local patch size. This sets dimensions in 2D.
  5397. @item bstep
  5398. Set sliding step for processing blocks. Default value is 4.
  5399. Allowed range is from 1 to 64.
  5400. Smaller values allows processing more reference blocks and is slower.
  5401. @item group
  5402. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5403. When set to 1, no block matching is done. Larger values allows more blocks
  5404. in single group.
  5405. Allowed range is from 1 to 256.
  5406. @item range
  5407. Set radius for search block matching. Default is 9.
  5408. Allowed range is from 1 to INT32_MAX.
  5409. @item mstep
  5410. Set step between two search locations for block matching. Default is 1.
  5411. Allowed range is from 1 to 64. Smaller is slower.
  5412. @item thmse
  5413. Set threshold of mean square error for block matching. Valid range is 0 to
  5414. INT32_MAX.
  5415. @item hdthr
  5416. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5417. Larger values results in stronger hard-thresholding filtering in frequency
  5418. domain.
  5419. @item estim
  5420. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5421. Default is @code{basic}.
  5422. @item ref
  5423. If enabled, filter will use 2nd stream for block matching.
  5424. Default is disabled for @code{basic} value of @var{estim} option,
  5425. and always enabled if value of @var{estim} is @code{final}.
  5426. @item planes
  5427. Set planes to filter. Default is all available except alpha.
  5428. @end table
  5429. @subsection Examples
  5430. @itemize
  5431. @item
  5432. Basic filtering with bm3d:
  5433. @example
  5434. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5435. @end example
  5436. @item
  5437. Same as above, but filtering only luma:
  5438. @example
  5439. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5440. @end example
  5441. @item
  5442. Same as above, but with both estimation modes:
  5443. @example
  5444. 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
  5445. @end example
  5446. @item
  5447. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5448. @example
  5449. 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
  5450. @end example
  5451. @end itemize
  5452. @section boxblur
  5453. Apply a boxblur algorithm to the input video.
  5454. It accepts the following parameters:
  5455. @table @option
  5456. @item luma_radius, lr
  5457. @item luma_power, lp
  5458. @item chroma_radius, cr
  5459. @item chroma_power, cp
  5460. @item alpha_radius, ar
  5461. @item alpha_power, ap
  5462. @end table
  5463. A description of the accepted options follows.
  5464. @table @option
  5465. @item luma_radius, lr
  5466. @item chroma_radius, cr
  5467. @item alpha_radius, ar
  5468. Set an expression for the box radius in pixels used for blurring the
  5469. corresponding input plane.
  5470. The radius value must be a non-negative number, and must not be
  5471. greater than the value of the expression @code{min(w,h)/2} for the
  5472. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5473. planes.
  5474. Default value for @option{luma_radius} is "2". If not specified,
  5475. @option{chroma_radius} and @option{alpha_radius} default to the
  5476. corresponding value set for @option{luma_radius}.
  5477. The expressions can contain the following constants:
  5478. @table @option
  5479. @item w
  5480. @item h
  5481. The input width and height in pixels.
  5482. @item cw
  5483. @item ch
  5484. The input chroma image width and height in pixels.
  5485. @item hsub
  5486. @item vsub
  5487. The horizontal and vertical chroma subsample values. For example, for the
  5488. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5489. @end table
  5490. @item luma_power, lp
  5491. @item chroma_power, cp
  5492. @item alpha_power, ap
  5493. Specify how many times the boxblur filter is applied to the
  5494. corresponding plane.
  5495. Default value for @option{luma_power} is 2. If not specified,
  5496. @option{chroma_power} and @option{alpha_power} default to the
  5497. corresponding value set for @option{luma_power}.
  5498. A value of 0 will disable the effect.
  5499. @end table
  5500. @subsection Examples
  5501. @itemize
  5502. @item
  5503. Apply a boxblur filter with the luma, chroma, and alpha radii
  5504. set to 2:
  5505. @example
  5506. boxblur=luma_radius=2:luma_power=1
  5507. boxblur=2:1
  5508. @end example
  5509. @item
  5510. Set the luma radius to 2, and alpha and chroma radius to 0:
  5511. @example
  5512. boxblur=2:1:cr=0:ar=0
  5513. @end example
  5514. @item
  5515. Set the luma and chroma radii to a fraction of the video dimension:
  5516. @example
  5517. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5518. @end example
  5519. @end itemize
  5520. @section bwdif
  5521. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5522. Deinterlacing Filter").
  5523. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5524. interpolation algorithms.
  5525. It accepts the following parameters:
  5526. @table @option
  5527. @item mode
  5528. The interlacing mode to adopt. It accepts one of the following values:
  5529. @table @option
  5530. @item 0, send_frame
  5531. Output one frame for each frame.
  5532. @item 1, send_field
  5533. Output one frame for each field.
  5534. @end table
  5535. The default value is @code{send_field}.
  5536. @item parity
  5537. The picture field parity assumed for the input interlaced video. It accepts one
  5538. of the following values:
  5539. @table @option
  5540. @item 0, tff
  5541. Assume the top field is first.
  5542. @item 1, bff
  5543. Assume the bottom field is first.
  5544. @item -1, auto
  5545. Enable automatic detection of field parity.
  5546. @end table
  5547. The default value is @code{auto}.
  5548. If the interlacing is unknown or the decoder does not export this information,
  5549. top field first will be assumed.
  5550. @item deint
  5551. Specify which frames to deinterlace. Accepts one of the following
  5552. values:
  5553. @table @option
  5554. @item 0, all
  5555. Deinterlace all frames.
  5556. @item 1, interlaced
  5557. Only deinterlace frames marked as interlaced.
  5558. @end table
  5559. The default value is @code{all}.
  5560. @end table
  5561. @section cas
  5562. Apply Contrast Adaptive Sharpen filter to video stream.
  5563. The filter accepts the following options:
  5564. @table @option
  5565. @item strength
  5566. Set the sharpening strength. Default value is 0.
  5567. @item planes
  5568. Set planes to filter. Default value is to filter all
  5569. planes except alpha plane.
  5570. @end table
  5571. @section chromahold
  5572. Remove all color information for all colors except for certain one.
  5573. The filter accepts the following options:
  5574. @table @option
  5575. @item color
  5576. The color which will not be replaced with neutral chroma.
  5577. @item similarity
  5578. Similarity percentage with the above color.
  5579. 0.01 matches only the exact key color, while 1.0 matches everything.
  5580. @item blend
  5581. Blend percentage.
  5582. 0.0 makes pixels either fully gray, or not gray at all.
  5583. Higher values result in more preserved color.
  5584. @item yuv
  5585. Signals that the color passed is already in YUV instead of RGB.
  5586. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5587. This can be used to pass exact YUV values as hexadecimal numbers.
  5588. @end table
  5589. @subsection Commands
  5590. This filter supports same @ref{commands} as options.
  5591. The command accepts the same syntax of the corresponding option.
  5592. If the specified expression is not valid, it is kept at its current
  5593. value.
  5594. @section chromakey
  5595. YUV colorspace color/chroma keying.
  5596. The filter accepts the following options:
  5597. @table @option
  5598. @item color
  5599. The color which will be replaced with transparency.
  5600. @item similarity
  5601. Similarity percentage with the key color.
  5602. 0.01 matches only the exact key color, while 1.0 matches everything.
  5603. @item blend
  5604. Blend percentage.
  5605. 0.0 makes pixels either fully transparent, or not transparent at all.
  5606. Higher values result in semi-transparent pixels, with a higher transparency
  5607. the more similar the pixels color is to the key color.
  5608. @item yuv
  5609. Signals that the color passed is already in YUV instead of RGB.
  5610. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5611. This can be used to pass exact YUV values as hexadecimal numbers.
  5612. @end table
  5613. @subsection Commands
  5614. This filter supports same @ref{commands} as options.
  5615. The command accepts the same syntax of the corresponding option.
  5616. If the specified expression is not valid, it is kept at its current
  5617. value.
  5618. @subsection Examples
  5619. @itemize
  5620. @item
  5621. Make every green pixel in the input image transparent:
  5622. @example
  5623. ffmpeg -i input.png -vf chromakey=green out.png
  5624. @end example
  5625. @item
  5626. Overlay a greenscreen-video on top of a static black background.
  5627. @example
  5628. 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
  5629. @end example
  5630. @end itemize
  5631. @section chromanr
  5632. Reduce chrominance noise.
  5633. The filter accepts the following options:
  5634. @table @option
  5635. @item thres
  5636. Set threshold for averaging chrominance values.
  5637. Sum of absolute difference of U and V pixel components or current
  5638. pixel and neighbour pixels lower than this threshold will be used in
  5639. averaging. Luma component is left unchanged and is copied to output.
  5640. Default value is 30. Allowed range is from 1 to 200.
  5641. @item sizew
  5642. Set horizontal radius of rectangle used for averaging.
  5643. Allowed range is from 1 to 100. Default value is 5.
  5644. @item sizeh
  5645. Set vertical radius of rectangle used for averaging.
  5646. Allowed range is from 1 to 100. Default value is 5.
  5647. @item stepw
  5648. Set horizontal step when averaging. Default value is 1.
  5649. Allowed range is from 1 to 50.
  5650. Mostly useful to speed-up filtering.
  5651. @item steph
  5652. Set vertical step when averaging. Default value is 1.
  5653. Allowed range is from 1 to 50.
  5654. Mostly useful to speed-up filtering.
  5655. @end table
  5656. @subsection Commands
  5657. This filter supports same @ref{commands} as options.
  5658. The command accepts the same syntax of the corresponding option.
  5659. @section chromashift
  5660. Shift chroma pixels horizontally and/or vertically.
  5661. The filter accepts the following options:
  5662. @table @option
  5663. @item cbh
  5664. Set amount to shift chroma-blue horizontally.
  5665. @item cbv
  5666. Set amount to shift chroma-blue vertically.
  5667. @item crh
  5668. Set amount to shift chroma-red horizontally.
  5669. @item crv
  5670. Set amount to shift chroma-red vertically.
  5671. @item edge
  5672. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5673. @end table
  5674. @subsection Commands
  5675. This filter supports the all above options as @ref{commands}.
  5676. @section ciescope
  5677. Display CIE color diagram with pixels overlaid onto it.
  5678. The filter accepts the following options:
  5679. @table @option
  5680. @item system
  5681. Set color system.
  5682. @table @samp
  5683. @item ntsc, 470m
  5684. @item ebu, 470bg
  5685. @item smpte
  5686. @item 240m
  5687. @item apple
  5688. @item widergb
  5689. @item cie1931
  5690. @item rec709, hdtv
  5691. @item uhdtv, rec2020
  5692. @item dcip3
  5693. @end table
  5694. @item cie
  5695. Set CIE system.
  5696. @table @samp
  5697. @item xyy
  5698. @item ucs
  5699. @item luv
  5700. @end table
  5701. @item gamuts
  5702. Set what gamuts to draw.
  5703. See @code{system} option for available values.
  5704. @item size, s
  5705. Set ciescope size, by default set to 512.
  5706. @item intensity, i
  5707. Set intensity used to map input pixel values to CIE diagram.
  5708. @item contrast
  5709. Set contrast used to draw tongue colors that are out of active color system gamut.
  5710. @item corrgamma
  5711. Correct gamma displayed on scope, by default enabled.
  5712. @item showwhite
  5713. Show white point on CIE diagram, by default disabled.
  5714. @item gamma
  5715. Set input gamma. Used only with XYZ input color space.
  5716. @end table
  5717. @section codecview
  5718. Visualize information exported by some codecs.
  5719. Some codecs can export information through frames using side-data or other
  5720. means. For example, some MPEG based codecs export motion vectors through the
  5721. @var{export_mvs} flag in the codec @option{flags2} option.
  5722. The filter accepts the following option:
  5723. @table @option
  5724. @item mv
  5725. Set motion vectors to visualize.
  5726. Available flags for @var{mv} are:
  5727. @table @samp
  5728. @item pf
  5729. forward predicted MVs of P-frames
  5730. @item bf
  5731. forward predicted MVs of B-frames
  5732. @item bb
  5733. backward predicted MVs of B-frames
  5734. @end table
  5735. @item qp
  5736. Display quantization parameters using the chroma planes.
  5737. @item mv_type, mvt
  5738. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5739. Available flags for @var{mv_type} are:
  5740. @table @samp
  5741. @item fp
  5742. forward predicted MVs
  5743. @item bp
  5744. backward predicted MVs
  5745. @end table
  5746. @item frame_type, ft
  5747. Set frame type to visualize motion vectors of.
  5748. Available flags for @var{frame_type} are:
  5749. @table @samp
  5750. @item if
  5751. intra-coded frames (I-frames)
  5752. @item pf
  5753. predicted frames (P-frames)
  5754. @item bf
  5755. bi-directionally predicted frames (B-frames)
  5756. @end table
  5757. @end table
  5758. @subsection Examples
  5759. @itemize
  5760. @item
  5761. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5762. @example
  5763. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5764. @end example
  5765. @item
  5766. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5767. @example
  5768. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5769. @end example
  5770. @end itemize
  5771. @section colorbalance
  5772. Modify intensity of primary colors (red, green and blue) of input frames.
  5773. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5774. regions for the red-cyan, green-magenta or blue-yellow balance.
  5775. A positive adjustment value shifts the balance towards the primary color, a negative
  5776. value towards the complementary color.
  5777. The filter accepts the following options:
  5778. @table @option
  5779. @item rs
  5780. @item gs
  5781. @item bs
  5782. Adjust red, green and blue shadows (darkest pixels).
  5783. @item rm
  5784. @item gm
  5785. @item bm
  5786. Adjust red, green and blue midtones (medium pixels).
  5787. @item rh
  5788. @item gh
  5789. @item bh
  5790. Adjust red, green and blue highlights (brightest pixels).
  5791. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5792. @item pl
  5793. Preserve lightness when changing color balance. Default is disabled.
  5794. @end table
  5795. @subsection Examples
  5796. @itemize
  5797. @item
  5798. Add red color cast to shadows:
  5799. @example
  5800. colorbalance=rs=.3
  5801. @end example
  5802. @end itemize
  5803. @subsection Commands
  5804. This filter supports the all above options as @ref{commands}.
  5805. @section colorchannelmixer
  5806. Adjust video input frames by re-mixing color channels.
  5807. This filter modifies a color channel by adding the values associated to
  5808. the other channels of the same pixels. For example if the value to
  5809. modify is red, the output value will be:
  5810. @example
  5811. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5812. @end example
  5813. The filter accepts the following options:
  5814. @table @option
  5815. @item rr
  5816. @item rg
  5817. @item rb
  5818. @item ra
  5819. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5820. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5821. @item gr
  5822. @item gg
  5823. @item gb
  5824. @item ga
  5825. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5826. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5827. @item br
  5828. @item bg
  5829. @item bb
  5830. @item ba
  5831. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5832. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5833. @item ar
  5834. @item ag
  5835. @item ab
  5836. @item aa
  5837. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5838. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5839. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5840. @end table
  5841. @subsection Examples
  5842. @itemize
  5843. @item
  5844. Convert source to grayscale:
  5845. @example
  5846. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5847. @end example
  5848. @item
  5849. Simulate sepia tones:
  5850. @example
  5851. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5852. @end example
  5853. @end itemize
  5854. @subsection Commands
  5855. This filter supports the all above options as @ref{commands}.
  5856. @section colorkey
  5857. RGB colorspace color keying.
  5858. The filter accepts the following options:
  5859. @table @option
  5860. @item color
  5861. The color which will be replaced with transparency.
  5862. @item similarity
  5863. Similarity percentage with the key color.
  5864. 0.01 matches only the exact key color, while 1.0 matches everything.
  5865. @item blend
  5866. Blend percentage.
  5867. 0.0 makes pixels either fully transparent, or not transparent at all.
  5868. Higher values result in semi-transparent pixels, with a higher transparency
  5869. the more similar the pixels color is to the key color.
  5870. @end table
  5871. @subsection Examples
  5872. @itemize
  5873. @item
  5874. Make every green pixel in the input image transparent:
  5875. @example
  5876. ffmpeg -i input.png -vf colorkey=green out.png
  5877. @end example
  5878. @item
  5879. Overlay a greenscreen-video on top of a static background image.
  5880. @example
  5881. 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
  5882. @end example
  5883. @end itemize
  5884. @subsection Commands
  5885. This filter supports same @ref{commands} as options.
  5886. The command accepts the same syntax of the corresponding option.
  5887. If the specified expression is not valid, it is kept at its current
  5888. value.
  5889. @section colorhold
  5890. Remove all color information for all RGB colors except for certain one.
  5891. The filter accepts the following options:
  5892. @table @option
  5893. @item color
  5894. The color which will not be replaced with neutral gray.
  5895. @item similarity
  5896. Similarity percentage with the above color.
  5897. 0.01 matches only the exact key color, while 1.0 matches everything.
  5898. @item blend
  5899. Blend percentage. 0.0 makes pixels fully gray.
  5900. Higher values result in more preserved color.
  5901. @end table
  5902. @subsection Commands
  5903. This filter supports same @ref{commands} as options.
  5904. The command accepts the same syntax of the corresponding option.
  5905. If the specified expression is not valid, it is kept at its current
  5906. value.
  5907. @section colorlevels
  5908. Adjust video input frames using levels.
  5909. The filter accepts the following options:
  5910. @table @option
  5911. @item rimin
  5912. @item gimin
  5913. @item bimin
  5914. @item aimin
  5915. Adjust red, green, blue and alpha input black point.
  5916. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5917. @item rimax
  5918. @item gimax
  5919. @item bimax
  5920. @item aimax
  5921. Adjust red, green, blue and alpha input white point.
  5922. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5923. Input levels are used to lighten highlights (bright tones), darken shadows
  5924. (dark tones), change the balance of bright and dark tones.
  5925. @item romin
  5926. @item gomin
  5927. @item bomin
  5928. @item aomin
  5929. Adjust red, green, blue and alpha output black point.
  5930. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5931. @item romax
  5932. @item gomax
  5933. @item bomax
  5934. @item aomax
  5935. Adjust red, green, blue and alpha output white point.
  5936. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5937. Output levels allows manual selection of a constrained output level range.
  5938. @end table
  5939. @subsection Examples
  5940. @itemize
  5941. @item
  5942. Make video output darker:
  5943. @example
  5944. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5945. @end example
  5946. @item
  5947. Increase contrast:
  5948. @example
  5949. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5950. @end example
  5951. @item
  5952. Make video output lighter:
  5953. @example
  5954. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5955. @end example
  5956. @item
  5957. Increase brightness:
  5958. @example
  5959. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5960. @end example
  5961. @end itemize
  5962. @subsection Commands
  5963. This filter supports the all above options as @ref{commands}.
  5964. @section colormatrix
  5965. Convert color matrix.
  5966. The filter accepts the following options:
  5967. @table @option
  5968. @item src
  5969. @item dst
  5970. Specify the source and destination color matrix. Both values must be
  5971. specified.
  5972. The accepted values are:
  5973. @table @samp
  5974. @item bt709
  5975. BT.709
  5976. @item fcc
  5977. FCC
  5978. @item bt601
  5979. BT.601
  5980. @item bt470
  5981. BT.470
  5982. @item bt470bg
  5983. BT.470BG
  5984. @item smpte170m
  5985. SMPTE-170M
  5986. @item smpte240m
  5987. SMPTE-240M
  5988. @item bt2020
  5989. BT.2020
  5990. @end table
  5991. @end table
  5992. For example to convert from BT.601 to SMPTE-240M, use the command:
  5993. @example
  5994. colormatrix=bt601:smpte240m
  5995. @end example
  5996. @section colorspace
  5997. Convert colorspace, transfer characteristics or color primaries.
  5998. Input video needs to have an even size.
  5999. The filter accepts the following options:
  6000. @table @option
  6001. @anchor{all}
  6002. @item all
  6003. Specify all color properties at once.
  6004. The accepted values are:
  6005. @table @samp
  6006. @item bt470m
  6007. BT.470M
  6008. @item bt470bg
  6009. BT.470BG
  6010. @item bt601-6-525
  6011. BT.601-6 525
  6012. @item bt601-6-625
  6013. BT.601-6 625
  6014. @item bt709
  6015. BT.709
  6016. @item smpte170m
  6017. SMPTE-170M
  6018. @item smpte240m
  6019. SMPTE-240M
  6020. @item bt2020
  6021. BT.2020
  6022. @end table
  6023. @anchor{space}
  6024. @item space
  6025. Specify output colorspace.
  6026. The accepted values are:
  6027. @table @samp
  6028. @item bt709
  6029. BT.709
  6030. @item fcc
  6031. FCC
  6032. @item bt470bg
  6033. BT.470BG or BT.601-6 625
  6034. @item smpte170m
  6035. SMPTE-170M or BT.601-6 525
  6036. @item smpte240m
  6037. SMPTE-240M
  6038. @item ycgco
  6039. YCgCo
  6040. @item bt2020ncl
  6041. BT.2020 with non-constant luminance
  6042. @end table
  6043. @anchor{trc}
  6044. @item trc
  6045. Specify output transfer characteristics.
  6046. The accepted values are:
  6047. @table @samp
  6048. @item bt709
  6049. BT.709
  6050. @item bt470m
  6051. BT.470M
  6052. @item bt470bg
  6053. BT.470BG
  6054. @item gamma22
  6055. Constant gamma of 2.2
  6056. @item gamma28
  6057. Constant gamma of 2.8
  6058. @item smpte170m
  6059. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  6060. @item smpte240m
  6061. SMPTE-240M
  6062. @item srgb
  6063. SRGB
  6064. @item iec61966-2-1
  6065. iec61966-2-1
  6066. @item iec61966-2-4
  6067. iec61966-2-4
  6068. @item xvycc
  6069. xvycc
  6070. @item bt2020-10
  6071. BT.2020 for 10-bits content
  6072. @item bt2020-12
  6073. BT.2020 for 12-bits content
  6074. @end table
  6075. @anchor{primaries}
  6076. @item primaries
  6077. Specify output color primaries.
  6078. The accepted values are:
  6079. @table @samp
  6080. @item bt709
  6081. BT.709
  6082. @item bt470m
  6083. BT.470M
  6084. @item bt470bg
  6085. BT.470BG or BT.601-6 625
  6086. @item smpte170m
  6087. SMPTE-170M or BT.601-6 525
  6088. @item smpte240m
  6089. SMPTE-240M
  6090. @item film
  6091. film
  6092. @item smpte431
  6093. SMPTE-431
  6094. @item smpte432
  6095. SMPTE-432
  6096. @item bt2020
  6097. BT.2020
  6098. @item jedec-p22
  6099. JEDEC P22 phosphors
  6100. @end table
  6101. @anchor{range}
  6102. @item range
  6103. Specify output color range.
  6104. The accepted values are:
  6105. @table @samp
  6106. @item tv
  6107. TV (restricted) range
  6108. @item mpeg
  6109. MPEG (restricted) range
  6110. @item pc
  6111. PC (full) range
  6112. @item jpeg
  6113. JPEG (full) range
  6114. @end table
  6115. @item format
  6116. Specify output color format.
  6117. The accepted values are:
  6118. @table @samp
  6119. @item yuv420p
  6120. YUV 4:2:0 planar 8-bits
  6121. @item yuv420p10
  6122. YUV 4:2:0 planar 10-bits
  6123. @item yuv420p12
  6124. YUV 4:2:0 planar 12-bits
  6125. @item yuv422p
  6126. YUV 4:2:2 planar 8-bits
  6127. @item yuv422p10
  6128. YUV 4:2:2 planar 10-bits
  6129. @item yuv422p12
  6130. YUV 4:2:2 planar 12-bits
  6131. @item yuv444p
  6132. YUV 4:4:4 planar 8-bits
  6133. @item yuv444p10
  6134. YUV 4:4:4 planar 10-bits
  6135. @item yuv444p12
  6136. YUV 4:4:4 planar 12-bits
  6137. @end table
  6138. @item fast
  6139. Do a fast conversion, which skips gamma/primary correction. This will take
  6140. significantly less CPU, but will be mathematically incorrect. To get output
  6141. compatible with that produced by the colormatrix filter, use fast=1.
  6142. @item dither
  6143. Specify dithering mode.
  6144. The accepted values are:
  6145. @table @samp
  6146. @item none
  6147. No dithering
  6148. @item fsb
  6149. Floyd-Steinberg dithering
  6150. @end table
  6151. @item wpadapt
  6152. Whitepoint adaptation mode.
  6153. The accepted values are:
  6154. @table @samp
  6155. @item bradford
  6156. Bradford whitepoint adaptation
  6157. @item vonkries
  6158. von Kries whitepoint adaptation
  6159. @item identity
  6160. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  6161. @end table
  6162. @item iall
  6163. Override all input properties at once. Same accepted values as @ref{all}.
  6164. @item ispace
  6165. Override input colorspace. Same accepted values as @ref{space}.
  6166. @item iprimaries
  6167. Override input color primaries. Same accepted values as @ref{primaries}.
  6168. @item itrc
  6169. Override input transfer characteristics. Same accepted values as @ref{trc}.
  6170. @item irange
  6171. Override input color range. Same accepted values as @ref{range}.
  6172. @end table
  6173. The filter converts the transfer characteristics, color space and color
  6174. primaries to the specified user values. The output value, if not specified,
  6175. is set to a default value based on the "all" property. If that property is
  6176. also not specified, the filter will log an error. The output color range and
  6177. format default to the same value as the input color range and format. The
  6178. input transfer characteristics, color space, color primaries and color range
  6179. should be set on the input data. If any of these are missing, the filter will
  6180. log an error and no conversion will take place.
  6181. For example to convert the input to SMPTE-240M, use the command:
  6182. @example
  6183. colorspace=smpte240m
  6184. @end example
  6185. @section convolution
  6186. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  6187. The filter accepts the following options:
  6188. @table @option
  6189. @item 0m
  6190. @item 1m
  6191. @item 2m
  6192. @item 3m
  6193. Set matrix for each plane.
  6194. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  6195. and from 1 to 49 odd number of signed integers in @var{row} mode.
  6196. @item 0rdiv
  6197. @item 1rdiv
  6198. @item 2rdiv
  6199. @item 3rdiv
  6200. Set multiplier for calculated value for each plane.
  6201. If unset or 0, it will be sum of all matrix elements.
  6202. @item 0bias
  6203. @item 1bias
  6204. @item 2bias
  6205. @item 3bias
  6206. Set bias for each plane. This value is added to the result of the multiplication.
  6207. Useful for making the overall image brighter or darker. Default is 0.0.
  6208. @item 0mode
  6209. @item 1mode
  6210. @item 2mode
  6211. @item 3mode
  6212. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  6213. Default is @var{square}.
  6214. @end table
  6215. @subsection Examples
  6216. @itemize
  6217. @item
  6218. Apply sharpen:
  6219. @example
  6220. 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"
  6221. @end example
  6222. @item
  6223. Apply blur:
  6224. @example
  6225. 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"
  6226. @end example
  6227. @item
  6228. Apply edge enhance:
  6229. @example
  6230. 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"
  6231. @end example
  6232. @item
  6233. Apply edge detect:
  6234. @example
  6235. 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"
  6236. @end example
  6237. @item
  6238. Apply laplacian edge detector which includes diagonals:
  6239. @example
  6240. 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"
  6241. @end example
  6242. @item
  6243. Apply emboss:
  6244. @example
  6245. 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"
  6246. @end example
  6247. @end itemize
  6248. @section convolve
  6249. Apply 2D convolution of video stream in frequency domain using second stream
  6250. as impulse.
  6251. The filter accepts the following options:
  6252. @table @option
  6253. @item planes
  6254. Set which planes to process.
  6255. @item impulse
  6256. Set which impulse video frames will be processed, can be @var{first}
  6257. or @var{all}. Default is @var{all}.
  6258. @end table
  6259. The @code{convolve} filter also supports the @ref{framesync} options.
  6260. @section copy
  6261. Copy the input video source unchanged to the output. This is mainly useful for
  6262. testing purposes.
  6263. @anchor{coreimage}
  6264. @section coreimage
  6265. Video filtering on GPU using Apple's CoreImage API on OSX.
  6266. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6267. processed by video hardware. However, software-based OpenGL implementations
  6268. exist which means there is no guarantee for hardware processing. It depends on
  6269. the respective OSX.
  6270. There are many filters and image generators provided by Apple that come with a
  6271. large variety of options. The filter has to be referenced by its name along
  6272. with its options.
  6273. The coreimage filter accepts the following options:
  6274. @table @option
  6275. @item list_filters
  6276. List all available filters and generators along with all their respective
  6277. options as well as possible minimum and maximum values along with the default
  6278. values.
  6279. @example
  6280. list_filters=true
  6281. @end example
  6282. @item filter
  6283. Specify all filters by their respective name and options.
  6284. Use @var{list_filters} to determine all valid filter names and options.
  6285. Numerical options are specified by a float value and are automatically clamped
  6286. to their respective value range. Vector and color options have to be specified
  6287. by a list of space separated float values. Character escaping has to be done.
  6288. A special option name @code{default} is available to use default options for a
  6289. filter.
  6290. It is required to specify either @code{default} or at least one of the filter options.
  6291. All omitted options are used with their default values.
  6292. The syntax of the filter string is as follows:
  6293. @example
  6294. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6295. @end example
  6296. @item output_rect
  6297. Specify a rectangle where the output of the filter chain is copied into the
  6298. input image. It is given by a list of space separated float values:
  6299. @example
  6300. output_rect=x\ y\ width\ height
  6301. @end example
  6302. If not given, the output rectangle equals the dimensions of the input image.
  6303. The output rectangle is automatically cropped at the borders of the input
  6304. image. Negative values are valid for each component.
  6305. @example
  6306. output_rect=25\ 25\ 100\ 100
  6307. @end example
  6308. @end table
  6309. Several filters can be chained for successive processing without GPU-HOST
  6310. transfers allowing for fast processing of complex filter chains.
  6311. Currently, only filters with zero (generators) or exactly one (filters) input
  6312. image and one output image are supported. Also, transition filters are not yet
  6313. usable as intended.
  6314. Some filters generate output images with additional padding depending on the
  6315. respective filter kernel. The padding is automatically removed to ensure the
  6316. filter output has the same size as the input image.
  6317. For image generators, the size of the output image is determined by the
  6318. previous output image of the filter chain or the input image of the whole
  6319. filterchain, respectively. The generators do not use the pixel information of
  6320. this image to generate their output. However, the generated output is
  6321. blended onto this image, resulting in partial or complete coverage of the
  6322. output image.
  6323. The @ref{coreimagesrc} video source can be used for generating input images
  6324. which are directly fed into the filter chain. By using it, providing input
  6325. images by another video source or an input video is not required.
  6326. @subsection Examples
  6327. @itemize
  6328. @item
  6329. List all filters available:
  6330. @example
  6331. coreimage=list_filters=true
  6332. @end example
  6333. @item
  6334. Use the CIBoxBlur filter with default options to blur an image:
  6335. @example
  6336. coreimage=filter=CIBoxBlur@@default
  6337. @end example
  6338. @item
  6339. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6340. its center at 100x100 and a radius of 50 pixels:
  6341. @example
  6342. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6343. @end example
  6344. @item
  6345. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6346. given as complete and escaped command-line for Apple's standard bash shell:
  6347. @example
  6348. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6349. @end example
  6350. @end itemize
  6351. @section cover_rect
  6352. Cover a rectangular object
  6353. It accepts the following options:
  6354. @table @option
  6355. @item cover
  6356. Filepath of the optional cover image, needs to be in yuv420.
  6357. @item mode
  6358. Set covering mode.
  6359. It accepts the following values:
  6360. @table @samp
  6361. @item cover
  6362. cover it by the supplied image
  6363. @item blur
  6364. cover it by interpolating the surrounding pixels
  6365. @end table
  6366. Default value is @var{blur}.
  6367. @end table
  6368. @subsection Examples
  6369. @itemize
  6370. @item
  6371. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6372. @example
  6373. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6374. @end example
  6375. @end itemize
  6376. @section crop
  6377. Crop the input video to given dimensions.
  6378. It accepts the following parameters:
  6379. @table @option
  6380. @item w, out_w
  6381. The width of the output video. It defaults to @code{iw}.
  6382. This expression is evaluated only once during the filter
  6383. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6384. @item h, out_h
  6385. The height of the output video. It defaults to @code{ih}.
  6386. This expression is evaluated only once during the filter
  6387. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6388. @item x
  6389. The horizontal position, in the input video, of the left edge of the output
  6390. video. It defaults to @code{(in_w-out_w)/2}.
  6391. This expression is evaluated per-frame.
  6392. @item y
  6393. The vertical position, in the input video, of the top edge of the output video.
  6394. It defaults to @code{(in_h-out_h)/2}.
  6395. This expression is evaluated per-frame.
  6396. @item keep_aspect
  6397. If set to 1 will force the output display aspect ratio
  6398. to be the same of the input, by changing the output sample aspect
  6399. ratio. It defaults to 0.
  6400. @item exact
  6401. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6402. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6403. It defaults to 0.
  6404. @end table
  6405. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6406. expressions containing the following constants:
  6407. @table @option
  6408. @item x
  6409. @item y
  6410. The computed values for @var{x} and @var{y}. They are evaluated for
  6411. each new frame.
  6412. @item in_w
  6413. @item in_h
  6414. The input width and height.
  6415. @item iw
  6416. @item ih
  6417. These are the same as @var{in_w} and @var{in_h}.
  6418. @item out_w
  6419. @item out_h
  6420. The output (cropped) width and height.
  6421. @item ow
  6422. @item oh
  6423. These are the same as @var{out_w} and @var{out_h}.
  6424. @item a
  6425. same as @var{iw} / @var{ih}
  6426. @item sar
  6427. input sample aspect ratio
  6428. @item dar
  6429. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6430. @item hsub
  6431. @item vsub
  6432. horizontal and vertical chroma subsample values. For example for the
  6433. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6434. @item n
  6435. The number of the input frame, starting from 0.
  6436. @item pos
  6437. the position in the file of the input frame, NAN if unknown
  6438. @item t
  6439. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6440. @end table
  6441. The expression for @var{out_w} may depend on the value of @var{out_h},
  6442. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6443. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6444. evaluated after @var{out_w} and @var{out_h}.
  6445. The @var{x} and @var{y} parameters specify the expressions for the
  6446. position of the top-left corner of the output (non-cropped) area. They
  6447. are evaluated for each frame. If the evaluated value is not valid, it
  6448. is approximated to the nearest valid value.
  6449. The expression for @var{x} may depend on @var{y}, and the expression
  6450. for @var{y} may depend on @var{x}.
  6451. @subsection Examples
  6452. @itemize
  6453. @item
  6454. Crop area with size 100x100 at position (12,34).
  6455. @example
  6456. crop=100:100:12:34
  6457. @end example
  6458. Using named options, the example above becomes:
  6459. @example
  6460. crop=w=100:h=100:x=12:y=34
  6461. @end example
  6462. @item
  6463. Crop the central input area with size 100x100:
  6464. @example
  6465. crop=100:100
  6466. @end example
  6467. @item
  6468. Crop the central input area with size 2/3 of the input video:
  6469. @example
  6470. crop=2/3*in_w:2/3*in_h
  6471. @end example
  6472. @item
  6473. Crop the input video central square:
  6474. @example
  6475. crop=out_w=in_h
  6476. crop=in_h
  6477. @end example
  6478. @item
  6479. Delimit the rectangle with the top-left corner placed at position
  6480. 100:100 and the right-bottom corner corresponding to the right-bottom
  6481. corner of the input image.
  6482. @example
  6483. crop=in_w-100:in_h-100:100:100
  6484. @end example
  6485. @item
  6486. Crop 10 pixels from the left and right borders, and 20 pixels from
  6487. the top and bottom borders
  6488. @example
  6489. crop=in_w-2*10:in_h-2*20
  6490. @end example
  6491. @item
  6492. Keep only the bottom right quarter of the input image:
  6493. @example
  6494. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6495. @end example
  6496. @item
  6497. Crop height for getting Greek harmony:
  6498. @example
  6499. crop=in_w:1/PHI*in_w
  6500. @end example
  6501. @item
  6502. Apply trembling effect:
  6503. @example
  6504. 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)
  6505. @end example
  6506. @item
  6507. Apply erratic camera effect depending on timestamp:
  6508. @example
  6509. 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)"
  6510. @end example
  6511. @item
  6512. Set x depending on the value of y:
  6513. @example
  6514. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6515. @end example
  6516. @end itemize
  6517. @subsection Commands
  6518. This filter supports the following commands:
  6519. @table @option
  6520. @item w, out_w
  6521. @item h, out_h
  6522. @item x
  6523. @item y
  6524. Set width/height of the output video and the horizontal/vertical position
  6525. in the input video.
  6526. The command accepts the same syntax of the corresponding option.
  6527. If the specified expression is not valid, it is kept at its current
  6528. value.
  6529. @end table
  6530. @section cropdetect
  6531. Auto-detect the crop size.
  6532. It calculates the necessary cropping parameters and prints the
  6533. recommended parameters via the logging system. The detected dimensions
  6534. correspond to the non-black area of the input video.
  6535. It accepts the following parameters:
  6536. @table @option
  6537. @item limit
  6538. Set higher black value threshold, which can be optionally specified
  6539. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6540. value greater to the set value is considered non-black. It defaults to 24.
  6541. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6542. on the bitdepth of the pixel format.
  6543. @item round
  6544. The value which the width/height should be divisible by. It defaults to
  6545. 16. The offset is automatically adjusted to center the video. Use 2 to
  6546. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6547. encoding to most video codecs.
  6548. @item reset_count, reset
  6549. Set the counter that determines after how many frames cropdetect will
  6550. reset the previously detected largest video area and start over to
  6551. detect the current optimal crop area. Default value is 0.
  6552. This can be useful when channel logos distort the video area. 0
  6553. indicates 'never reset', and returns the largest area encountered during
  6554. playback.
  6555. @end table
  6556. @anchor{cue}
  6557. @section cue
  6558. Delay video filtering until a given wallclock timestamp. The filter first
  6559. passes on @option{preroll} amount of frames, then it buffers at most
  6560. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6561. it forwards the buffered frames and also any subsequent frames coming in its
  6562. input.
  6563. The filter can be used synchronize the output of multiple ffmpeg processes for
  6564. realtime output devices like decklink. By putting the delay in the filtering
  6565. chain and pre-buffering frames the process can pass on data to output almost
  6566. immediately after the target wallclock timestamp is reached.
  6567. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6568. some use cases.
  6569. @table @option
  6570. @item cue
  6571. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6572. @item preroll
  6573. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6574. @item buffer
  6575. The maximum duration of content to buffer before waiting for the cue expressed
  6576. in seconds. Default is 0.
  6577. @end table
  6578. @anchor{curves}
  6579. @section curves
  6580. Apply color adjustments using curves.
  6581. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6582. component (red, green and blue) has its values defined by @var{N} key points
  6583. tied from each other using a smooth curve. The x-axis represents the pixel
  6584. values from the input frame, and the y-axis the new pixel values to be set for
  6585. the output frame.
  6586. By default, a component curve is defined by the two points @var{(0;0)} and
  6587. @var{(1;1)}. This creates a straight line where each original pixel value is
  6588. "adjusted" to its own value, which means no change to the image.
  6589. The filter allows you to redefine these two points and add some more. A new
  6590. curve (using a natural cubic spline interpolation) will be define to pass
  6591. smoothly through all these new coordinates. The new defined points needs to be
  6592. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6593. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6594. the vector spaces, the values will be clipped accordingly.
  6595. The filter accepts the following options:
  6596. @table @option
  6597. @item preset
  6598. Select one of the available color presets. This option can be used in addition
  6599. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6600. options takes priority on the preset values.
  6601. Available presets are:
  6602. @table @samp
  6603. @item none
  6604. @item color_negative
  6605. @item cross_process
  6606. @item darker
  6607. @item increase_contrast
  6608. @item lighter
  6609. @item linear_contrast
  6610. @item medium_contrast
  6611. @item negative
  6612. @item strong_contrast
  6613. @item vintage
  6614. @end table
  6615. Default is @code{none}.
  6616. @item master, m
  6617. Set the master key points. These points will define a second pass mapping. It
  6618. is sometimes called a "luminance" or "value" mapping. It can be used with
  6619. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6620. post-processing LUT.
  6621. @item red, r
  6622. Set the key points for the red component.
  6623. @item green, g
  6624. Set the key points for the green component.
  6625. @item blue, b
  6626. Set the key points for the blue component.
  6627. @item all
  6628. Set the key points for all components (not including master).
  6629. Can be used in addition to the other key points component
  6630. options. In this case, the unset component(s) will fallback on this
  6631. @option{all} setting.
  6632. @item psfile
  6633. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6634. @item plot
  6635. Save Gnuplot script of the curves in specified file.
  6636. @end table
  6637. To avoid some filtergraph syntax conflicts, each key points list need to be
  6638. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6639. @subsection Examples
  6640. @itemize
  6641. @item
  6642. Increase slightly the middle level of blue:
  6643. @example
  6644. curves=blue='0/0 0.5/0.58 1/1'
  6645. @end example
  6646. @item
  6647. Vintage effect:
  6648. @example
  6649. 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'
  6650. @end example
  6651. Here we obtain the following coordinates for each components:
  6652. @table @var
  6653. @item red
  6654. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6655. @item green
  6656. @code{(0;0) (0.50;0.48) (1;1)}
  6657. @item blue
  6658. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6659. @end table
  6660. @item
  6661. The previous example can also be achieved with the associated built-in preset:
  6662. @example
  6663. curves=preset=vintage
  6664. @end example
  6665. @item
  6666. Or simply:
  6667. @example
  6668. curves=vintage
  6669. @end example
  6670. @item
  6671. Use a Photoshop preset and redefine the points of the green component:
  6672. @example
  6673. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6674. @end example
  6675. @item
  6676. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6677. and @command{gnuplot}:
  6678. @example
  6679. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6680. gnuplot -p /tmp/curves.plt
  6681. @end example
  6682. @end itemize
  6683. @section datascope
  6684. Video data analysis filter.
  6685. This filter shows hexadecimal pixel values of part of video.
  6686. The filter accepts the following options:
  6687. @table @option
  6688. @item size, s
  6689. Set output video size.
  6690. @item x
  6691. Set x offset from where to pick pixels.
  6692. @item y
  6693. Set y offset from where to pick pixels.
  6694. @item mode
  6695. Set scope mode, can be one of the following:
  6696. @table @samp
  6697. @item mono
  6698. Draw hexadecimal pixel values with white color on black background.
  6699. @item color
  6700. Draw hexadecimal pixel values with input video pixel color on black
  6701. background.
  6702. @item color2
  6703. Draw hexadecimal pixel values on color background picked from input video,
  6704. the text color is picked in such way so its always visible.
  6705. @end table
  6706. @item axis
  6707. Draw rows and columns numbers on left and top of video.
  6708. @item opacity
  6709. Set background opacity.
  6710. @item format
  6711. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  6712. @end table
  6713. @section dblur
  6714. Apply Directional blur filter.
  6715. The filter accepts the following options:
  6716. @table @option
  6717. @item angle
  6718. Set angle of directional blur. Default is @code{45}.
  6719. @item radius
  6720. Set radius of directional blur. Default is @code{5}.
  6721. @item planes
  6722. Set which planes to filter. By default all planes are filtered.
  6723. @end table
  6724. @subsection Commands
  6725. This filter supports same @ref{commands} as options.
  6726. The command accepts the same syntax of the corresponding option.
  6727. If the specified expression is not valid, it is kept at its current
  6728. value.
  6729. @section dctdnoiz
  6730. Denoise frames using 2D DCT (frequency domain filtering).
  6731. This filter is not designed for real time.
  6732. The filter accepts the following options:
  6733. @table @option
  6734. @item sigma, s
  6735. Set the noise sigma constant.
  6736. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6737. coefficient (absolute value) below this threshold with be dropped.
  6738. If you need a more advanced filtering, see @option{expr}.
  6739. Default is @code{0}.
  6740. @item overlap
  6741. Set number overlapping pixels for each block. Since the filter can be slow, you
  6742. may want to reduce this value, at the cost of a less effective filter and the
  6743. risk of various artefacts.
  6744. If the overlapping value doesn't permit processing the whole input width or
  6745. height, a warning will be displayed and according borders won't be denoised.
  6746. Default value is @var{blocksize}-1, which is the best possible setting.
  6747. @item expr, e
  6748. Set the coefficient factor expression.
  6749. For each coefficient of a DCT block, this expression will be evaluated as a
  6750. multiplier value for the coefficient.
  6751. If this is option is set, the @option{sigma} option will be ignored.
  6752. The absolute value of the coefficient can be accessed through the @var{c}
  6753. variable.
  6754. @item n
  6755. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6756. @var{blocksize}, which is the width and height of the processed blocks.
  6757. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6758. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6759. on the speed processing. Also, a larger block size does not necessarily means a
  6760. better de-noising.
  6761. @end table
  6762. @subsection Examples
  6763. Apply a denoise with a @option{sigma} of @code{4.5}:
  6764. @example
  6765. dctdnoiz=4.5
  6766. @end example
  6767. The same operation can be achieved using the expression system:
  6768. @example
  6769. dctdnoiz=e='gte(c, 4.5*3)'
  6770. @end example
  6771. Violent denoise using a block size of @code{16x16}:
  6772. @example
  6773. dctdnoiz=15:n=4
  6774. @end example
  6775. @section deband
  6776. Remove banding artifacts from input video.
  6777. It works by replacing banded pixels with average value of referenced pixels.
  6778. The filter accepts the following options:
  6779. @table @option
  6780. @item 1thr
  6781. @item 2thr
  6782. @item 3thr
  6783. @item 4thr
  6784. Set banding detection threshold for each plane. Default is 0.02.
  6785. Valid range is 0.00003 to 0.5.
  6786. If difference between current pixel and reference pixel is less than threshold,
  6787. it will be considered as banded.
  6788. @item range, r
  6789. Banding detection range in pixels. Default is 16. If positive, random number
  6790. in range 0 to set value will be used. If negative, exact absolute value
  6791. will be used.
  6792. The range defines square of four pixels around current pixel.
  6793. @item direction, d
  6794. Set direction in radians from which four pixel will be compared. If positive,
  6795. random direction from 0 to set direction will be picked. If negative, exact of
  6796. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6797. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6798. column.
  6799. @item blur, b
  6800. If enabled, current pixel is compared with average value of all four
  6801. surrounding pixels. The default is enabled. If disabled current pixel is
  6802. compared with all four surrounding pixels. The pixel is considered banded
  6803. if only all four differences with surrounding pixels are less than threshold.
  6804. @item coupling, c
  6805. If enabled, current pixel is changed if and only if all pixel components are banded,
  6806. e.g. banding detection threshold is triggered for all color components.
  6807. The default is disabled.
  6808. @end table
  6809. @section deblock
  6810. Remove blocking artifacts from input video.
  6811. The filter accepts the following options:
  6812. @table @option
  6813. @item filter
  6814. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6815. This controls what kind of deblocking is applied.
  6816. @item block
  6817. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6818. @item alpha
  6819. @item beta
  6820. @item gamma
  6821. @item delta
  6822. Set blocking detection thresholds. Allowed range is 0 to 1.
  6823. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6824. Using higher threshold gives more deblocking strength.
  6825. Setting @var{alpha} controls threshold detection at exact edge of block.
  6826. Remaining options controls threshold detection near the edge. Each one for
  6827. below/above or left/right. Setting any of those to @var{0} disables
  6828. deblocking.
  6829. @item planes
  6830. Set planes to filter. Default is to filter all available planes.
  6831. @end table
  6832. @subsection Examples
  6833. @itemize
  6834. @item
  6835. Deblock using weak filter and block size of 4 pixels.
  6836. @example
  6837. deblock=filter=weak:block=4
  6838. @end example
  6839. @item
  6840. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6841. deblocking more edges.
  6842. @example
  6843. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6844. @end example
  6845. @item
  6846. Similar as above, but filter only first plane.
  6847. @example
  6848. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6849. @end example
  6850. @item
  6851. Similar as above, but filter only second and third plane.
  6852. @example
  6853. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6854. @end example
  6855. @end itemize
  6856. @anchor{decimate}
  6857. @section decimate
  6858. Drop duplicated frames at regular intervals.
  6859. The filter accepts the following options:
  6860. @table @option
  6861. @item cycle
  6862. Set the number of frames from which one will be dropped. Setting this to
  6863. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6864. Default is @code{5}.
  6865. @item dupthresh
  6866. Set the threshold for duplicate detection. If the difference metric for a frame
  6867. is less than or equal to this value, then it is declared as duplicate. Default
  6868. is @code{1.1}
  6869. @item scthresh
  6870. Set scene change threshold. Default is @code{15}.
  6871. @item blockx
  6872. @item blocky
  6873. Set the size of the x and y-axis blocks used during metric calculations.
  6874. Larger blocks give better noise suppression, but also give worse detection of
  6875. small movements. Must be a power of two. Default is @code{32}.
  6876. @item ppsrc
  6877. Mark main input as a pre-processed input and activate clean source input
  6878. stream. This allows the input to be pre-processed with various filters to help
  6879. the metrics calculation while keeping the frame selection lossless. When set to
  6880. @code{1}, the first stream is for the pre-processed input, and the second
  6881. stream is the clean source from where the kept frames are chosen. Default is
  6882. @code{0}.
  6883. @item chroma
  6884. Set whether or not chroma is considered in the metric calculations. Default is
  6885. @code{1}.
  6886. @end table
  6887. @section deconvolve
  6888. Apply 2D deconvolution of video stream in frequency domain using second stream
  6889. as impulse.
  6890. The filter accepts the following options:
  6891. @table @option
  6892. @item planes
  6893. Set which planes to process.
  6894. @item impulse
  6895. Set which impulse video frames will be processed, can be @var{first}
  6896. or @var{all}. Default is @var{all}.
  6897. @item noise
  6898. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6899. and height are not same and not power of 2 or if stream prior to convolving
  6900. had noise.
  6901. @end table
  6902. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6903. @section dedot
  6904. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6905. It accepts the following options:
  6906. @table @option
  6907. @item m
  6908. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6909. @var{rainbows} for cross-color reduction.
  6910. @item lt
  6911. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6912. @item tl
  6913. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6914. @item tc
  6915. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6916. @item ct
  6917. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6918. @end table
  6919. @section deflate
  6920. Apply deflate effect to the video.
  6921. This filter replaces the pixel by the local(3x3) average by taking into account
  6922. only values lower than the pixel.
  6923. It accepts the following options:
  6924. @table @option
  6925. @item threshold0
  6926. @item threshold1
  6927. @item threshold2
  6928. @item threshold3
  6929. Limit the maximum change for each plane, default is 65535.
  6930. If 0, plane will remain unchanged.
  6931. @end table
  6932. @subsection Commands
  6933. This filter supports the all above options as @ref{commands}.
  6934. @section deflicker
  6935. Remove temporal frame luminance variations.
  6936. It accepts the following options:
  6937. @table @option
  6938. @item size, s
  6939. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6940. @item mode, m
  6941. Set averaging mode to smooth temporal luminance variations.
  6942. Available values are:
  6943. @table @samp
  6944. @item am
  6945. Arithmetic mean
  6946. @item gm
  6947. Geometric mean
  6948. @item hm
  6949. Harmonic mean
  6950. @item qm
  6951. Quadratic mean
  6952. @item cm
  6953. Cubic mean
  6954. @item pm
  6955. Power mean
  6956. @item median
  6957. Median
  6958. @end table
  6959. @item bypass
  6960. Do not actually modify frame. Useful when one only wants metadata.
  6961. @end table
  6962. @section dejudder
  6963. Remove judder produced by partially interlaced telecined content.
  6964. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6965. source was partially telecined content then the output of @code{pullup,dejudder}
  6966. will have a variable frame rate. May change the recorded frame rate of the
  6967. container. Aside from that change, this filter will not affect constant frame
  6968. rate video.
  6969. The option available in this filter is:
  6970. @table @option
  6971. @item cycle
  6972. Specify the length of the window over which the judder repeats.
  6973. Accepts any integer greater than 1. Useful values are:
  6974. @table @samp
  6975. @item 4
  6976. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6977. @item 5
  6978. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6979. @item 20
  6980. If a mixture of the two.
  6981. @end table
  6982. The default is @samp{4}.
  6983. @end table
  6984. @section delogo
  6985. Suppress a TV station logo by a simple interpolation of the surrounding
  6986. pixels. Just set a rectangle covering the logo and watch it disappear
  6987. (and sometimes something even uglier appear - your mileage may vary).
  6988. It accepts the following parameters:
  6989. @table @option
  6990. @item x
  6991. @item y
  6992. Specify the top left corner coordinates of the logo. They must be
  6993. specified.
  6994. @item w
  6995. @item h
  6996. Specify the width and height of the logo to clear. They must be
  6997. specified.
  6998. @item band, t
  6999. Specify the thickness of the fuzzy edge of the rectangle (added to
  7000. @var{w} and @var{h}). The default value is 1. This option is
  7001. deprecated, setting higher values should no longer be necessary and
  7002. is not recommended.
  7003. @item show
  7004. When set to 1, a green rectangle is drawn on the screen to simplify
  7005. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  7006. The default value is 0.
  7007. The rectangle is drawn on the outermost pixels which will be (partly)
  7008. replaced with interpolated values. The values of the next pixels
  7009. immediately outside this rectangle in each direction will be used to
  7010. compute the interpolated pixel values inside the rectangle.
  7011. @end table
  7012. @subsection Examples
  7013. @itemize
  7014. @item
  7015. Set a rectangle covering the area with top left corner coordinates 0,0
  7016. and size 100x77, and a band of size 10:
  7017. @example
  7018. delogo=x=0:y=0:w=100:h=77:band=10
  7019. @end example
  7020. @end itemize
  7021. @anchor{derain}
  7022. @section derain
  7023. Remove the rain in the input image/video by applying the derain methods based on
  7024. convolutional neural networks. Supported models:
  7025. @itemize
  7026. @item
  7027. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  7028. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  7029. @end itemize
  7030. Training as well as model generation scripts are provided in
  7031. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  7032. Native model files (.model) can be generated from TensorFlow model
  7033. files (.pb) by using tools/python/convert.py
  7034. The filter accepts the following options:
  7035. @table @option
  7036. @item filter_type
  7037. Specify which filter to use. This option accepts the following values:
  7038. @table @samp
  7039. @item derain
  7040. Derain filter. To conduct derain filter, you need to use a derain model.
  7041. @item dehaze
  7042. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  7043. @end table
  7044. Default value is @samp{derain}.
  7045. @item dnn_backend
  7046. Specify which DNN backend to use for model loading and execution. This option accepts
  7047. the following values:
  7048. @table @samp
  7049. @item native
  7050. Native implementation of DNN loading and execution.
  7051. @item tensorflow
  7052. TensorFlow backend. To enable this backend you
  7053. need to install the TensorFlow for C library (see
  7054. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7055. @code{--enable-libtensorflow}
  7056. @end table
  7057. Default value is @samp{native}.
  7058. @item model
  7059. Set path to model file specifying network architecture and its parameters.
  7060. Note that different backends use different file formats. TensorFlow and native
  7061. backend can load files for only its format.
  7062. @end table
  7063. It can also be finished with @ref{dnn_processing} filter.
  7064. @section deshake
  7065. Attempt to fix small changes in horizontal and/or vertical shift. This
  7066. filter helps remove camera shake from hand-holding a camera, bumping a
  7067. tripod, moving on a vehicle, etc.
  7068. The filter accepts the following options:
  7069. @table @option
  7070. @item x
  7071. @item y
  7072. @item w
  7073. @item h
  7074. Specify a rectangular area where to limit the search for motion
  7075. vectors.
  7076. If desired the search for motion vectors can be limited to a
  7077. rectangular area of the frame defined by its top left corner, width
  7078. and height. These parameters have the same meaning as the drawbox
  7079. filter which can be used to visualise the position of the bounding
  7080. box.
  7081. This is useful when simultaneous movement of subjects within the frame
  7082. might be confused for camera motion by the motion vector search.
  7083. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  7084. then the full frame is used. This allows later options to be set
  7085. without specifying the bounding box for the motion vector search.
  7086. Default - search the whole frame.
  7087. @item rx
  7088. @item ry
  7089. Specify the maximum extent of movement in x and y directions in the
  7090. range 0-64 pixels. Default 16.
  7091. @item edge
  7092. Specify how to generate pixels to fill blanks at the edge of the
  7093. frame. Available values are:
  7094. @table @samp
  7095. @item blank, 0
  7096. Fill zeroes at blank locations
  7097. @item original, 1
  7098. Original image at blank locations
  7099. @item clamp, 2
  7100. Extruded edge value at blank locations
  7101. @item mirror, 3
  7102. Mirrored edge at blank locations
  7103. @end table
  7104. Default value is @samp{mirror}.
  7105. @item blocksize
  7106. Specify the blocksize to use for motion search. Range 4-128 pixels,
  7107. default 8.
  7108. @item contrast
  7109. Specify the contrast threshold for blocks. Only blocks with more than
  7110. the specified contrast (difference between darkest and lightest
  7111. pixels) will be considered. Range 1-255, default 125.
  7112. @item search
  7113. Specify the search strategy. Available values are:
  7114. @table @samp
  7115. @item exhaustive, 0
  7116. Set exhaustive search
  7117. @item less, 1
  7118. Set less exhaustive search.
  7119. @end table
  7120. Default value is @samp{exhaustive}.
  7121. @item filename
  7122. If set then a detailed log of the motion search is written to the
  7123. specified file.
  7124. @end table
  7125. @section despill
  7126. Remove unwanted contamination of foreground colors, caused by reflected color of
  7127. greenscreen or bluescreen.
  7128. This filter accepts the following options:
  7129. @table @option
  7130. @item type
  7131. Set what type of despill to use.
  7132. @item mix
  7133. Set how spillmap will be generated.
  7134. @item expand
  7135. Set how much to get rid of still remaining spill.
  7136. @item red
  7137. Controls amount of red in spill area.
  7138. @item green
  7139. Controls amount of green in spill area.
  7140. Should be -1 for greenscreen.
  7141. @item blue
  7142. Controls amount of blue in spill area.
  7143. Should be -1 for bluescreen.
  7144. @item brightness
  7145. Controls brightness of spill area, preserving colors.
  7146. @item alpha
  7147. Modify alpha from generated spillmap.
  7148. @end table
  7149. @section detelecine
  7150. Apply an exact inverse of the telecine operation. It requires a predefined
  7151. pattern specified using the pattern option which must be the same as that passed
  7152. to the telecine filter.
  7153. This filter accepts the following options:
  7154. @table @option
  7155. @item first_field
  7156. @table @samp
  7157. @item top, t
  7158. top field first
  7159. @item bottom, b
  7160. bottom field first
  7161. The default value is @code{top}.
  7162. @end table
  7163. @item pattern
  7164. A string of numbers representing the pulldown pattern you wish to apply.
  7165. The default value is @code{23}.
  7166. @item start_frame
  7167. A number representing position of the first frame with respect to the telecine
  7168. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  7169. @end table
  7170. @section dilation
  7171. Apply dilation effect to the video.
  7172. This filter replaces the pixel by the local(3x3) maximum.
  7173. It accepts the following options:
  7174. @table @option
  7175. @item threshold0
  7176. @item threshold1
  7177. @item threshold2
  7178. @item threshold3
  7179. Limit the maximum change for each plane, default is 65535.
  7180. If 0, plane will remain unchanged.
  7181. @item coordinates
  7182. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7183. pixels are used.
  7184. Flags to local 3x3 coordinates maps like this:
  7185. 1 2 3
  7186. 4 5
  7187. 6 7 8
  7188. @end table
  7189. @subsection Commands
  7190. This filter supports the all above options as @ref{commands}.
  7191. @section displace
  7192. Displace pixels as indicated by second and third input stream.
  7193. It takes three input streams and outputs one stream, the first input is the
  7194. source, and second and third input are displacement maps.
  7195. The second input specifies how much to displace pixels along the
  7196. x-axis, while the third input specifies how much to displace pixels
  7197. along the y-axis.
  7198. If one of displacement map streams terminates, last frame from that
  7199. displacement map will be used.
  7200. Note that once generated, displacements maps can be reused over and over again.
  7201. A description of the accepted options follows.
  7202. @table @option
  7203. @item edge
  7204. Set displace behavior for pixels that are out of range.
  7205. Available values are:
  7206. @table @samp
  7207. @item blank
  7208. Missing pixels are replaced by black pixels.
  7209. @item smear
  7210. Adjacent pixels will spread out to replace missing pixels.
  7211. @item wrap
  7212. Out of range pixels are wrapped so they point to pixels of other side.
  7213. @item mirror
  7214. Out of range pixels will be replaced with mirrored pixels.
  7215. @end table
  7216. Default is @samp{smear}.
  7217. @end table
  7218. @subsection Examples
  7219. @itemize
  7220. @item
  7221. Add ripple effect to rgb input of video size hd720:
  7222. @example
  7223. 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
  7224. @end example
  7225. @item
  7226. Add wave effect to rgb input of video size hd720:
  7227. @example
  7228. 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
  7229. @end example
  7230. @end itemize
  7231. @anchor{dnn_processing}
  7232. @section dnn_processing
  7233. Do image processing with deep neural networks. It works together with another filter
  7234. which converts the pixel format of the Frame to what the dnn network requires.
  7235. The filter accepts the following options:
  7236. @table @option
  7237. @item dnn_backend
  7238. Specify which DNN backend to use for model loading and execution. This option accepts
  7239. the following values:
  7240. @table @samp
  7241. @item native
  7242. Native implementation of DNN loading and execution.
  7243. @item tensorflow
  7244. TensorFlow backend. To enable this backend you
  7245. need to install the TensorFlow for C library (see
  7246. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7247. @code{--enable-libtensorflow}
  7248. @item openvino
  7249. OpenVINO backend. To enable this backend you
  7250. need to build and install the OpenVINO for C library (see
  7251. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  7252. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  7253. be needed if the header files and libraries are not installed into system path)
  7254. @end table
  7255. Default value is @samp{native}.
  7256. @item model
  7257. Set path to model file specifying network architecture and its parameters.
  7258. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  7259. backend can load files for only its format.
  7260. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7261. @item input
  7262. Set the input name of the dnn network.
  7263. @item output
  7264. Set the output name of the dnn network.
  7265. @end table
  7266. @subsection Examples
  7267. @itemize
  7268. @item
  7269. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7270. @example
  7271. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7272. @end example
  7273. @item
  7274. Halve the pixel value of the frame with format gray32f:
  7275. @example
  7276. 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
  7277. @end example
  7278. @item
  7279. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7280. @example
  7281. ./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
  7282. @end example
  7283. @item
  7284. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7285. @example
  7286. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7287. @end example
  7288. @end itemize
  7289. @section drawbox
  7290. Draw a colored box on the input image.
  7291. It accepts the following parameters:
  7292. @table @option
  7293. @item x
  7294. @item y
  7295. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7296. @item width, w
  7297. @item height, h
  7298. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7299. the input width and height. It defaults to 0.
  7300. @item color, c
  7301. Specify the color of the box to write. For the general syntax of this option,
  7302. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7303. value @code{invert} is used, the box edge color is the same as the
  7304. video with inverted luma.
  7305. @item thickness, t
  7306. The expression which sets the thickness of the box edge.
  7307. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7308. See below for the list of accepted constants.
  7309. @item replace
  7310. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7311. will overwrite the video's color and alpha pixels.
  7312. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7313. @end table
  7314. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7315. following constants:
  7316. @table @option
  7317. @item dar
  7318. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7319. @item hsub
  7320. @item vsub
  7321. horizontal and vertical chroma subsample values. For example for the
  7322. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7323. @item in_h, ih
  7324. @item in_w, iw
  7325. The input width and height.
  7326. @item sar
  7327. The input sample aspect ratio.
  7328. @item x
  7329. @item y
  7330. The x and y offset coordinates where the box is drawn.
  7331. @item w
  7332. @item h
  7333. The width and height of the drawn box.
  7334. @item t
  7335. The thickness of the drawn box.
  7336. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7337. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7338. @end table
  7339. @subsection Examples
  7340. @itemize
  7341. @item
  7342. Draw a black box around the edge of the input image:
  7343. @example
  7344. drawbox
  7345. @end example
  7346. @item
  7347. Draw a box with color red and an opacity of 50%:
  7348. @example
  7349. drawbox=10:20:200:60:red@@0.5
  7350. @end example
  7351. The previous example can be specified as:
  7352. @example
  7353. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7354. @end example
  7355. @item
  7356. Fill the box with pink color:
  7357. @example
  7358. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7359. @end example
  7360. @item
  7361. Draw a 2-pixel red 2.40:1 mask:
  7362. @example
  7363. 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
  7364. @end example
  7365. @end itemize
  7366. @subsection Commands
  7367. This filter supports same commands as options.
  7368. The command accepts the same syntax of the corresponding option.
  7369. If the specified expression is not valid, it is kept at its current
  7370. value.
  7371. @anchor{drawgraph}
  7372. @section drawgraph
  7373. Draw a graph using input video metadata.
  7374. It accepts the following parameters:
  7375. @table @option
  7376. @item m1
  7377. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7378. @item fg1
  7379. Set 1st foreground color expression.
  7380. @item m2
  7381. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7382. @item fg2
  7383. Set 2nd foreground color expression.
  7384. @item m3
  7385. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7386. @item fg3
  7387. Set 3rd foreground color expression.
  7388. @item m4
  7389. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7390. @item fg4
  7391. Set 4th foreground color expression.
  7392. @item min
  7393. Set minimal value of metadata value.
  7394. @item max
  7395. Set maximal value of metadata value.
  7396. @item bg
  7397. Set graph background color. Default is white.
  7398. @item mode
  7399. Set graph mode.
  7400. Available values for mode is:
  7401. @table @samp
  7402. @item bar
  7403. @item dot
  7404. @item line
  7405. @end table
  7406. Default is @code{line}.
  7407. @item slide
  7408. Set slide mode.
  7409. Available values for slide is:
  7410. @table @samp
  7411. @item frame
  7412. Draw new frame when right border is reached.
  7413. @item replace
  7414. Replace old columns with new ones.
  7415. @item scroll
  7416. Scroll from right to left.
  7417. @item rscroll
  7418. Scroll from left to right.
  7419. @item picture
  7420. Draw single picture.
  7421. @end table
  7422. Default is @code{frame}.
  7423. @item size
  7424. Set size of graph video. For the syntax of this option, check the
  7425. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7426. The default value is @code{900x256}.
  7427. @item rate, r
  7428. Set the output frame rate. Default value is @code{25}.
  7429. The foreground color expressions can use the following variables:
  7430. @table @option
  7431. @item MIN
  7432. Minimal value of metadata value.
  7433. @item MAX
  7434. Maximal value of metadata value.
  7435. @item VAL
  7436. Current metadata key value.
  7437. @end table
  7438. The color is defined as 0xAABBGGRR.
  7439. @end table
  7440. Example using metadata from @ref{signalstats} filter:
  7441. @example
  7442. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7443. @end example
  7444. Example using metadata from @ref{ebur128} filter:
  7445. @example
  7446. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7447. @end example
  7448. @section drawgrid
  7449. Draw a grid on the input image.
  7450. It accepts the following parameters:
  7451. @table @option
  7452. @item x
  7453. @item y
  7454. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7455. @item width, w
  7456. @item height, h
  7457. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7458. input width and height, respectively, minus @code{thickness}, so image gets
  7459. framed. Default to 0.
  7460. @item color, c
  7461. Specify the color of the grid. For the general syntax of this option,
  7462. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7463. value @code{invert} is used, the grid color is the same as the
  7464. video with inverted luma.
  7465. @item thickness, t
  7466. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7467. See below for the list of accepted constants.
  7468. @item replace
  7469. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7470. will overwrite the video's color and alpha pixels.
  7471. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7472. @end table
  7473. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7474. following constants:
  7475. @table @option
  7476. @item dar
  7477. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7478. @item hsub
  7479. @item vsub
  7480. horizontal and vertical chroma subsample values. For example for the
  7481. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7482. @item in_h, ih
  7483. @item in_w, iw
  7484. The input grid cell width and height.
  7485. @item sar
  7486. The input sample aspect ratio.
  7487. @item x
  7488. @item y
  7489. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7490. @item w
  7491. @item h
  7492. The width and height of the drawn cell.
  7493. @item t
  7494. The thickness of the drawn cell.
  7495. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7496. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7497. @end table
  7498. @subsection Examples
  7499. @itemize
  7500. @item
  7501. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7502. @example
  7503. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7504. @end example
  7505. @item
  7506. Draw a white 3x3 grid with an opacity of 50%:
  7507. @example
  7508. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7509. @end example
  7510. @end itemize
  7511. @subsection Commands
  7512. This filter supports same commands as options.
  7513. The command accepts the same syntax of the corresponding option.
  7514. If the specified expression is not valid, it is kept at its current
  7515. value.
  7516. @anchor{drawtext}
  7517. @section drawtext
  7518. Draw a text string or text from a specified file on top of a video, using the
  7519. libfreetype library.
  7520. To enable compilation of this filter, you need to configure FFmpeg with
  7521. @code{--enable-libfreetype}.
  7522. To enable default font fallback and the @var{font} option you need to
  7523. configure FFmpeg with @code{--enable-libfontconfig}.
  7524. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7525. @code{--enable-libfribidi}.
  7526. @subsection Syntax
  7527. It accepts the following parameters:
  7528. @table @option
  7529. @item box
  7530. Used to draw a box around text using the background color.
  7531. The value must be either 1 (enable) or 0 (disable).
  7532. The default value of @var{box} is 0.
  7533. @item boxborderw
  7534. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7535. The default value of @var{boxborderw} is 0.
  7536. @item boxcolor
  7537. The color to be used for drawing box around text. For the syntax of this
  7538. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7539. The default value of @var{boxcolor} is "white".
  7540. @item line_spacing
  7541. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7542. The default value of @var{line_spacing} is 0.
  7543. @item borderw
  7544. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7545. The default value of @var{borderw} is 0.
  7546. @item bordercolor
  7547. Set the color to be used for drawing border around text. For the syntax of this
  7548. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7549. The default value of @var{bordercolor} is "black".
  7550. @item expansion
  7551. Select how the @var{text} is expanded. Can be either @code{none},
  7552. @code{strftime} (deprecated) or
  7553. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7554. below for details.
  7555. @item basetime
  7556. Set a start time for the count. Value is in microseconds. Only applied
  7557. in the deprecated strftime expansion mode. To emulate in normal expansion
  7558. mode use the @code{pts} function, supplying the start time (in seconds)
  7559. as the second argument.
  7560. @item fix_bounds
  7561. If true, check and fix text coords to avoid clipping.
  7562. @item fontcolor
  7563. The color to be used for drawing fonts. For the syntax of this option, check
  7564. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7565. The default value of @var{fontcolor} is "black".
  7566. @item fontcolor_expr
  7567. String which is expanded the same way as @var{text} to obtain dynamic
  7568. @var{fontcolor} value. By default this option has empty value and is not
  7569. processed. When this option is set, it overrides @var{fontcolor} option.
  7570. @item font
  7571. The font family to be used for drawing text. By default Sans.
  7572. @item fontfile
  7573. The font file to be used for drawing text. The path must be included.
  7574. This parameter is mandatory if the fontconfig support is disabled.
  7575. @item alpha
  7576. Draw the text applying alpha blending. The value can
  7577. be a number between 0.0 and 1.0.
  7578. The expression accepts the same variables @var{x, y} as well.
  7579. The default value is 1.
  7580. Please see @var{fontcolor_expr}.
  7581. @item fontsize
  7582. The font size to be used for drawing text.
  7583. The default value of @var{fontsize} is 16.
  7584. @item text_shaping
  7585. If set to 1, attempt to shape the text (for example, reverse the order of
  7586. right-to-left text and join Arabic characters) before drawing it.
  7587. Otherwise, just draw the text exactly as given.
  7588. By default 1 (if supported).
  7589. @item ft_load_flags
  7590. The flags to be used for loading the fonts.
  7591. The flags map the corresponding flags supported by libfreetype, and are
  7592. a combination of the following values:
  7593. @table @var
  7594. @item default
  7595. @item no_scale
  7596. @item no_hinting
  7597. @item render
  7598. @item no_bitmap
  7599. @item vertical_layout
  7600. @item force_autohint
  7601. @item crop_bitmap
  7602. @item pedantic
  7603. @item ignore_global_advance_width
  7604. @item no_recurse
  7605. @item ignore_transform
  7606. @item monochrome
  7607. @item linear_design
  7608. @item no_autohint
  7609. @end table
  7610. Default value is "default".
  7611. For more information consult the documentation for the FT_LOAD_*
  7612. libfreetype flags.
  7613. @item shadowcolor
  7614. The color to be used for drawing a shadow behind the drawn text. For the
  7615. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7616. ffmpeg-utils manual,ffmpeg-utils}.
  7617. The default value of @var{shadowcolor} is "black".
  7618. @item shadowx
  7619. @item shadowy
  7620. The x and y offsets for the text shadow position with respect to the
  7621. position of the text. They can be either positive or negative
  7622. values. The default value for both is "0".
  7623. @item start_number
  7624. The starting frame number for the n/frame_num variable. The default value
  7625. is "0".
  7626. @item tabsize
  7627. The size in number of spaces to use for rendering the tab.
  7628. Default value is 4.
  7629. @item timecode
  7630. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7631. format. It can be used with or without text parameter. @var{timecode_rate}
  7632. option must be specified.
  7633. @item timecode_rate, rate, r
  7634. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7635. integer. Minimum value is "1".
  7636. Drop-frame timecode is supported for frame rates 30 & 60.
  7637. @item tc24hmax
  7638. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7639. Default is 0 (disabled).
  7640. @item text
  7641. The text string to be drawn. The text must be a sequence of UTF-8
  7642. encoded characters.
  7643. This parameter is mandatory if no file is specified with the parameter
  7644. @var{textfile}.
  7645. @item textfile
  7646. A text file containing text to be drawn. The text must be a sequence
  7647. of UTF-8 encoded characters.
  7648. This parameter is mandatory if no text string is specified with the
  7649. parameter @var{text}.
  7650. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7651. @item reload
  7652. If set to 1, the @var{textfile} will be reloaded before each frame.
  7653. Be sure to update it atomically, or it may be read partially, or even fail.
  7654. @item x
  7655. @item y
  7656. The expressions which specify the offsets where text will be drawn
  7657. within the video frame. They are relative to the top/left border of the
  7658. output image.
  7659. The default value of @var{x} and @var{y} is "0".
  7660. See below for the list of accepted constants and functions.
  7661. @end table
  7662. The parameters for @var{x} and @var{y} are expressions containing the
  7663. following constants and functions:
  7664. @table @option
  7665. @item dar
  7666. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7667. @item hsub
  7668. @item vsub
  7669. horizontal and vertical chroma subsample values. For example for the
  7670. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7671. @item line_h, lh
  7672. the height of each text line
  7673. @item main_h, h, H
  7674. the input height
  7675. @item main_w, w, W
  7676. the input width
  7677. @item max_glyph_a, ascent
  7678. the maximum distance from the baseline to the highest/upper grid
  7679. coordinate used to place a glyph outline point, for all the rendered
  7680. glyphs.
  7681. It is a positive value, due to the grid's orientation with the Y axis
  7682. upwards.
  7683. @item max_glyph_d, descent
  7684. the maximum distance from the baseline to the lowest grid coordinate
  7685. used to place a glyph outline point, for all the rendered glyphs.
  7686. This is a negative value, due to the grid's orientation, with the Y axis
  7687. upwards.
  7688. @item max_glyph_h
  7689. maximum glyph height, that is the maximum height for all the glyphs
  7690. contained in the rendered text, it is equivalent to @var{ascent} -
  7691. @var{descent}.
  7692. @item max_glyph_w
  7693. maximum glyph width, that is the maximum width for all the glyphs
  7694. contained in the rendered text
  7695. @item n
  7696. the number of input frame, starting from 0
  7697. @item rand(min, max)
  7698. return a random number included between @var{min} and @var{max}
  7699. @item sar
  7700. The input sample aspect ratio.
  7701. @item t
  7702. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7703. @item text_h, th
  7704. the height of the rendered text
  7705. @item text_w, tw
  7706. the width of the rendered text
  7707. @item x
  7708. @item y
  7709. the x and y offset coordinates where the text is drawn.
  7710. These parameters allow the @var{x} and @var{y} expressions to refer
  7711. to each other, so you can for example specify @code{y=x/dar}.
  7712. @item pict_type
  7713. A one character description of the current frame's picture type.
  7714. @item pkt_pos
  7715. The current packet's position in the input file or stream
  7716. (in bytes, from the start of the input). A value of -1 indicates
  7717. this info is not available.
  7718. @item pkt_duration
  7719. The current packet's duration, in seconds.
  7720. @item pkt_size
  7721. The current packet's size (in bytes).
  7722. @end table
  7723. @anchor{drawtext_expansion}
  7724. @subsection Text expansion
  7725. If @option{expansion} is set to @code{strftime},
  7726. the filter recognizes strftime() sequences in the provided text and
  7727. expands them accordingly. Check the documentation of strftime(). This
  7728. feature is deprecated.
  7729. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7730. If @option{expansion} is set to @code{normal} (which is the default),
  7731. the following expansion mechanism is used.
  7732. The backslash character @samp{\}, followed by any character, always expands to
  7733. the second character.
  7734. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7735. braces is a function name, possibly followed by arguments separated by ':'.
  7736. If the arguments contain special characters or delimiters (':' or '@}'),
  7737. they should be escaped.
  7738. Note that they probably must also be escaped as the value for the
  7739. @option{text} option in the filter argument string and as the filter
  7740. argument in the filtergraph description, and possibly also for the shell,
  7741. that makes up to four levels of escaping; using a text file avoids these
  7742. problems.
  7743. The following functions are available:
  7744. @table @command
  7745. @item expr, e
  7746. The expression evaluation result.
  7747. It must take one argument specifying the expression to be evaluated,
  7748. which accepts the same constants and functions as the @var{x} and
  7749. @var{y} values. Note that not all constants should be used, for
  7750. example the text size is not known when evaluating the expression, so
  7751. the constants @var{text_w} and @var{text_h} will have an undefined
  7752. value.
  7753. @item expr_int_format, eif
  7754. Evaluate the expression's value and output as formatted integer.
  7755. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7756. The second argument specifies the output format. Allowed values are @samp{x},
  7757. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7758. @code{printf} function.
  7759. The third parameter is optional and sets the number of positions taken by the output.
  7760. It can be used to add padding with zeros from the left.
  7761. @item gmtime
  7762. The time at which the filter is running, expressed in UTC.
  7763. It can accept an argument: a strftime() format string.
  7764. @item localtime
  7765. The time at which the filter is running, expressed in the local time zone.
  7766. It can accept an argument: a strftime() format string.
  7767. @item metadata
  7768. Frame metadata. Takes one or two arguments.
  7769. The first argument is mandatory and specifies the metadata key.
  7770. The second argument is optional and specifies a default value, used when the
  7771. metadata key is not found or empty.
  7772. Available metadata can be identified by inspecting entries
  7773. starting with TAG included within each frame section
  7774. printed by running @code{ffprobe -show_frames}.
  7775. String metadata generated in filters leading to
  7776. the drawtext filter are also available.
  7777. @item n, frame_num
  7778. The frame number, starting from 0.
  7779. @item pict_type
  7780. A one character description of the current picture type.
  7781. @item pts
  7782. The timestamp of the current frame.
  7783. It can take up to three arguments.
  7784. The first argument is the format of the timestamp; it defaults to @code{flt}
  7785. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7786. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7787. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7788. @code{localtime} stands for the timestamp of the frame formatted as
  7789. local time zone time.
  7790. The second argument is an offset added to the timestamp.
  7791. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7792. supplied to present the hour part of the formatted timestamp in 24h format
  7793. (00-23).
  7794. If the format is set to @code{localtime} or @code{gmtime},
  7795. a third argument may be supplied: a strftime() format string.
  7796. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7797. @end table
  7798. @subsection Commands
  7799. This filter supports altering parameters via commands:
  7800. @table @option
  7801. @item reinit
  7802. Alter existing filter parameters.
  7803. Syntax for the argument is the same as for filter invocation, e.g.
  7804. @example
  7805. fontsize=56:fontcolor=green:text='Hello World'
  7806. @end example
  7807. Full filter invocation with sendcmd would look like this:
  7808. @example
  7809. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7810. @end example
  7811. @end table
  7812. If the entire argument can't be parsed or applied as valid values then the filter will
  7813. continue with its existing parameters.
  7814. @subsection Examples
  7815. @itemize
  7816. @item
  7817. Draw "Test Text" with font FreeSerif, using the default values for the
  7818. optional parameters.
  7819. @example
  7820. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7821. @end example
  7822. @item
  7823. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7824. and y=50 (counting from the top-left corner of the screen), text is
  7825. yellow with a red box around it. Both the text and the box have an
  7826. opacity of 20%.
  7827. @example
  7828. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7829. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7830. @end example
  7831. Note that the double quotes are not necessary if spaces are not used
  7832. within the parameter list.
  7833. @item
  7834. Show the text at the center of the video frame:
  7835. @example
  7836. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7837. @end example
  7838. @item
  7839. Show the text at a random position, switching to a new position every 30 seconds:
  7840. @example
  7841. 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)"
  7842. @end example
  7843. @item
  7844. Show a text line sliding from right to left in the last row of the video
  7845. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7846. with no newlines.
  7847. @example
  7848. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7849. @end example
  7850. @item
  7851. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7852. @example
  7853. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7854. @end example
  7855. @item
  7856. Draw a single green letter "g", at the center of the input video.
  7857. The glyph baseline is placed at half screen height.
  7858. @example
  7859. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7860. @end example
  7861. @item
  7862. Show text for 1 second every 3 seconds:
  7863. @example
  7864. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7865. @end example
  7866. @item
  7867. Use fontconfig to set the font. Note that the colons need to be escaped.
  7868. @example
  7869. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7870. @end example
  7871. @item
  7872. Draw "Test Text" with font size dependent on height of the video.
  7873. @example
  7874. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  7875. @end example
  7876. @item
  7877. Print the date of a real-time encoding (see strftime(3)):
  7878. @example
  7879. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7880. @end example
  7881. @item
  7882. Show text fading in and out (appearing/disappearing):
  7883. @example
  7884. #!/bin/sh
  7885. DS=1.0 # display start
  7886. DE=10.0 # display end
  7887. FID=1.5 # fade in duration
  7888. FOD=5 # fade out duration
  7889. 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 @}"
  7890. @end example
  7891. @item
  7892. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7893. and the @option{fontsize} value are included in the @option{y} offset.
  7894. @example
  7895. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7896. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7897. @end example
  7898. @item
  7899. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  7900. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  7901. must have option @option{-export_path_metadata 1} for the special metadata fields
  7902. to be available for filters.
  7903. @example
  7904. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  7905. @end example
  7906. @end itemize
  7907. For more information about libfreetype, check:
  7908. @url{http://www.freetype.org/}.
  7909. For more information about fontconfig, check:
  7910. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7911. For more information about libfribidi, check:
  7912. @url{http://fribidi.org/}.
  7913. @section edgedetect
  7914. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7915. The filter accepts the following options:
  7916. @table @option
  7917. @item low
  7918. @item high
  7919. Set low and high threshold values used by the Canny thresholding
  7920. algorithm.
  7921. The high threshold selects the "strong" edge pixels, which are then
  7922. connected through 8-connectivity with the "weak" edge pixels selected
  7923. by the low threshold.
  7924. @var{low} and @var{high} threshold values must be chosen in the range
  7925. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7926. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7927. is @code{50/255}.
  7928. @item mode
  7929. Define the drawing mode.
  7930. @table @samp
  7931. @item wires
  7932. Draw white/gray wires on black background.
  7933. @item colormix
  7934. Mix the colors to create a paint/cartoon effect.
  7935. @item canny
  7936. Apply Canny edge detector on all selected planes.
  7937. @end table
  7938. Default value is @var{wires}.
  7939. @item planes
  7940. Select planes for filtering. By default all available planes are filtered.
  7941. @end table
  7942. @subsection Examples
  7943. @itemize
  7944. @item
  7945. Standard edge detection with custom values for the hysteresis thresholding:
  7946. @example
  7947. edgedetect=low=0.1:high=0.4
  7948. @end example
  7949. @item
  7950. Painting effect without thresholding:
  7951. @example
  7952. edgedetect=mode=colormix:high=0
  7953. @end example
  7954. @end itemize
  7955. @section elbg
  7956. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7957. For each input image, the filter will compute the optimal mapping from
  7958. the input to the output given the codebook length, that is the number
  7959. of distinct output colors.
  7960. This filter accepts the following options.
  7961. @table @option
  7962. @item codebook_length, l
  7963. Set codebook length. The value must be a positive integer, and
  7964. represents the number of distinct output colors. Default value is 256.
  7965. @item nb_steps, n
  7966. Set the maximum number of iterations to apply for computing the optimal
  7967. mapping. The higher the value the better the result and the higher the
  7968. computation time. Default value is 1.
  7969. @item seed, s
  7970. Set a random seed, must be an integer included between 0 and
  7971. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7972. will try to use a good random seed on a best effort basis.
  7973. @item pal8
  7974. Set pal8 output pixel format. This option does not work with codebook
  7975. length greater than 256.
  7976. @end table
  7977. @section entropy
  7978. Measure graylevel entropy in histogram of color channels of video frames.
  7979. It accepts the following parameters:
  7980. @table @option
  7981. @item mode
  7982. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7983. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7984. between neighbour histogram values.
  7985. @end table
  7986. @section eq
  7987. Set brightness, contrast, saturation and approximate gamma adjustment.
  7988. The filter accepts the following options:
  7989. @table @option
  7990. @item contrast
  7991. Set the contrast expression. The value must be a float value in range
  7992. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7993. @item brightness
  7994. Set the brightness expression. The value must be a float value in
  7995. range @code{-1.0} to @code{1.0}. The default value is "0".
  7996. @item saturation
  7997. Set the saturation expression. The value must be a float in
  7998. range @code{0.0} to @code{3.0}. The default value is "1".
  7999. @item gamma
  8000. Set the gamma expression. The value must be a float in range
  8001. @code{0.1} to @code{10.0}. The default value is "1".
  8002. @item gamma_r
  8003. Set the gamma expression for red. The value must be a float in
  8004. range @code{0.1} to @code{10.0}. The default value is "1".
  8005. @item gamma_g
  8006. Set the gamma expression for green. The value must be a float in range
  8007. @code{0.1} to @code{10.0}. The default value is "1".
  8008. @item gamma_b
  8009. Set the gamma expression for blue. The value must be a float in range
  8010. @code{0.1} to @code{10.0}. The default value is "1".
  8011. @item gamma_weight
  8012. Set the gamma weight expression. It can be used to reduce the effect
  8013. of a high gamma value on bright image areas, e.g. keep them from
  8014. getting overamplified and just plain white. The value must be a float
  8015. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  8016. gamma correction all the way down while @code{1.0} leaves it at its
  8017. full strength. Default is "1".
  8018. @item eval
  8019. Set when the expressions for brightness, contrast, saturation and
  8020. gamma expressions are evaluated.
  8021. It accepts the following values:
  8022. @table @samp
  8023. @item init
  8024. only evaluate expressions once during the filter initialization or
  8025. when a command is processed
  8026. @item frame
  8027. evaluate expressions for each incoming frame
  8028. @end table
  8029. Default value is @samp{init}.
  8030. @end table
  8031. The expressions accept the following parameters:
  8032. @table @option
  8033. @item n
  8034. frame count of the input frame starting from 0
  8035. @item pos
  8036. byte position of the corresponding packet in the input file, NAN if
  8037. unspecified
  8038. @item r
  8039. frame rate of the input video, NAN if the input frame rate is unknown
  8040. @item t
  8041. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8042. @end table
  8043. @subsection Commands
  8044. The filter supports the following commands:
  8045. @table @option
  8046. @item contrast
  8047. Set the contrast expression.
  8048. @item brightness
  8049. Set the brightness expression.
  8050. @item saturation
  8051. Set the saturation expression.
  8052. @item gamma
  8053. Set the gamma expression.
  8054. @item gamma_r
  8055. Set the gamma_r expression.
  8056. @item gamma_g
  8057. Set gamma_g expression.
  8058. @item gamma_b
  8059. Set gamma_b expression.
  8060. @item gamma_weight
  8061. Set gamma_weight expression.
  8062. The command accepts the same syntax of the corresponding option.
  8063. If the specified expression is not valid, it is kept at its current
  8064. value.
  8065. @end table
  8066. @section erosion
  8067. Apply erosion effect to the video.
  8068. This filter replaces the pixel by the local(3x3) minimum.
  8069. It accepts the following options:
  8070. @table @option
  8071. @item threshold0
  8072. @item threshold1
  8073. @item threshold2
  8074. @item threshold3
  8075. Limit the maximum change for each plane, default is 65535.
  8076. If 0, plane will remain unchanged.
  8077. @item coordinates
  8078. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8079. pixels are used.
  8080. Flags to local 3x3 coordinates maps like this:
  8081. 1 2 3
  8082. 4 5
  8083. 6 7 8
  8084. @end table
  8085. @subsection Commands
  8086. This filter supports the all above options as @ref{commands}.
  8087. @section extractplanes
  8088. Extract color channel components from input video stream into
  8089. separate grayscale video streams.
  8090. The filter accepts the following option:
  8091. @table @option
  8092. @item planes
  8093. Set plane(s) to extract.
  8094. Available values for planes are:
  8095. @table @samp
  8096. @item y
  8097. @item u
  8098. @item v
  8099. @item a
  8100. @item r
  8101. @item g
  8102. @item b
  8103. @end table
  8104. Choosing planes not available in the input will result in an error.
  8105. That means you cannot select @code{r}, @code{g}, @code{b} planes
  8106. with @code{y}, @code{u}, @code{v} planes at same time.
  8107. @end table
  8108. @subsection Examples
  8109. @itemize
  8110. @item
  8111. Extract luma, u and v color channel component from input video frame
  8112. into 3 grayscale outputs:
  8113. @example
  8114. 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
  8115. @end example
  8116. @end itemize
  8117. @section fade
  8118. Apply a fade-in/out effect to the input video.
  8119. It accepts the following parameters:
  8120. @table @option
  8121. @item type, t
  8122. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  8123. effect.
  8124. Default is @code{in}.
  8125. @item start_frame, s
  8126. Specify the number of the frame to start applying the fade
  8127. effect at. Default is 0.
  8128. @item nb_frames, n
  8129. The number of frames that the fade effect lasts. At the end of the
  8130. fade-in effect, the output video will have the same intensity as the input video.
  8131. At the end of the fade-out transition, the output video will be filled with the
  8132. selected @option{color}.
  8133. Default is 25.
  8134. @item alpha
  8135. If set to 1, fade only alpha channel, if one exists on the input.
  8136. Default value is 0.
  8137. @item start_time, st
  8138. Specify the timestamp (in seconds) of the frame to start to apply the fade
  8139. effect. If both start_frame and start_time are specified, the fade will start at
  8140. whichever comes last. Default is 0.
  8141. @item duration, d
  8142. The number of seconds for which the fade effect has to last. At the end of the
  8143. fade-in effect the output video will have the same intensity as the input video,
  8144. at the end of the fade-out transition the output video will be filled with the
  8145. selected @option{color}.
  8146. If both duration and nb_frames are specified, duration is used. Default is 0
  8147. (nb_frames is used by default).
  8148. @item color, c
  8149. Specify the color of the fade. Default is "black".
  8150. @end table
  8151. @subsection Examples
  8152. @itemize
  8153. @item
  8154. Fade in the first 30 frames of video:
  8155. @example
  8156. fade=in:0:30
  8157. @end example
  8158. The command above is equivalent to:
  8159. @example
  8160. fade=t=in:s=0:n=30
  8161. @end example
  8162. @item
  8163. Fade out the last 45 frames of a 200-frame video:
  8164. @example
  8165. fade=out:155:45
  8166. fade=type=out:start_frame=155:nb_frames=45
  8167. @end example
  8168. @item
  8169. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  8170. @example
  8171. fade=in:0:25, fade=out:975:25
  8172. @end example
  8173. @item
  8174. Make the first 5 frames yellow, then fade in from frame 5-24:
  8175. @example
  8176. fade=in:5:20:color=yellow
  8177. @end example
  8178. @item
  8179. Fade in alpha over first 25 frames of video:
  8180. @example
  8181. fade=in:0:25:alpha=1
  8182. @end example
  8183. @item
  8184. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  8185. @example
  8186. fade=t=in:st=5.5:d=0.5
  8187. @end example
  8188. @end itemize
  8189. @section fftdnoiz
  8190. Denoise frames using 3D FFT (frequency domain filtering).
  8191. The filter accepts the following options:
  8192. @table @option
  8193. @item sigma
  8194. Set the noise sigma constant. This sets denoising strength.
  8195. Default value is 1. Allowed range is from 0 to 30.
  8196. Using very high sigma with low overlap may give blocking artifacts.
  8197. @item amount
  8198. Set amount of denoising. By default all detected noise is reduced.
  8199. Default value is 1. Allowed range is from 0 to 1.
  8200. @item block
  8201. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  8202. Actual size of block in pixels is 2 to power of @var{block}, so by default
  8203. block size in pixels is 2^4 which is 16.
  8204. @item overlap
  8205. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  8206. @item prev
  8207. Set number of previous frames to use for denoising. By default is set to 0.
  8208. @item next
  8209. Set number of next frames to to use for denoising. By default is set to 0.
  8210. @item planes
  8211. Set planes which will be filtered, by default are all available filtered
  8212. except alpha.
  8213. @end table
  8214. @section fftfilt
  8215. Apply arbitrary expressions to samples in frequency domain
  8216. @table @option
  8217. @item dc_Y
  8218. Adjust the dc value (gain) of the luma plane of the image. The filter
  8219. accepts an integer value in range @code{0} to @code{1000}. The default
  8220. value is set to @code{0}.
  8221. @item dc_U
  8222. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8223. filter accepts an integer value in range @code{0} to @code{1000}. The
  8224. default value is set to @code{0}.
  8225. @item dc_V
  8226. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8227. filter accepts an integer value in range @code{0} to @code{1000}. The
  8228. default value is set to @code{0}.
  8229. @item weight_Y
  8230. Set the frequency domain weight expression for the luma plane.
  8231. @item weight_U
  8232. Set the frequency domain weight expression for the 1st chroma plane.
  8233. @item weight_V
  8234. Set the frequency domain weight expression for the 2nd chroma plane.
  8235. @item eval
  8236. Set when the expressions are evaluated.
  8237. It accepts the following values:
  8238. @table @samp
  8239. @item init
  8240. Only evaluate expressions once during the filter initialization.
  8241. @item frame
  8242. Evaluate expressions for each incoming frame.
  8243. @end table
  8244. Default value is @samp{init}.
  8245. The filter accepts the following variables:
  8246. @item X
  8247. @item Y
  8248. The coordinates of the current sample.
  8249. @item W
  8250. @item H
  8251. The width and height of the image.
  8252. @item N
  8253. The number of input frame, starting from 0.
  8254. @end table
  8255. @subsection Examples
  8256. @itemize
  8257. @item
  8258. High-pass:
  8259. @example
  8260. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8261. @end example
  8262. @item
  8263. Low-pass:
  8264. @example
  8265. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8266. @end example
  8267. @item
  8268. Sharpen:
  8269. @example
  8270. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8271. @end example
  8272. @item
  8273. Blur:
  8274. @example
  8275. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8276. @end example
  8277. @end itemize
  8278. @section field
  8279. Extract a single field from an interlaced image using stride
  8280. arithmetic to avoid wasting CPU time. The output frames are marked as
  8281. non-interlaced.
  8282. The filter accepts the following options:
  8283. @table @option
  8284. @item type
  8285. Specify whether to extract the top (if the value is @code{0} or
  8286. @code{top}) or the bottom field (if the value is @code{1} or
  8287. @code{bottom}).
  8288. @end table
  8289. @section fieldhint
  8290. Create new frames by copying the top and bottom fields from surrounding frames
  8291. supplied as numbers by the hint file.
  8292. @table @option
  8293. @item hint
  8294. Set file containing hints: absolute/relative frame numbers.
  8295. There must be one line for each frame in a clip. Each line must contain two
  8296. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8297. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8298. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8299. for @code{relative} mode. First number tells from which frame to pick up top
  8300. field and second number tells from which frame to pick up bottom field.
  8301. If optionally followed by @code{+} output frame will be marked as interlaced,
  8302. else if followed by @code{-} output frame will be marked as progressive, else
  8303. it will be marked same as input frame.
  8304. If optionally followed by @code{t} output frame will use only top field, or in
  8305. case of @code{b} it will use only bottom field.
  8306. If line starts with @code{#} or @code{;} that line is skipped.
  8307. @item mode
  8308. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8309. @end table
  8310. Example of first several lines of @code{hint} file for @code{relative} mode:
  8311. @example
  8312. 0,0 - # first frame
  8313. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8314. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8315. 1,0 -
  8316. 0,0 -
  8317. 0,0 -
  8318. 1,0 -
  8319. 1,0 -
  8320. 1,0 -
  8321. 0,0 -
  8322. 0,0 -
  8323. 1,0 -
  8324. 1,0 -
  8325. 1,0 -
  8326. 0,0 -
  8327. @end example
  8328. @section fieldmatch
  8329. Field matching filter for inverse telecine. It is meant to reconstruct the
  8330. progressive frames from a telecined stream. The filter does not drop duplicated
  8331. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8332. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8333. The separation of the field matching and the decimation is notably motivated by
  8334. the possibility of inserting a de-interlacing filter fallback between the two.
  8335. If the source has mixed telecined and real interlaced content,
  8336. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8337. But these remaining combed frames will be marked as interlaced, and thus can be
  8338. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8339. In addition to the various configuration options, @code{fieldmatch} can take an
  8340. optional second stream, activated through the @option{ppsrc} option. If
  8341. enabled, the frames reconstruction will be based on the fields and frames from
  8342. this second stream. This allows the first input to be pre-processed in order to
  8343. help the various algorithms of the filter, while keeping the output lossless
  8344. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8345. or brightness/contrast adjustments can help.
  8346. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8347. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8348. which @code{fieldmatch} is based on. While the semantic and usage are very
  8349. close, some behaviour and options names can differ.
  8350. The @ref{decimate} filter currently only works for constant frame rate input.
  8351. If your input has mixed telecined (30fps) and progressive content with a lower
  8352. framerate like 24fps use the following filterchain to produce the necessary cfr
  8353. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8354. The filter accepts the following options:
  8355. @table @option
  8356. @item order
  8357. Specify the assumed field order of the input stream. Available values are:
  8358. @table @samp
  8359. @item auto
  8360. Auto detect parity (use FFmpeg's internal parity value).
  8361. @item bff
  8362. Assume bottom field first.
  8363. @item tff
  8364. Assume top field first.
  8365. @end table
  8366. Note that it is sometimes recommended not to trust the parity announced by the
  8367. stream.
  8368. Default value is @var{auto}.
  8369. @item mode
  8370. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8371. sense that it won't risk creating jerkiness due to duplicate frames when
  8372. possible, but if there are bad edits or blended fields it will end up
  8373. outputting combed frames when a good match might actually exist. On the other
  8374. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8375. but will almost always find a good frame if there is one. The other values are
  8376. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8377. jerkiness and creating duplicate frames versus finding good matches in sections
  8378. with bad edits, orphaned fields, blended fields, etc.
  8379. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8380. Available values are:
  8381. @table @samp
  8382. @item pc
  8383. 2-way matching (p/c)
  8384. @item pc_n
  8385. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8386. @item pc_u
  8387. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8388. @item pc_n_ub
  8389. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8390. still combed (p/c + n + u/b)
  8391. @item pcn
  8392. 3-way matching (p/c/n)
  8393. @item pcn_ub
  8394. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8395. detected as combed (p/c/n + u/b)
  8396. @end table
  8397. The parenthesis at the end indicate the matches that would be used for that
  8398. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8399. @var{top}).
  8400. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8401. the slowest.
  8402. Default value is @var{pc_n}.
  8403. @item ppsrc
  8404. Mark the main input stream as a pre-processed input, and enable the secondary
  8405. input stream as the clean source to pick the fields from. See the filter
  8406. introduction for more details. It is similar to the @option{clip2} feature from
  8407. VFM/TFM.
  8408. Default value is @code{0} (disabled).
  8409. @item field
  8410. Set the field to match from. It is recommended to set this to the same value as
  8411. @option{order} unless you experience matching failures with that setting. In
  8412. certain circumstances changing the field that is used to match from can have a
  8413. large impact on matching performance. Available values are:
  8414. @table @samp
  8415. @item auto
  8416. Automatic (same value as @option{order}).
  8417. @item bottom
  8418. Match from the bottom field.
  8419. @item top
  8420. Match from the top field.
  8421. @end table
  8422. Default value is @var{auto}.
  8423. @item mchroma
  8424. Set whether or not chroma is included during the match comparisons. In most
  8425. cases it is recommended to leave this enabled. You should set this to @code{0}
  8426. only if your clip has bad chroma problems such as heavy rainbowing or other
  8427. artifacts. Setting this to @code{0} could also be used to speed things up at
  8428. the cost of some accuracy.
  8429. Default value is @code{1}.
  8430. @item y0
  8431. @item y1
  8432. These define an exclusion band which excludes the lines between @option{y0} and
  8433. @option{y1} from being included in the field matching decision. An exclusion
  8434. band can be used to ignore subtitles, a logo, or other things that may
  8435. interfere with the matching. @option{y0} sets the starting scan line and
  8436. @option{y1} sets the ending line; all lines in between @option{y0} and
  8437. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8438. @option{y0} and @option{y1} to the same value will disable the feature.
  8439. @option{y0} and @option{y1} defaults to @code{0}.
  8440. @item scthresh
  8441. Set the scene change detection threshold as a percentage of maximum change on
  8442. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8443. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8444. @option{scthresh} is @code{[0.0, 100.0]}.
  8445. Default value is @code{12.0}.
  8446. @item combmatch
  8447. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8448. account the combed scores of matches when deciding what match to use as the
  8449. final match. Available values are:
  8450. @table @samp
  8451. @item none
  8452. No final matching based on combed scores.
  8453. @item sc
  8454. Combed scores are only used when a scene change is detected.
  8455. @item full
  8456. Use combed scores all the time.
  8457. @end table
  8458. Default is @var{sc}.
  8459. @item combdbg
  8460. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8461. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8462. Available values are:
  8463. @table @samp
  8464. @item none
  8465. No forced calculation.
  8466. @item pcn
  8467. Force p/c/n calculations.
  8468. @item pcnub
  8469. Force p/c/n/u/b calculations.
  8470. @end table
  8471. Default value is @var{none}.
  8472. @item cthresh
  8473. This is the area combing threshold used for combed frame detection. This
  8474. essentially controls how "strong" or "visible" combing must be to be detected.
  8475. Larger values mean combing must be more visible and smaller values mean combing
  8476. can be less visible or strong and still be detected. Valid settings are from
  8477. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8478. be detected as combed). This is basically a pixel difference value. A good
  8479. range is @code{[8, 12]}.
  8480. Default value is @code{9}.
  8481. @item chroma
  8482. Sets whether or not chroma is considered in the combed frame decision. Only
  8483. disable this if your source has chroma problems (rainbowing, etc.) that are
  8484. causing problems for the combed frame detection with chroma enabled. Actually,
  8485. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8486. where there is chroma only combing in the source.
  8487. Default value is @code{0}.
  8488. @item blockx
  8489. @item blocky
  8490. Respectively set the x-axis and y-axis size of the window used during combed
  8491. frame detection. This has to do with the size of the area in which
  8492. @option{combpel} pixels are required to be detected as combed for a frame to be
  8493. declared combed. See the @option{combpel} parameter description for more info.
  8494. Possible values are any number that is a power of 2 starting at 4 and going up
  8495. to 512.
  8496. Default value is @code{16}.
  8497. @item combpel
  8498. The number of combed pixels inside any of the @option{blocky} by
  8499. @option{blockx} size blocks on the frame for the frame to be detected as
  8500. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8501. setting controls "how much" combing there must be in any localized area (a
  8502. window defined by the @option{blockx} and @option{blocky} settings) on the
  8503. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8504. which point no frames will ever be detected as combed). This setting is known
  8505. as @option{MI} in TFM/VFM vocabulary.
  8506. Default value is @code{80}.
  8507. @end table
  8508. @anchor{p/c/n/u/b meaning}
  8509. @subsection p/c/n/u/b meaning
  8510. @subsubsection p/c/n
  8511. We assume the following telecined stream:
  8512. @example
  8513. Top fields: 1 2 2 3 4
  8514. Bottom fields: 1 2 3 4 4
  8515. @end example
  8516. The numbers correspond to the progressive frame the fields relate to. Here, the
  8517. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8518. When @code{fieldmatch} is configured to run a matching from bottom
  8519. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8520. @example
  8521. Input stream:
  8522. T 1 2 2 3 4
  8523. B 1 2 3 4 4 <-- matching reference
  8524. Matches: c c n n c
  8525. Output stream:
  8526. T 1 2 3 4 4
  8527. B 1 2 3 4 4
  8528. @end example
  8529. As a result of the field matching, we can see that some frames get duplicated.
  8530. To perform a complete inverse telecine, you need to rely on a decimation filter
  8531. after this operation. See for instance the @ref{decimate} filter.
  8532. The same operation now matching from top fields (@option{field}=@var{top})
  8533. looks like this:
  8534. @example
  8535. Input stream:
  8536. T 1 2 2 3 4 <-- matching reference
  8537. B 1 2 3 4 4
  8538. Matches: c c p p c
  8539. Output stream:
  8540. T 1 2 2 3 4
  8541. B 1 2 2 3 4
  8542. @end example
  8543. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8544. basically, they refer to the frame and field of the opposite parity:
  8545. @itemize
  8546. @item @var{p} matches the field of the opposite parity in the previous frame
  8547. @item @var{c} matches the field of the opposite parity in the current frame
  8548. @item @var{n} matches the field of the opposite parity in the next frame
  8549. @end itemize
  8550. @subsubsection u/b
  8551. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8552. from the opposite parity flag. In the following examples, we assume that we are
  8553. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8554. 'x' is placed above and below each matched fields.
  8555. With bottom matching (@option{field}=@var{bottom}):
  8556. @example
  8557. Match: c p n b u
  8558. x x x x x
  8559. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8560. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8561. x x x x x
  8562. Output frames:
  8563. 2 1 2 2 2
  8564. 2 2 2 1 3
  8565. @end example
  8566. With top matching (@option{field}=@var{top}):
  8567. @example
  8568. Match: c p n b u
  8569. x x x x x
  8570. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8571. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8572. x x x x x
  8573. Output frames:
  8574. 2 2 2 1 2
  8575. 2 1 3 2 2
  8576. @end example
  8577. @subsection Examples
  8578. Simple IVTC of a top field first telecined stream:
  8579. @example
  8580. fieldmatch=order=tff:combmatch=none, decimate
  8581. @end example
  8582. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8583. @example
  8584. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8585. @end example
  8586. @section fieldorder
  8587. Transform the field order of the input video.
  8588. It accepts the following parameters:
  8589. @table @option
  8590. @item order
  8591. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8592. for bottom field first.
  8593. @end table
  8594. The default value is @samp{tff}.
  8595. The transformation is done by shifting the picture content up or down
  8596. by one line, and filling the remaining line with appropriate picture content.
  8597. This method is consistent with most broadcast field order converters.
  8598. If the input video is not flagged as being interlaced, or it is already
  8599. flagged as being of the required output field order, then this filter does
  8600. not alter the incoming video.
  8601. It is very useful when converting to or from PAL DV material,
  8602. which is bottom field first.
  8603. For example:
  8604. @example
  8605. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8606. @end example
  8607. @section fifo, afifo
  8608. Buffer input images and send them when they are requested.
  8609. It is mainly useful when auto-inserted by the libavfilter
  8610. framework.
  8611. It does not take parameters.
  8612. @section fillborders
  8613. Fill borders of the input video, without changing video stream dimensions.
  8614. Sometimes video can have garbage at the four edges and you may not want to
  8615. crop video input to keep size multiple of some number.
  8616. This filter accepts the following options:
  8617. @table @option
  8618. @item left
  8619. Number of pixels to fill from left border.
  8620. @item right
  8621. Number of pixels to fill from right border.
  8622. @item top
  8623. Number of pixels to fill from top border.
  8624. @item bottom
  8625. Number of pixels to fill from bottom border.
  8626. @item mode
  8627. Set fill mode.
  8628. It accepts the following values:
  8629. @table @samp
  8630. @item smear
  8631. fill pixels using outermost pixels
  8632. @item mirror
  8633. fill pixels using mirroring
  8634. @item fixed
  8635. fill pixels with constant value
  8636. @end table
  8637. Default is @var{smear}.
  8638. @item color
  8639. Set color for pixels in fixed mode. Default is @var{black}.
  8640. @end table
  8641. @subsection Commands
  8642. This filter supports same @ref{commands} as options.
  8643. The command accepts the same syntax of the corresponding option.
  8644. If the specified expression is not valid, it is kept at its current
  8645. value.
  8646. @section find_rect
  8647. Find a rectangular object
  8648. It accepts the following options:
  8649. @table @option
  8650. @item object
  8651. Filepath of the object image, needs to be in gray8.
  8652. @item threshold
  8653. Detection threshold, default is 0.5.
  8654. @item mipmaps
  8655. Number of mipmaps, default is 3.
  8656. @item xmin, ymin, xmax, ymax
  8657. Specifies the rectangle in which to search.
  8658. @end table
  8659. @subsection Examples
  8660. @itemize
  8661. @item
  8662. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8663. @example
  8664. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8665. @end example
  8666. @end itemize
  8667. @section floodfill
  8668. Flood area with values of same pixel components with another values.
  8669. It accepts the following options:
  8670. @table @option
  8671. @item x
  8672. Set pixel x coordinate.
  8673. @item y
  8674. Set pixel y coordinate.
  8675. @item s0
  8676. Set source #0 component value.
  8677. @item s1
  8678. Set source #1 component value.
  8679. @item s2
  8680. Set source #2 component value.
  8681. @item s3
  8682. Set source #3 component value.
  8683. @item d0
  8684. Set destination #0 component value.
  8685. @item d1
  8686. Set destination #1 component value.
  8687. @item d2
  8688. Set destination #2 component value.
  8689. @item d3
  8690. Set destination #3 component value.
  8691. @end table
  8692. @anchor{format}
  8693. @section format
  8694. Convert the input video to one of the specified pixel formats.
  8695. Libavfilter will try to pick one that is suitable as input to
  8696. the next filter.
  8697. It accepts the following parameters:
  8698. @table @option
  8699. @item pix_fmts
  8700. A '|'-separated list of pixel format names, such as
  8701. "pix_fmts=yuv420p|monow|rgb24".
  8702. @end table
  8703. @subsection Examples
  8704. @itemize
  8705. @item
  8706. Convert the input video to the @var{yuv420p} format
  8707. @example
  8708. format=pix_fmts=yuv420p
  8709. @end example
  8710. Convert the input video to any of the formats in the list
  8711. @example
  8712. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8713. @end example
  8714. @end itemize
  8715. @anchor{fps}
  8716. @section fps
  8717. Convert the video to specified constant frame rate by duplicating or dropping
  8718. frames as necessary.
  8719. It accepts the following parameters:
  8720. @table @option
  8721. @item fps
  8722. The desired output frame rate. The default is @code{25}.
  8723. @item start_time
  8724. Assume the first PTS should be the given value, in seconds. This allows for
  8725. padding/trimming at the start of stream. By default, no assumption is made
  8726. about the first frame's expected PTS, so no padding or trimming is done.
  8727. For example, this could be set to 0 to pad the beginning with duplicates of
  8728. the first frame if a video stream starts after the audio stream or to trim any
  8729. frames with a negative PTS.
  8730. @item round
  8731. Timestamp (PTS) rounding method.
  8732. Possible values are:
  8733. @table @option
  8734. @item zero
  8735. round towards 0
  8736. @item inf
  8737. round away from 0
  8738. @item down
  8739. round towards -infinity
  8740. @item up
  8741. round towards +infinity
  8742. @item near
  8743. round to nearest
  8744. @end table
  8745. The default is @code{near}.
  8746. @item eof_action
  8747. Action performed when reading the last frame.
  8748. Possible values are:
  8749. @table @option
  8750. @item round
  8751. Use same timestamp rounding method as used for other frames.
  8752. @item pass
  8753. Pass through last frame if input duration has not been reached yet.
  8754. @end table
  8755. The default is @code{round}.
  8756. @end table
  8757. Alternatively, the options can be specified as a flat string:
  8758. @var{fps}[:@var{start_time}[:@var{round}]].
  8759. See also the @ref{setpts} filter.
  8760. @subsection Examples
  8761. @itemize
  8762. @item
  8763. A typical usage in order to set the fps to 25:
  8764. @example
  8765. fps=fps=25
  8766. @end example
  8767. @item
  8768. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8769. @example
  8770. fps=fps=film:round=near
  8771. @end example
  8772. @end itemize
  8773. @section framepack
  8774. Pack two different video streams into a stereoscopic video, setting proper
  8775. metadata on supported codecs. The two views should have the same size and
  8776. framerate and processing will stop when the shorter video ends. Please note
  8777. that you may conveniently adjust view properties with the @ref{scale} and
  8778. @ref{fps} filters.
  8779. It accepts the following parameters:
  8780. @table @option
  8781. @item format
  8782. The desired packing format. Supported values are:
  8783. @table @option
  8784. @item sbs
  8785. The views are next to each other (default).
  8786. @item tab
  8787. The views are on top of each other.
  8788. @item lines
  8789. The views are packed by line.
  8790. @item columns
  8791. The views are packed by column.
  8792. @item frameseq
  8793. The views are temporally interleaved.
  8794. @end table
  8795. @end table
  8796. Some examples:
  8797. @example
  8798. # Convert left and right views into a frame-sequential video
  8799. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8800. # Convert views into a side-by-side video with the same output resolution as the input
  8801. 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
  8802. @end example
  8803. @section framerate
  8804. Change the frame rate by interpolating new video output frames from the source
  8805. frames.
  8806. This filter is not designed to function correctly with interlaced media. If
  8807. you wish to change the frame rate of interlaced media then you are required
  8808. to deinterlace before this filter and re-interlace after this filter.
  8809. A description of the accepted options follows.
  8810. @table @option
  8811. @item fps
  8812. Specify the output frames per second. This option can also be specified
  8813. as a value alone. The default is @code{50}.
  8814. @item interp_start
  8815. Specify the start of a range where the output frame will be created as a
  8816. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8817. the default is @code{15}.
  8818. @item interp_end
  8819. Specify the end of a range where the output frame will be created as a
  8820. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8821. the default is @code{240}.
  8822. @item scene
  8823. Specify the level at which a scene change is detected as a value between
  8824. 0 and 100 to indicate a new scene; a low value reflects a low
  8825. probability for the current frame to introduce a new scene, while a higher
  8826. value means the current frame is more likely to be one.
  8827. The default is @code{8.2}.
  8828. @item flags
  8829. Specify flags influencing the filter process.
  8830. Available value for @var{flags} is:
  8831. @table @option
  8832. @item scene_change_detect, scd
  8833. Enable scene change detection using the value of the option @var{scene}.
  8834. This flag is enabled by default.
  8835. @end table
  8836. @end table
  8837. @section framestep
  8838. Select one frame every N-th frame.
  8839. This filter accepts the following option:
  8840. @table @option
  8841. @item step
  8842. Select frame after every @code{step} frames.
  8843. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8844. @end table
  8845. @section freezedetect
  8846. Detect frozen video.
  8847. This filter logs a message and sets frame metadata when it detects that the
  8848. input video has no significant change in content during a specified duration.
  8849. Video freeze detection calculates the mean average absolute difference of all
  8850. the components of video frames and compares it to a noise floor.
  8851. The printed times and duration are expressed in seconds. The
  8852. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8853. whose timestamp equals or exceeds the detection duration and it contains the
  8854. timestamp of the first frame of the freeze. The
  8855. @code{lavfi.freezedetect.freeze_duration} and
  8856. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8857. after the freeze.
  8858. The filter accepts the following options:
  8859. @table @option
  8860. @item noise, n
  8861. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8862. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8863. 0.001.
  8864. @item duration, d
  8865. Set freeze duration until notification (default is 2 seconds).
  8866. @end table
  8867. @section freezeframes
  8868. Freeze video frames.
  8869. This filter freezes video frames using frame from 2nd input.
  8870. The filter accepts the following options:
  8871. @table @option
  8872. @item first
  8873. Set number of first frame from which to start freeze.
  8874. @item last
  8875. Set number of last frame from which to end freeze.
  8876. @item replace
  8877. Set number of frame from 2nd input which will be used instead of replaced frames.
  8878. @end table
  8879. @anchor{frei0r}
  8880. @section frei0r
  8881. Apply a frei0r effect to the input video.
  8882. To enable the compilation of this filter, you need to install the frei0r
  8883. header and configure FFmpeg with @code{--enable-frei0r}.
  8884. It accepts the following parameters:
  8885. @table @option
  8886. @item filter_name
  8887. The name of the frei0r effect to load. If the environment variable
  8888. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8889. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8890. Otherwise, the standard frei0r paths are searched, in this order:
  8891. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8892. @file{/usr/lib/frei0r-1/}.
  8893. @item filter_params
  8894. A '|'-separated list of parameters to pass to the frei0r effect.
  8895. @end table
  8896. A frei0r effect parameter can be a boolean (its value is either
  8897. "y" or "n"), a double, a color (specified as
  8898. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8899. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8900. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8901. a position (specified as @var{X}/@var{Y}, where
  8902. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8903. The number and types of parameters depend on the loaded effect. If an
  8904. effect parameter is not specified, the default value is set.
  8905. @subsection Examples
  8906. @itemize
  8907. @item
  8908. Apply the distort0r effect, setting the first two double parameters:
  8909. @example
  8910. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8911. @end example
  8912. @item
  8913. Apply the colordistance effect, taking a color as the first parameter:
  8914. @example
  8915. frei0r=colordistance:0.2/0.3/0.4
  8916. frei0r=colordistance:violet
  8917. frei0r=colordistance:0x112233
  8918. @end example
  8919. @item
  8920. Apply the perspective effect, specifying the top left and top right image
  8921. positions:
  8922. @example
  8923. frei0r=perspective:0.2/0.2|0.8/0.2
  8924. @end example
  8925. @end itemize
  8926. For more information, see
  8927. @url{http://frei0r.dyne.org}
  8928. @section fspp
  8929. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8930. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8931. processing filter, one of them is performed once per block, not per pixel.
  8932. This allows for much higher speed.
  8933. The filter accepts the following options:
  8934. @table @option
  8935. @item quality
  8936. Set quality. This option defines the number of levels for averaging. It accepts
  8937. an integer in the range 4-5. Default value is @code{4}.
  8938. @item qp
  8939. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8940. If not set, the filter will use the QP from the video stream (if available).
  8941. @item strength
  8942. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8943. more details but also more artifacts, while higher values make the image smoother
  8944. but also blurrier. Default value is @code{0} − PSNR optimal.
  8945. @item use_bframe_qp
  8946. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8947. option may cause flicker since the B-Frames have often larger QP. Default is
  8948. @code{0} (not enabled).
  8949. @end table
  8950. @section gblur
  8951. Apply Gaussian blur filter.
  8952. The filter accepts the following options:
  8953. @table @option
  8954. @item sigma
  8955. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8956. @item steps
  8957. Set number of steps for Gaussian approximation. Default is @code{1}.
  8958. @item planes
  8959. Set which planes to filter. By default all planes are filtered.
  8960. @item sigmaV
  8961. Set vertical sigma, if negative it will be same as @code{sigma}.
  8962. Default is @code{-1}.
  8963. @end table
  8964. @subsection Commands
  8965. This filter supports same commands as options.
  8966. The command accepts the same syntax of the corresponding option.
  8967. If the specified expression is not valid, it is kept at its current
  8968. value.
  8969. @section geq
  8970. Apply generic equation to each pixel.
  8971. The filter accepts the following options:
  8972. @table @option
  8973. @item lum_expr, lum
  8974. Set the luminance expression.
  8975. @item cb_expr, cb
  8976. Set the chrominance blue expression.
  8977. @item cr_expr, cr
  8978. Set the chrominance red expression.
  8979. @item alpha_expr, a
  8980. Set the alpha expression.
  8981. @item red_expr, r
  8982. Set the red expression.
  8983. @item green_expr, g
  8984. Set the green expression.
  8985. @item blue_expr, b
  8986. Set the blue expression.
  8987. @end table
  8988. The colorspace is selected according to the specified options. If one
  8989. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8990. options is specified, the filter will automatically select a YCbCr
  8991. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8992. @option{blue_expr} options is specified, it will select an RGB
  8993. colorspace.
  8994. If one of the chrominance expression is not defined, it falls back on the other
  8995. one. If no alpha expression is specified it will evaluate to opaque value.
  8996. If none of chrominance expressions are specified, they will evaluate
  8997. to the luminance expression.
  8998. The expressions can use the following variables and functions:
  8999. @table @option
  9000. @item N
  9001. The sequential number of the filtered frame, starting from @code{0}.
  9002. @item X
  9003. @item Y
  9004. The coordinates of the current sample.
  9005. @item W
  9006. @item H
  9007. The width and height of the image.
  9008. @item SW
  9009. @item SH
  9010. Width and height scale depending on the currently filtered plane. It is the
  9011. ratio between the corresponding luma plane number of pixels and the current
  9012. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  9013. @code{0.5,0.5} for chroma planes.
  9014. @item T
  9015. Time of the current frame, expressed in seconds.
  9016. @item p(x, y)
  9017. Return the value of the pixel at location (@var{x},@var{y}) of the current
  9018. plane.
  9019. @item lum(x, y)
  9020. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  9021. plane.
  9022. @item cb(x, y)
  9023. Return the value of the pixel at location (@var{x},@var{y}) of the
  9024. blue-difference chroma plane. Return 0 if there is no such plane.
  9025. @item cr(x, y)
  9026. Return the value of the pixel at location (@var{x},@var{y}) of the
  9027. red-difference chroma plane. Return 0 if there is no such plane.
  9028. @item r(x, y)
  9029. @item g(x, y)
  9030. @item b(x, y)
  9031. Return the value of the pixel at location (@var{x},@var{y}) of the
  9032. red/green/blue component. Return 0 if there is no such component.
  9033. @item alpha(x, y)
  9034. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  9035. plane. Return 0 if there is no such plane.
  9036. @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)
  9037. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  9038. sums of samples within a rectangle. See the functions without the sum postfix.
  9039. @item interpolation
  9040. Set one of interpolation methods:
  9041. @table @option
  9042. @item nearest, n
  9043. @item bilinear, b
  9044. @end table
  9045. Default is bilinear.
  9046. @end table
  9047. For functions, if @var{x} and @var{y} are outside the area, the value will be
  9048. automatically clipped to the closer edge.
  9049. Please note that this filter can use multiple threads in which case each slice
  9050. will have its own expression state. If you want to use only a single expression
  9051. state because your expressions depend on previous state then you should limit
  9052. the number of filter threads to 1.
  9053. @subsection Examples
  9054. @itemize
  9055. @item
  9056. Flip the image horizontally:
  9057. @example
  9058. geq=p(W-X\,Y)
  9059. @end example
  9060. @item
  9061. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  9062. wavelength of 100 pixels:
  9063. @example
  9064. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  9065. @end example
  9066. @item
  9067. Generate a fancy enigmatic moving light:
  9068. @example
  9069. 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
  9070. @end example
  9071. @item
  9072. Generate a quick emboss effect:
  9073. @example
  9074. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  9075. @end example
  9076. @item
  9077. Modify RGB components depending on pixel position:
  9078. @example
  9079. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  9080. @end example
  9081. @item
  9082. Create a radial gradient that is the same size as the input (also see
  9083. the @ref{vignette} filter):
  9084. @example
  9085. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  9086. @end example
  9087. @end itemize
  9088. @section gradfun
  9089. Fix the banding artifacts that are sometimes introduced into nearly flat
  9090. regions by truncation to 8-bit color depth.
  9091. Interpolate the gradients that should go where the bands are, and
  9092. dither them.
  9093. It is designed for playback only. Do not use it prior to
  9094. lossy compression, because compression tends to lose the dither and
  9095. bring back the bands.
  9096. It accepts the following parameters:
  9097. @table @option
  9098. @item strength
  9099. The maximum amount by which the filter will change any one pixel. This is also
  9100. the threshold for detecting nearly flat regions. Acceptable values range from
  9101. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  9102. valid range.
  9103. @item radius
  9104. The neighborhood to fit the gradient to. A larger radius makes for smoother
  9105. gradients, but also prevents the filter from modifying the pixels near detailed
  9106. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  9107. values will be clipped to the valid range.
  9108. @end table
  9109. Alternatively, the options can be specified as a flat string:
  9110. @var{strength}[:@var{radius}]
  9111. @subsection Examples
  9112. @itemize
  9113. @item
  9114. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  9115. @example
  9116. gradfun=3.5:8
  9117. @end example
  9118. @item
  9119. Specify radius, omitting the strength (which will fall-back to the default
  9120. value):
  9121. @example
  9122. gradfun=radius=8
  9123. @end example
  9124. @end itemize
  9125. @anchor{graphmonitor}
  9126. @section graphmonitor
  9127. Show various filtergraph stats.
  9128. With this filter one can debug complete filtergraph.
  9129. Especially issues with links filling with queued frames.
  9130. The filter accepts the following options:
  9131. @table @option
  9132. @item size, s
  9133. Set video output size. Default is @var{hd720}.
  9134. @item opacity, o
  9135. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  9136. @item mode, m
  9137. Set output mode, can be @var{fulll} or @var{compact}.
  9138. In @var{compact} mode only filters with some queued frames have displayed stats.
  9139. @item flags, f
  9140. Set flags which enable which stats are shown in video.
  9141. Available values for flags are:
  9142. @table @samp
  9143. @item queue
  9144. Display number of queued frames in each link.
  9145. @item frame_count_in
  9146. Display number of frames taken from filter.
  9147. @item frame_count_out
  9148. Display number of frames given out from filter.
  9149. @item pts
  9150. Display current filtered frame pts.
  9151. @item time
  9152. Display current filtered frame time.
  9153. @item timebase
  9154. Display time base for filter link.
  9155. @item format
  9156. Display used format for filter link.
  9157. @item size
  9158. Display video size or number of audio channels in case of audio used by filter link.
  9159. @item rate
  9160. Display video frame rate or sample rate in case of audio used by filter link.
  9161. @item eof
  9162. Display link output status.
  9163. @end table
  9164. @item rate, r
  9165. Set upper limit for video rate of output stream, Default value is @var{25}.
  9166. This guarantee that output video frame rate will not be higher than this value.
  9167. @end table
  9168. @section greyedge
  9169. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  9170. and corrects the scene colors accordingly.
  9171. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  9172. The filter accepts the following options:
  9173. @table @option
  9174. @item difford
  9175. The order of differentiation to be applied on the scene. Must be chosen in the range
  9176. [0,2] and default value is 1.
  9177. @item minknorm
  9178. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  9179. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  9180. max value instead of calculating Minkowski distance.
  9181. @item sigma
  9182. The standard deviation of Gaussian blur to be applied on the scene. Must be
  9183. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  9184. can't be equal to 0 if @var{difford} is greater than 0.
  9185. @end table
  9186. @subsection Examples
  9187. @itemize
  9188. @item
  9189. Grey Edge:
  9190. @example
  9191. greyedge=difford=1:minknorm=5:sigma=2
  9192. @end example
  9193. @item
  9194. Max Edge:
  9195. @example
  9196. greyedge=difford=1:minknorm=0:sigma=2
  9197. @end example
  9198. @end itemize
  9199. @anchor{haldclut}
  9200. @section haldclut
  9201. Apply a Hald CLUT to a video stream.
  9202. First input is the video stream to process, and second one is the Hald CLUT.
  9203. The Hald CLUT input can be a simple picture or a complete video stream.
  9204. The filter accepts the following options:
  9205. @table @option
  9206. @item shortest
  9207. Force termination when the shortest input terminates. Default is @code{0}.
  9208. @item repeatlast
  9209. Continue applying the last CLUT after the end of the stream. A value of
  9210. @code{0} disable the filter after the last frame of the CLUT is reached.
  9211. Default is @code{1}.
  9212. @end table
  9213. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9214. filters share the same internals).
  9215. This filter also supports the @ref{framesync} options.
  9216. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9217. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9218. @subsection Workflow examples
  9219. @subsubsection Hald CLUT video stream
  9220. Generate an identity Hald CLUT stream altered with various effects:
  9221. @example
  9222. 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
  9223. @end example
  9224. Note: make sure you use a lossless codec.
  9225. Then use it with @code{haldclut} to apply it on some random stream:
  9226. @example
  9227. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9228. @end example
  9229. The Hald CLUT will be applied to the 10 first seconds (duration of
  9230. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9231. to the remaining frames of the @code{mandelbrot} stream.
  9232. @subsubsection Hald CLUT with preview
  9233. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9234. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9235. biggest possible square starting at the top left of the picture. The remaining
  9236. padding pixels (bottom or right) will be ignored. This area can be used to add
  9237. a preview of the Hald CLUT.
  9238. Typically, the following generated Hald CLUT will be supported by the
  9239. @code{haldclut} filter:
  9240. @example
  9241. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9242. pad=iw+320 [padded_clut];
  9243. smptebars=s=320x256, split [a][b];
  9244. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9245. [main][b] overlay=W-320" -frames:v 1 clut.png
  9246. @end example
  9247. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9248. bars are displayed on the right-top, and below the same color bars processed by
  9249. the color changes.
  9250. Then, the effect of this Hald CLUT can be visualized with:
  9251. @example
  9252. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9253. @end example
  9254. @section hflip
  9255. Flip the input video horizontally.
  9256. For example, to horizontally flip the input video with @command{ffmpeg}:
  9257. @example
  9258. ffmpeg -i in.avi -vf "hflip" out.avi
  9259. @end example
  9260. @section histeq
  9261. This filter applies a global color histogram equalization on a
  9262. per-frame basis.
  9263. It can be used to correct video that has a compressed range of pixel
  9264. intensities. The filter redistributes the pixel intensities to
  9265. equalize their distribution across the intensity range. It may be
  9266. viewed as an "automatically adjusting contrast filter". This filter is
  9267. useful only for correcting degraded or poorly captured source
  9268. video.
  9269. The filter accepts the following options:
  9270. @table @option
  9271. @item strength
  9272. Determine the amount of equalization to be applied. As the strength
  9273. is reduced, the distribution of pixel intensities more-and-more
  9274. approaches that of the input frame. The value must be a float number
  9275. in the range [0,1] and defaults to 0.200.
  9276. @item intensity
  9277. Set the maximum intensity that can generated and scale the output
  9278. values appropriately. The strength should be set as desired and then
  9279. the intensity can be limited if needed to avoid washing-out. The value
  9280. must be a float number in the range [0,1] and defaults to 0.210.
  9281. @item antibanding
  9282. Set the antibanding level. If enabled the filter will randomly vary
  9283. the luminance of output pixels by a small amount to avoid banding of
  9284. the histogram. Possible values are @code{none}, @code{weak} or
  9285. @code{strong}. It defaults to @code{none}.
  9286. @end table
  9287. @anchor{histogram}
  9288. @section histogram
  9289. Compute and draw a color distribution histogram for the input video.
  9290. The computed histogram is a representation of the color component
  9291. distribution in an image.
  9292. Standard histogram displays the color components distribution in an image.
  9293. Displays color graph for each color component. Shows distribution of
  9294. the Y, U, V, A or R, G, B components, depending on input format, in the
  9295. current frame. Below each graph a color component scale meter is shown.
  9296. The filter accepts the following options:
  9297. @table @option
  9298. @item level_height
  9299. Set height of level. Default value is @code{200}.
  9300. Allowed range is [50, 2048].
  9301. @item scale_height
  9302. Set height of color scale. Default value is @code{12}.
  9303. Allowed range is [0, 40].
  9304. @item display_mode
  9305. Set display mode.
  9306. It accepts the following values:
  9307. @table @samp
  9308. @item stack
  9309. Per color component graphs are placed below each other.
  9310. @item parade
  9311. Per color component graphs are placed side by side.
  9312. @item overlay
  9313. Presents information identical to that in the @code{parade}, except
  9314. that the graphs representing color components are superimposed directly
  9315. over one another.
  9316. @end table
  9317. Default is @code{stack}.
  9318. @item levels_mode
  9319. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9320. Default is @code{linear}.
  9321. @item components
  9322. Set what color components to display.
  9323. Default is @code{7}.
  9324. @item fgopacity
  9325. Set foreground opacity. Default is @code{0.7}.
  9326. @item bgopacity
  9327. Set background opacity. Default is @code{0.5}.
  9328. @end table
  9329. @subsection Examples
  9330. @itemize
  9331. @item
  9332. Calculate and draw histogram:
  9333. @example
  9334. ffplay -i input -vf histogram
  9335. @end example
  9336. @end itemize
  9337. @anchor{hqdn3d}
  9338. @section hqdn3d
  9339. This is a high precision/quality 3d denoise filter. It aims to reduce
  9340. image noise, producing smooth images and making still images really
  9341. still. It should enhance compressibility.
  9342. It accepts the following optional parameters:
  9343. @table @option
  9344. @item luma_spatial
  9345. A non-negative floating point number which specifies spatial luma strength.
  9346. It defaults to 4.0.
  9347. @item chroma_spatial
  9348. A non-negative floating point number which specifies spatial chroma strength.
  9349. It defaults to 3.0*@var{luma_spatial}/4.0.
  9350. @item luma_tmp
  9351. A floating point number which specifies luma temporal strength. It defaults to
  9352. 6.0*@var{luma_spatial}/4.0.
  9353. @item chroma_tmp
  9354. A floating point number which specifies chroma temporal strength. It defaults to
  9355. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9356. @end table
  9357. @subsection Commands
  9358. This filter supports same @ref{commands} as options.
  9359. The command accepts the same syntax of the corresponding option.
  9360. If the specified expression is not valid, it is kept at its current
  9361. value.
  9362. @anchor{hwdownload}
  9363. @section hwdownload
  9364. Download hardware frames to system memory.
  9365. The input must be in hardware frames, and the output a non-hardware format.
  9366. Not all formats will be supported on the output - it may be necessary to insert
  9367. an additional @option{format} filter immediately following in the graph to get
  9368. the output in a supported format.
  9369. @section hwmap
  9370. Map hardware frames to system memory or to another device.
  9371. This filter has several different modes of operation; which one is used depends
  9372. on the input and output formats:
  9373. @itemize
  9374. @item
  9375. Hardware frame input, normal frame output
  9376. Map the input frames to system memory and pass them to the output. If the
  9377. original hardware frame is later required (for example, after overlaying
  9378. something else on part of it), the @option{hwmap} filter can be used again
  9379. in the next mode to retrieve it.
  9380. @item
  9381. Normal frame input, hardware frame output
  9382. If the input is actually a software-mapped hardware frame, then unmap it -
  9383. that is, return the original hardware frame.
  9384. Otherwise, a device must be provided. Create new hardware surfaces on that
  9385. device for the output, then map them back to the software format at the input
  9386. and give those frames to the preceding filter. This will then act like the
  9387. @option{hwupload} filter, but may be able to avoid an additional copy when
  9388. the input is already in a compatible format.
  9389. @item
  9390. Hardware frame input and output
  9391. A device must be supplied for the output, either directly or with the
  9392. @option{derive_device} option. The input and output devices must be of
  9393. different types and compatible - the exact meaning of this is
  9394. system-dependent, but typically it means that they must refer to the same
  9395. underlying hardware context (for example, refer to the same graphics card).
  9396. If the input frames were originally created on the output device, then unmap
  9397. to retrieve the original frames.
  9398. Otherwise, map the frames to the output device - create new hardware frames
  9399. on the output corresponding to the frames on the input.
  9400. @end itemize
  9401. The following additional parameters are accepted:
  9402. @table @option
  9403. @item mode
  9404. Set the frame mapping mode. Some combination of:
  9405. @table @var
  9406. @item read
  9407. The mapped frame should be readable.
  9408. @item write
  9409. The mapped frame should be writeable.
  9410. @item overwrite
  9411. The mapping will always overwrite the entire frame.
  9412. This may improve performance in some cases, as the original contents of the
  9413. frame need not be loaded.
  9414. @item direct
  9415. The mapping must not involve any copying.
  9416. Indirect mappings to copies of frames are created in some cases where either
  9417. direct mapping is not possible or it would have unexpected properties.
  9418. Setting this flag ensures that the mapping is direct and will fail if that is
  9419. not possible.
  9420. @end table
  9421. Defaults to @var{read+write} if not specified.
  9422. @item derive_device @var{type}
  9423. Rather than using the device supplied at initialisation, instead derive a new
  9424. device of type @var{type} from the device the input frames exist on.
  9425. @item reverse
  9426. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9427. and map them back to the source. This may be necessary in some cases where
  9428. a mapping in one direction is required but only the opposite direction is
  9429. supported by the devices being used.
  9430. This option is dangerous - it may break the preceding filter in undefined
  9431. ways if there are any additional constraints on that filter's output.
  9432. Do not use it without fully understanding the implications of its use.
  9433. @end table
  9434. @anchor{hwupload}
  9435. @section hwupload
  9436. Upload system memory frames to hardware surfaces.
  9437. The device to upload to must be supplied when the filter is initialised. If
  9438. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9439. option or with the @option{derive_device} option. The input and output devices
  9440. must be of different types and compatible - the exact meaning of this is
  9441. system-dependent, but typically it means that they must refer to the same
  9442. underlying hardware context (for example, refer to the same graphics card).
  9443. The following additional parameters are accepted:
  9444. @table @option
  9445. @item derive_device @var{type}
  9446. Rather than using the device supplied at initialisation, instead derive a new
  9447. device of type @var{type} from the device the input frames exist on.
  9448. @end table
  9449. @anchor{hwupload_cuda}
  9450. @section hwupload_cuda
  9451. Upload system memory frames to a CUDA device.
  9452. It accepts the following optional parameters:
  9453. @table @option
  9454. @item device
  9455. The number of the CUDA device to use
  9456. @end table
  9457. @section hqx
  9458. Apply a high-quality magnification filter designed for pixel art. This filter
  9459. was originally created by Maxim Stepin.
  9460. It accepts the following option:
  9461. @table @option
  9462. @item n
  9463. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9464. @code{hq3x} and @code{4} for @code{hq4x}.
  9465. Default is @code{3}.
  9466. @end table
  9467. @section hstack
  9468. Stack input videos horizontally.
  9469. All streams must be of same pixel format and of same height.
  9470. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9471. to create same output.
  9472. The filter accepts the following option:
  9473. @table @option
  9474. @item inputs
  9475. Set number of input streams. Default is 2.
  9476. @item shortest
  9477. If set to 1, force the output to terminate when the shortest input
  9478. terminates. Default value is 0.
  9479. @end table
  9480. @section hue
  9481. Modify the hue and/or the saturation of the input.
  9482. It accepts the following parameters:
  9483. @table @option
  9484. @item h
  9485. Specify the hue angle as a number of degrees. It accepts an expression,
  9486. and defaults to "0".
  9487. @item s
  9488. Specify the saturation in the [-10,10] range. It accepts an expression and
  9489. defaults to "1".
  9490. @item H
  9491. Specify the hue angle as a number of radians. It accepts an
  9492. expression, and defaults to "0".
  9493. @item b
  9494. Specify the brightness in the [-10,10] range. It accepts an expression and
  9495. defaults to "0".
  9496. @end table
  9497. @option{h} and @option{H} are mutually exclusive, and can't be
  9498. specified at the same time.
  9499. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9500. expressions containing the following constants:
  9501. @table @option
  9502. @item n
  9503. frame count of the input frame starting from 0
  9504. @item pts
  9505. presentation timestamp of the input frame expressed in time base units
  9506. @item r
  9507. frame rate of the input video, NAN if the input frame rate is unknown
  9508. @item t
  9509. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9510. @item tb
  9511. time base of the input video
  9512. @end table
  9513. @subsection Examples
  9514. @itemize
  9515. @item
  9516. Set the hue to 90 degrees and the saturation to 1.0:
  9517. @example
  9518. hue=h=90:s=1
  9519. @end example
  9520. @item
  9521. Same command but expressing the hue in radians:
  9522. @example
  9523. hue=H=PI/2:s=1
  9524. @end example
  9525. @item
  9526. Rotate hue and make the saturation swing between 0
  9527. and 2 over a period of 1 second:
  9528. @example
  9529. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9530. @end example
  9531. @item
  9532. Apply a 3 seconds saturation fade-in effect starting at 0:
  9533. @example
  9534. hue="s=min(t/3\,1)"
  9535. @end example
  9536. The general fade-in expression can be written as:
  9537. @example
  9538. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9539. @end example
  9540. @item
  9541. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9542. @example
  9543. hue="s=max(0\, min(1\, (8-t)/3))"
  9544. @end example
  9545. The general fade-out expression can be written as:
  9546. @example
  9547. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9548. @end example
  9549. @end itemize
  9550. @subsection Commands
  9551. This filter supports the following commands:
  9552. @table @option
  9553. @item b
  9554. @item s
  9555. @item h
  9556. @item H
  9557. Modify the hue and/or the saturation and/or brightness of the input video.
  9558. The command accepts the same syntax of the corresponding option.
  9559. If the specified expression is not valid, it is kept at its current
  9560. value.
  9561. @end table
  9562. @section hysteresis
  9563. Grow first stream into second stream by connecting components.
  9564. This makes it possible to build more robust edge masks.
  9565. This filter accepts the following options:
  9566. @table @option
  9567. @item planes
  9568. Set which planes will be processed as bitmap, unprocessed planes will be
  9569. copied from first stream.
  9570. By default value 0xf, all planes will be processed.
  9571. @item threshold
  9572. Set threshold which is used in filtering. If pixel component value is higher than
  9573. this value filter algorithm for connecting components is activated.
  9574. By default value is 0.
  9575. @end table
  9576. The @code{hysteresis} filter also supports the @ref{framesync} options.
  9577. @section idet
  9578. Detect video interlacing type.
  9579. This filter tries to detect if the input frames are interlaced, progressive,
  9580. top or bottom field first. It will also try to detect fields that are
  9581. repeated between adjacent frames (a sign of telecine).
  9582. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9583. Multiple frame detection incorporates the classification history of previous frames.
  9584. The filter will log these metadata values:
  9585. @table @option
  9586. @item single.current_frame
  9587. Detected type of current frame using single-frame detection. One of:
  9588. ``tff'' (top field first), ``bff'' (bottom field first),
  9589. ``progressive'', or ``undetermined''
  9590. @item single.tff
  9591. Cumulative number of frames detected as top field first using single-frame detection.
  9592. @item multiple.tff
  9593. Cumulative number of frames detected as top field first using multiple-frame detection.
  9594. @item single.bff
  9595. Cumulative number of frames detected as bottom field first using single-frame detection.
  9596. @item multiple.current_frame
  9597. Detected type of current frame using multiple-frame detection. One of:
  9598. ``tff'' (top field first), ``bff'' (bottom field first),
  9599. ``progressive'', or ``undetermined''
  9600. @item multiple.bff
  9601. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9602. @item single.progressive
  9603. Cumulative number of frames detected as progressive using single-frame detection.
  9604. @item multiple.progressive
  9605. Cumulative number of frames detected as progressive using multiple-frame detection.
  9606. @item single.undetermined
  9607. Cumulative number of frames that could not be classified using single-frame detection.
  9608. @item multiple.undetermined
  9609. Cumulative number of frames that could not be classified using multiple-frame detection.
  9610. @item repeated.current_frame
  9611. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9612. @item repeated.neither
  9613. Cumulative number of frames with no repeated field.
  9614. @item repeated.top
  9615. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9616. @item repeated.bottom
  9617. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9618. @end table
  9619. The filter accepts the following options:
  9620. @table @option
  9621. @item intl_thres
  9622. Set interlacing threshold.
  9623. @item prog_thres
  9624. Set progressive threshold.
  9625. @item rep_thres
  9626. Threshold for repeated field detection.
  9627. @item half_life
  9628. Number of frames after which a given frame's contribution to the
  9629. statistics is halved (i.e., it contributes only 0.5 to its
  9630. classification). The default of 0 means that all frames seen are given
  9631. full weight of 1.0 forever.
  9632. @item analyze_interlaced_flag
  9633. When this is not 0 then idet will use the specified number of frames to determine
  9634. if the interlaced flag is accurate, it will not count undetermined frames.
  9635. If the flag is found to be accurate it will be used without any further
  9636. computations, if it is found to be inaccurate it will be cleared without any
  9637. further computations. This allows inserting the idet filter as a low computational
  9638. method to clean up the interlaced flag
  9639. @end table
  9640. @section il
  9641. Deinterleave or interleave fields.
  9642. This filter allows one to process interlaced images fields without
  9643. deinterlacing them. Deinterleaving splits the input frame into 2
  9644. fields (so called half pictures). Odd lines are moved to the top
  9645. half of the output image, even lines to the bottom half.
  9646. You can process (filter) them independently and then re-interleave them.
  9647. The filter accepts the following options:
  9648. @table @option
  9649. @item luma_mode, l
  9650. @item chroma_mode, c
  9651. @item alpha_mode, a
  9652. Available values for @var{luma_mode}, @var{chroma_mode} and
  9653. @var{alpha_mode} are:
  9654. @table @samp
  9655. @item none
  9656. Do nothing.
  9657. @item deinterleave, d
  9658. Deinterleave fields, placing one above the other.
  9659. @item interleave, i
  9660. Interleave fields. Reverse the effect of deinterleaving.
  9661. @end table
  9662. Default value is @code{none}.
  9663. @item luma_swap, ls
  9664. @item chroma_swap, cs
  9665. @item alpha_swap, as
  9666. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9667. @end table
  9668. @subsection Commands
  9669. This filter supports the all above options as @ref{commands}.
  9670. @section inflate
  9671. Apply inflate effect to the video.
  9672. This filter replaces the pixel by the local(3x3) average by taking into account
  9673. only values higher than the pixel.
  9674. It accepts the following options:
  9675. @table @option
  9676. @item threshold0
  9677. @item threshold1
  9678. @item threshold2
  9679. @item threshold3
  9680. Limit the maximum change for each plane, default is 65535.
  9681. If 0, plane will remain unchanged.
  9682. @end table
  9683. @subsection Commands
  9684. This filter supports the all above options as @ref{commands}.
  9685. @section interlace
  9686. Simple interlacing filter from progressive contents. This interleaves upper (or
  9687. lower) lines from odd frames with lower (or upper) lines from even frames,
  9688. halving the frame rate and preserving image height.
  9689. @example
  9690. Original Original New Frame
  9691. Frame 'j' Frame 'j+1' (tff)
  9692. ========== =========== ==================
  9693. Line 0 --------------------> Frame 'j' Line 0
  9694. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9695. Line 2 ---------------------> Frame 'j' Line 2
  9696. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9697. ... ... ...
  9698. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9699. @end example
  9700. It accepts the following optional parameters:
  9701. @table @option
  9702. @item scan
  9703. This determines whether the interlaced frame is taken from the even
  9704. (tff - default) or odd (bff) lines of the progressive frame.
  9705. @item lowpass
  9706. Vertical lowpass filter to avoid twitter interlacing and
  9707. reduce moire patterns.
  9708. @table @samp
  9709. @item 0, off
  9710. Disable vertical lowpass filter
  9711. @item 1, linear
  9712. Enable linear filter (default)
  9713. @item 2, complex
  9714. Enable complex filter. This will slightly less reduce twitter and moire
  9715. but better retain detail and subjective sharpness impression.
  9716. @end table
  9717. @end table
  9718. @section kerndeint
  9719. Deinterlace input video by applying Donald Graft's adaptive kernel
  9720. deinterling. Work on interlaced parts of a video to produce
  9721. progressive frames.
  9722. The description of the accepted parameters follows.
  9723. @table @option
  9724. @item thresh
  9725. Set the threshold which affects the filter's tolerance when
  9726. determining if a pixel line must be processed. It must be an integer
  9727. in the range [0,255] and defaults to 10. A value of 0 will result in
  9728. applying the process on every pixels.
  9729. @item map
  9730. Paint pixels exceeding the threshold value to white if set to 1.
  9731. Default is 0.
  9732. @item order
  9733. Set the fields order. Swap fields if set to 1, leave fields alone if
  9734. 0. Default is 0.
  9735. @item sharp
  9736. Enable additional sharpening if set to 1. Default is 0.
  9737. @item twoway
  9738. Enable twoway sharpening if set to 1. Default is 0.
  9739. @end table
  9740. @subsection Examples
  9741. @itemize
  9742. @item
  9743. Apply default values:
  9744. @example
  9745. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9746. @end example
  9747. @item
  9748. Enable additional sharpening:
  9749. @example
  9750. kerndeint=sharp=1
  9751. @end example
  9752. @item
  9753. Paint processed pixels in white:
  9754. @example
  9755. kerndeint=map=1
  9756. @end example
  9757. @end itemize
  9758. @section lagfun
  9759. Slowly update darker pixels.
  9760. This filter makes short flashes of light appear longer.
  9761. This filter accepts the following options:
  9762. @table @option
  9763. @item decay
  9764. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9765. @item planes
  9766. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9767. @end table
  9768. @section lenscorrection
  9769. Correct radial lens distortion
  9770. This filter can be used to correct for radial distortion as can result from the use
  9771. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9772. one can use tools available for example as part of opencv or simply trial-and-error.
  9773. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9774. and extract the k1 and k2 coefficients from the resulting matrix.
  9775. Note that effectively the same filter is available in the open-source tools Krita and
  9776. Digikam from the KDE project.
  9777. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9778. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9779. brightness distribution, so you may want to use both filters together in certain
  9780. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9781. be applied before or after lens correction.
  9782. @subsection Options
  9783. The filter accepts the following options:
  9784. @table @option
  9785. @item cx
  9786. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9787. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9788. width. Default is 0.5.
  9789. @item cy
  9790. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9791. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9792. height. Default is 0.5.
  9793. @item k1
  9794. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9795. no correction. Default is 0.
  9796. @item k2
  9797. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9798. 0 means no correction. Default is 0.
  9799. @end table
  9800. The formula that generates the correction is:
  9801. @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)
  9802. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9803. distances from the focal point in the source and target images, respectively.
  9804. @section lensfun
  9805. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9806. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9807. to apply the lens correction. The filter will load the lensfun database and
  9808. query it to find the corresponding camera and lens entries in the database. As
  9809. long as these entries can be found with the given options, the filter can
  9810. perform corrections on frames. Note that incomplete strings will result in the
  9811. filter choosing the best match with the given options, and the filter will
  9812. output the chosen camera and lens models (logged with level "info"). You must
  9813. provide the make, camera model, and lens model as they are required.
  9814. The filter accepts the following options:
  9815. @table @option
  9816. @item make
  9817. The make of the camera (for example, "Canon"). This option is required.
  9818. @item model
  9819. The model of the camera (for example, "Canon EOS 100D"). This option is
  9820. required.
  9821. @item lens_model
  9822. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9823. option is required.
  9824. @item mode
  9825. The type of correction to apply. The following values are valid options:
  9826. @table @samp
  9827. @item vignetting
  9828. Enables fixing lens vignetting.
  9829. @item geometry
  9830. Enables fixing lens geometry. This is the default.
  9831. @item subpixel
  9832. Enables fixing chromatic aberrations.
  9833. @item vig_geo
  9834. Enables fixing lens vignetting and lens geometry.
  9835. @item vig_subpixel
  9836. Enables fixing lens vignetting and chromatic aberrations.
  9837. @item distortion
  9838. Enables fixing both lens geometry and chromatic aberrations.
  9839. @item all
  9840. Enables all possible corrections.
  9841. @end table
  9842. @item focal_length
  9843. The focal length of the image/video (zoom; expected constant for video). For
  9844. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9845. range should be chosen when using that lens. Default 18.
  9846. @item aperture
  9847. The aperture of the image/video (expected constant for video). Note that
  9848. aperture is only used for vignetting correction. Default 3.5.
  9849. @item focus_distance
  9850. The focus distance of the image/video (expected constant for video). Note that
  9851. focus distance is only used for vignetting and only slightly affects the
  9852. vignetting correction process. If unknown, leave it at the default value (which
  9853. is 1000).
  9854. @item scale
  9855. The scale factor which is applied after transformation. After correction the
  9856. video is no longer necessarily rectangular. This parameter controls how much of
  9857. the resulting image is visible. The value 0 means that a value will be chosen
  9858. automatically such that there is little or no unmapped area in the output
  9859. image. 1.0 means that no additional scaling is done. Lower values may result
  9860. in more of the corrected image being visible, while higher values may avoid
  9861. unmapped areas in the output.
  9862. @item target_geometry
  9863. The target geometry of the output image/video. The following values are valid
  9864. options:
  9865. @table @samp
  9866. @item rectilinear (default)
  9867. @item fisheye
  9868. @item panoramic
  9869. @item equirectangular
  9870. @item fisheye_orthographic
  9871. @item fisheye_stereographic
  9872. @item fisheye_equisolid
  9873. @item fisheye_thoby
  9874. @end table
  9875. @item reverse
  9876. Apply the reverse of image correction (instead of correcting distortion, apply
  9877. it).
  9878. @item interpolation
  9879. The type of interpolation used when correcting distortion. The following values
  9880. are valid options:
  9881. @table @samp
  9882. @item nearest
  9883. @item linear (default)
  9884. @item lanczos
  9885. @end table
  9886. @end table
  9887. @subsection Examples
  9888. @itemize
  9889. @item
  9890. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9891. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9892. aperture of "8.0".
  9893. @example
  9894. 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
  9895. @end example
  9896. @item
  9897. Apply the same as before, but only for the first 5 seconds of video.
  9898. @example
  9899. 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
  9900. @end example
  9901. @end itemize
  9902. @section libvmaf
  9903. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9904. score between two input videos.
  9905. The obtained VMAF score is printed through the logging system.
  9906. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9907. After installing the library it can be enabled using:
  9908. @code{./configure --enable-libvmaf}.
  9909. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9910. The filter has following options:
  9911. @table @option
  9912. @item model_path
  9913. Set the model path which is to be used for SVM.
  9914. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  9915. @item log_path
  9916. Set the file path to be used to store logs.
  9917. @item log_fmt
  9918. Set the format of the log file (csv, json or xml).
  9919. @item enable_transform
  9920. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9921. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9922. Default value: @code{false}
  9923. @item phone_model
  9924. Invokes the phone model which will generate VMAF scores higher than in the
  9925. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9926. Default value: @code{false}
  9927. @item psnr
  9928. Enables computing psnr along with vmaf.
  9929. Default value: @code{false}
  9930. @item ssim
  9931. Enables computing ssim along with vmaf.
  9932. Default value: @code{false}
  9933. @item ms_ssim
  9934. Enables computing ms_ssim along with vmaf.
  9935. Default value: @code{false}
  9936. @item pool
  9937. Set the pool method to be used for computing vmaf.
  9938. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  9939. @item n_threads
  9940. Set number of threads to be used when computing vmaf.
  9941. Default value: @code{0}, which makes use of all available logical processors.
  9942. @item n_subsample
  9943. Set interval for frame subsampling used when computing vmaf.
  9944. Default value: @code{1}
  9945. @item enable_conf_interval
  9946. Enables confidence interval.
  9947. Default value: @code{false}
  9948. @end table
  9949. This filter also supports the @ref{framesync} options.
  9950. @subsection Examples
  9951. @itemize
  9952. @item
  9953. On the below examples the input file @file{main.mpg} being processed is
  9954. compared with the reference file @file{ref.mpg}.
  9955. @example
  9956. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9957. @end example
  9958. @item
  9959. Example with options:
  9960. @example
  9961. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9962. @end example
  9963. @item
  9964. Example with options and different containers:
  9965. @example
  9966. 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 -
  9967. @end example
  9968. @end itemize
  9969. @section limiter
  9970. Limits the pixel components values to the specified range [min, max].
  9971. The filter accepts the following options:
  9972. @table @option
  9973. @item min
  9974. Lower bound. Defaults to the lowest allowed value for the input.
  9975. @item max
  9976. Upper bound. Defaults to the highest allowed value for the input.
  9977. @item planes
  9978. Specify which planes will be processed. Defaults to all available.
  9979. @end table
  9980. @section loop
  9981. Loop video frames.
  9982. The filter accepts the following options:
  9983. @table @option
  9984. @item loop
  9985. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9986. Default is 0.
  9987. @item size
  9988. Set maximal size in number of frames. Default is 0.
  9989. @item start
  9990. Set first frame of loop. Default is 0.
  9991. @end table
  9992. @subsection Examples
  9993. @itemize
  9994. @item
  9995. Loop single first frame infinitely:
  9996. @example
  9997. loop=loop=-1:size=1:start=0
  9998. @end example
  9999. @item
  10000. Loop single first frame 10 times:
  10001. @example
  10002. loop=loop=10:size=1:start=0
  10003. @end example
  10004. @item
  10005. Loop 10 first frames 5 times:
  10006. @example
  10007. loop=loop=5:size=10:start=0
  10008. @end example
  10009. @end itemize
  10010. @section lut1d
  10011. Apply a 1D LUT to an input video.
  10012. The filter accepts the following options:
  10013. @table @option
  10014. @item file
  10015. Set the 1D LUT file name.
  10016. Currently supported formats:
  10017. @table @samp
  10018. @item cube
  10019. Iridas
  10020. @item csp
  10021. cineSpace
  10022. @end table
  10023. @item interp
  10024. Select interpolation mode.
  10025. Available values are:
  10026. @table @samp
  10027. @item nearest
  10028. Use values from the nearest defined point.
  10029. @item linear
  10030. Interpolate values using the linear interpolation.
  10031. @item cosine
  10032. Interpolate values using the cosine interpolation.
  10033. @item cubic
  10034. Interpolate values using the cubic interpolation.
  10035. @item spline
  10036. Interpolate values using the spline interpolation.
  10037. @end table
  10038. @end table
  10039. @anchor{lut3d}
  10040. @section lut3d
  10041. Apply a 3D LUT to an input video.
  10042. The filter accepts the following options:
  10043. @table @option
  10044. @item file
  10045. Set the 3D LUT file name.
  10046. Currently supported formats:
  10047. @table @samp
  10048. @item 3dl
  10049. AfterEffects
  10050. @item cube
  10051. Iridas
  10052. @item dat
  10053. DaVinci
  10054. @item m3d
  10055. Pandora
  10056. @item csp
  10057. cineSpace
  10058. @end table
  10059. @item interp
  10060. Select interpolation mode.
  10061. Available values are:
  10062. @table @samp
  10063. @item nearest
  10064. Use values from the nearest defined point.
  10065. @item trilinear
  10066. Interpolate values using the 8 points defining a cube.
  10067. @item tetrahedral
  10068. Interpolate values using a tetrahedron.
  10069. @end table
  10070. @end table
  10071. @section lumakey
  10072. Turn certain luma values into transparency.
  10073. The filter accepts the following options:
  10074. @table @option
  10075. @item threshold
  10076. Set the luma which will be used as base for transparency.
  10077. Default value is @code{0}.
  10078. @item tolerance
  10079. Set the range of luma values to be keyed out.
  10080. Default value is @code{0.01}.
  10081. @item softness
  10082. Set the range of softness. Default value is @code{0}.
  10083. Use this to control gradual transition from zero to full transparency.
  10084. @end table
  10085. @subsection Commands
  10086. This filter supports same @ref{commands} as options.
  10087. The command accepts the same syntax of the corresponding option.
  10088. If the specified expression is not valid, it is kept at its current
  10089. value.
  10090. @section lut, lutrgb, lutyuv
  10091. Compute a look-up table for binding each pixel component input value
  10092. to an output value, and apply it to the input video.
  10093. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  10094. to an RGB input video.
  10095. These filters accept the following parameters:
  10096. @table @option
  10097. @item c0
  10098. set first pixel component expression
  10099. @item c1
  10100. set second pixel component expression
  10101. @item c2
  10102. set third pixel component expression
  10103. @item c3
  10104. set fourth pixel component expression, corresponds to the alpha component
  10105. @item r
  10106. set red component expression
  10107. @item g
  10108. set green component expression
  10109. @item b
  10110. set blue component expression
  10111. @item a
  10112. alpha component expression
  10113. @item y
  10114. set Y/luminance component expression
  10115. @item u
  10116. set U/Cb component expression
  10117. @item v
  10118. set V/Cr component expression
  10119. @end table
  10120. Each of them specifies the expression to use for computing the lookup table for
  10121. the corresponding pixel component values.
  10122. The exact component associated to each of the @var{c*} options depends on the
  10123. format in input.
  10124. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  10125. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  10126. The expressions can contain the following constants and functions:
  10127. @table @option
  10128. @item w
  10129. @item h
  10130. The input width and height.
  10131. @item val
  10132. The input value for the pixel component.
  10133. @item clipval
  10134. The input value, clipped to the @var{minval}-@var{maxval} range.
  10135. @item maxval
  10136. The maximum value for the pixel component.
  10137. @item minval
  10138. The minimum value for the pixel component.
  10139. @item negval
  10140. The negated value for the pixel component value, clipped to the
  10141. @var{minval}-@var{maxval} range; it corresponds to the expression
  10142. "maxval-clipval+minval".
  10143. @item clip(val)
  10144. The computed value in @var{val}, clipped to the
  10145. @var{minval}-@var{maxval} range.
  10146. @item gammaval(gamma)
  10147. The computed gamma correction value of the pixel component value,
  10148. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  10149. expression
  10150. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  10151. @end table
  10152. All expressions default to "val".
  10153. @subsection Examples
  10154. @itemize
  10155. @item
  10156. Negate input video:
  10157. @example
  10158. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  10159. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  10160. @end example
  10161. The above is the same as:
  10162. @example
  10163. lutrgb="r=negval:g=negval:b=negval"
  10164. lutyuv="y=negval:u=negval:v=negval"
  10165. @end example
  10166. @item
  10167. Negate luminance:
  10168. @example
  10169. lutyuv=y=negval
  10170. @end example
  10171. @item
  10172. Remove chroma components, turning the video into a graytone image:
  10173. @example
  10174. lutyuv="u=128:v=128"
  10175. @end example
  10176. @item
  10177. Apply a luma burning effect:
  10178. @example
  10179. lutyuv="y=2*val"
  10180. @end example
  10181. @item
  10182. Remove green and blue components:
  10183. @example
  10184. lutrgb="g=0:b=0"
  10185. @end example
  10186. @item
  10187. Set a constant alpha channel value on input:
  10188. @example
  10189. format=rgba,lutrgb=a="maxval-minval/2"
  10190. @end example
  10191. @item
  10192. Correct luminance gamma by a factor of 0.5:
  10193. @example
  10194. lutyuv=y=gammaval(0.5)
  10195. @end example
  10196. @item
  10197. Discard least significant bits of luma:
  10198. @example
  10199. lutyuv=y='bitand(val, 128+64+32)'
  10200. @end example
  10201. @item
  10202. Technicolor like effect:
  10203. @example
  10204. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  10205. @end example
  10206. @end itemize
  10207. @section lut2, tlut2
  10208. The @code{lut2} filter takes two input streams and outputs one
  10209. stream.
  10210. The @code{tlut2} (time lut2) filter takes two consecutive frames
  10211. from one single stream.
  10212. This filter accepts the following parameters:
  10213. @table @option
  10214. @item c0
  10215. set first pixel component expression
  10216. @item c1
  10217. set second pixel component expression
  10218. @item c2
  10219. set third pixel component expression
  10220. @item c3
  10221. set fourth pixel component expression, corresponds to the alpha component
  10222. @item d
  10223. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10224. which means bit depth is automatically picked from first input format.
  10225. @end table
  10226. The @code{lut2} filter also supports the @ref{framesync} options.
  10227. Each of them specifies the expression to use for computing the lookup table for
  10228. the corresponding pixel component values.
  10229. The exact component associated to each of the @var{c*} options depends on the
  10230. format in inputs.
  10231. The expressions can contain the following constants:
  10232. @table @option
  10233. @item w
  10234. @item h
  10235. The input width and height.
  10236. @item x
  10237. The first input value for the pixel component.
  10238. @item y
  10239. The second input value for the pixel component.
  10240. @item bdx
  10241. The first input video bit depth.
  10242. @item bdy
  10243. The second input video bit depth.
  10244. @end table
  10245. All expressions default to "x".
  10246. @subsection Examples
  10247. @itemize
  10248. @item
  10249. Highlight differences between two RGB video streams:
  10250. @example
  10251. 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)'
  10252. @end example
  10253. @item
  10254. Highlight differences between two YUV video streams:
  10255. @example
  10256. 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)'
  10257. @end example
  10258. @item
  10259. Show max difference between two video streams:
  10260. @example
  10261. 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)))'
  10262. @end example
  10263. @end itemize
  10264. @section maskedclamp
  10265. Clamp the first input stream with the second input and third input stream.
  10266. Returns the value of first stream to be between second input
  10267. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10268. This filter accepts the following options:
  10269. @table @option
  10270. @item undershoot
  10271. Default value is @code{0}.
  10272. @item overshoot
  10273. Default value is @code{0}.
  10274. @item planes
  10275. Set which planes will be processed as bitmap, unprocessed planes will be
  10276. copied from first stream.
  10277. By default value 0xf, all planes will be processed.
  10278. @end table
  10279. @section maskedmax
  10280. Merge the second and third input stream into output stream using absolute differences
  10281. between second input stream and first input stream and absolute difference between
  10282. third input stream and first input stream. The picked value will be from second input
  10283. stream if second absolute difference is greater than first one or from third input stream
  10284. otherwise.
  10285. This filter accepts the following options:
  10286. @table @option
  10287. @item planes
  10288. Set which planes will be processed as bitmap, unprocessed planes will be
  10289. copied from first stream.
  10290. By default value 0xf, all planes will be processed.
  10291. @end table
  10292. @section maskedmerge
  10293. Merge the first input stream with the second input stream using per pixel
  10294. weights in the third input stream.
  10295. A value of 0 in the third stream pixel component means that pixel component
  10296. from first stream is returned unchanged, while maximum value (eg. 255 for
  10297. 8-bit videos) means that pixel component from second stream is returned
  10298. unchanged. Intermediate values define the amount of merging between both
  10299. input stream's pixel components.
  10300. This filter accepts the following options:
  10301. @table @option
  10302. @item planes
  10303. Set which planes will be processed as bitmap, unprocessed planes will be
  10304. copied from first stream.
  10305. By default value 0xf, all planes will be processed.
  10306. @end table
  10307. @section maskedmin
  10308. Merge the second and third input stream into output stream using absolute differences
  10309. between second input stream and first input stream and absolute difference between
  10310. third input stream and first input stream. The picked value will be from second input
  10311. stream if second absolute difference is less than first one or from third input stream
  10312. otherwise.
  10313. This filter accepts the following options:
  10314. @table @option
  10315. @item planes
  10316. Set which planes will be processed as bitmap, unprocessed planes will be
  10317. copied from first stream.
  10318. By default value 0xf, all planes will be processed.
  10319. @end table
  10320. @section maskedthreshold
  10321. Pick pixels comparing absolute difference of two video streams with fixed
  10322. threshold.
  10323. If absolute difference between pixel component of first and second video
  10324. stream is equal or lower than user supplied threshold than pixel component
  10325. from first video stream is picked, otherwise pixel component from second
  10326. video stream is picked.
  10327. This filter accepts the following options:
  10328. @table @option
  10329. @item threshold
  10330. Set threshold used when picking pixels from absolute difference from two input
  10331. video streams.
  10332. @item planes
  10333. Set which planes will be processed as bitmap, unprocessed planes will be
  10334. copied from second stream.
  10335. By default value 0xf, all planes will be processed.
  10336. @end table
  10337. @section maskfun
  10338. Create mask from input video.
  10339. For example it is useful to create motion masks after @code{tblend} filter.
  10340. This filter accepts the following options:
  10341. @table @option
  10342. @item low
  10343. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10344. @item high
  10345. Set high threshold. Any pixel component higher than this value will be set to max value
  10346. allowed for current pixel format.
  10347. @item planes
  10348. Set planes to filter, by default all available planes are filtered.
  10349. @item fill
  10350. Fill all frame pixels with this value.
  10351. @item sum
  10352. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10353. average, output frame will be completely filled with value set by @var{fill} option.
  10354. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10355. @end table
  10356. @section mcdeint
  10357. Apply motion-compensation deinterlacing.
  10358. It needs one field per frame as input and must thus be used together
  10359. with yadif=1/3 or equivalent.
  10360. This filter accepts the following options:
  10361. @table @option
  10362. @item mode
  10363. Set the deinterlacing mode.
  10364. It accepts one of the following values:
  10365. @table @samp
  10366. @item fast
  10367. @item medium
  10368. @item slow
  10369. use iterative motion estimation
  10370. @item extra_slow
  10371. like @samp{slow}, but use multiple reference frames.
  10372. @end table
  10373. Default value is @samp{fast}.
  10374. @item parity
  10375. Set the picture field parity assumed for the input video. It must be
  10376. one of the following values:
  10377. @table @samp
  10378. @item 0, tff
  10379. assume top field first
  10380. @item 1, bff
  10381. assume bottom field first
  10382. @end table
  10383. Default value is @samp{bff}.
  10384. @item qp
  10385. Set per-block quantization parameter (QP) used by the internal
  10386. encoder.
  10387. Higher values should result in a smoother motion vector field but less
  10388. optimal individual vectors. Default value is 1.
  10389. @end table
  10390. @section median
  10391. Pick median pixel from certain rectangle defined by radius.
  10392. This filter accepts the following options:
  10393. @table @option
  10394. @item radius
  10395. Set horizontal radius size. Default value is @code{1}.
  10396. Allowed range is integer from 1 to 127.
  10397. @item planes
  10398. Set which planes to process. Default is @code{15}, which is all available planes.
  10399. @item radiusV
  10400. Set vertical radius size. Default value is @code{0}.
  10401. Allowed range is integer from 0 to 127.
  10402. If it is 0, value will be picked from horizontal @code{radius} option.
  10403. @item percentile
  10404. Set median percentile. Default value is @code{0.5}.
  10405. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  10406. minimum values, and @code{1} maximum values.
  10407. @end table
  10408. @subsection Commands
  10409. This filter supports same @ref{commands} as options.
  10410. The command accepts the same syntax of the corresponding option.
  10411. If the specified expression is not valid, it is kept at its current
  10412. value.
  10413. @section mergeplanes
  10414. Merge color channel components from several video streams.
  10415. The filter accepts up to 4 input streams, and merge selected input
  10416. planes to the output video.
  10417. This filter accepts the following options:
  10418. @table @option
  10419. @item mapping
  10420. Set input to output plane mapping. Default is @code{0}.
  10421. The mappings is specified as a bitmap. It should be specified as a
  10422. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10423. mapping for the first plane of the output stream. 'A' sets the number of
  10424. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10425. corresponding input to use (from 0 to 3). The rest of the mappings is
  10426. similar, 'Bb' describes the mapping for the output stream second
  10427. plane, 'Cc' describes the mapping for the output stream third plane and
  10428. 'Dd' describes the mapping for the output stream fourth plane.
  10429. @item format
  10430. Set output pixel format. Default is @code{yuva444p}.
  10431. @end table
  10432. @subsection Examples
  10433. @itemize
  10434. @item
  10435. Merge three gray video streams of same width and height into single video stream:
  10436. @example
  10437. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10438. @end example
  10439. @item
  10440. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10441. @example
  10442. [a0][a1]mergeplanes=0x00010210:yuva444p
  10443. @end example
  10444. @item
  10445. Swap Y and A plane in yuva444p stream:
  10446. @example
  10447. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10448. @end example
  10449. @item
  10450. Swap U and V plane in yuv420p stream:
  10451. @example
  10452. format=yuv420p,mergeplanes=0x000201:yuv420p
  10453. @end example
  10454. @item
  10455. Cast a rgb24 clip to yuv444p:
  10456. @example
  10457. format=rgb24,mergeplanes=0x000102:yuv444p
  10458. @end example
  10459. @end itemize
  10460. @section mestimate
  10461. Estimate and export motion vectors using block matching algorithms.
  10462. Motion vectors are stored in frame side data to be used by other filters.
  10463. This filter accepts the following options:
  10464. @table @option
  10465. @item method
  10466. Specify the motion estimation method. Accepts one of the following values:
  10467. @table @samp
  10468. @item esa
  10469. Exhaustive search algorithm.
  10470. @item tss
  10471. Three step search algorithm.
  10472. @item tdls
  10473. Two dimensional logarithmic search algorithm.
  10474. @item ntss
  10475. New three step search algorithm.
  10476. @item fss
  10477. Four step search algorithm.
  10478. @item ds
  10479. Diamond search algorithm.
  10480. @item hexbs
  10481. Hexagon-based search algorithm.
  10482. @item epzs
  10483. Enhanced predictive zonal search algorithm.
  10484. @item umh
  10485. Uneven multi-hexagon search algorithm.
  10486. @end table
  10487. Default value is @samp{esa}.
  10488. @item mb_size
  10489. Macroblock size. Default @code{16}.
  10490. @item search_param
  10491. Search parameter. Default @code{7}.
  10492. @end table
  10493. @section midequalizer
  10494. Apply Midway Image Equalization effect using two video streams.
  10495. Midway Image Equalization adjusts a pair of images to have the same
  10496. histogram, while maintaining their dynamics as much as possible. It's
  10497. useful for e.g. matching exposures from a pair of stereo cameras.
  10498. This filter has two inputs and one output, which must be of same pixel format, but
  10499. may be of different sizes. The output of filter is first input adjusted with
  10500. midway histogram of both inputs.
  10501. This filter accepts the following option:
  10502. @table @option
  10503. @item planes
  10504. Set which planes to process. Default is @code{15}, which is all available planes.
  10505. @end table
  10506. @section minterpolate
  10507. Convert the video to specified frame rate using motion interpolation.
  10508. This filter accepts the following options:
  10509. @table @option
  10510. @item fps
  10511. 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}.
  10512. @item mi_mode
  10513. Motion interpolation mode. Following values are accepted:
  10514. @table @samp
  10515. @item dup
  10516. Duplicate previous or next frame for interpolating new ones.
  10517. @item blend
  10518. Blend source frames. Interpolated frame is mean of previous and next frames.
  10519. @item mci
  10520. Motion compensated interpolation. Following options are effective when this mode is selected:
  10521. @table @samp
  10522. @item mc_mode
  10523. Motion compensation mode. Following values are accepted:
  10524. @table @samp
  10525. @item obmc
  10526. Overlapped block motion compensation.
  10527. @item aobmc
  10528. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10529. @end table
  10530. Default mode is @samp{obmc}.
  10531. @item me_mode
  10532. Motion estimation mode. Following values are accepted:
  10533. @table @samp
  10534. @item bidir
  10535. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10536. @item bilat
  10537. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10538. @end table
  10539. Default mode is @samp{bilat}.
  10540. @item me
  10541. The algorithm to be used for motion estimation. Following values are accepted:
  10542. @table @samp
  10543. @item esa
  10544. Exhaustive search algorithm.
  10545. @item tss
  10546. Three step search algorithm.
  10547. @item tdls
  10548. Two dimensional logarithmic search algorithm.
  10549. @item ntss
  10550. New three step search algorithm.
  10551. @item fss
  10552. Four step search algorithm.
  10553. @item ds
  10554. Diamond search algorithm.
  10555. @item hexbs
  10556. Hexagon-based search algorithm.
  10557. @item epzs
  10558. Enhanced predictive zonal search algorithm.
  10559. @item umh
  10560. Uneven multi-hexagon search algorithm.
  10561. @end table
  10562. Default algorithm is @samp{epzs}.
  10563. @item mb_size
  10564. Macroblock size. Default @code{16}.
  10565. @item search_param
  10566. Motion estimation search parameter. Default @code{32}.
  10567. @item vsbmc
  10568. 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).
  10569. @end table
  10570. @end table
  10571. @item scd
  10572. 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:
  10573. @table @samp
  10574. @item none
  10575. Disable scene change detection.
  10576. @item fdiff
  10577. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10578. @end table
  10579. Default method is @samp{fdiff}.
  10580. @item scd_threshold
  10581. Scene change detection threshold. Default is @code{10.}.
  10582. @end table
  10583. @section mix
  10584. Mix several video input streams into one video stream.
  10585. A description of the accepted options follows.
  10586. @table @option
  10587. @item nb_inputs
  10588. The number of inputs. If unspecified, it defaults to 2.
  10589. @item weights
  10590. Specify weight of each input video stream as sequence.
  10591. Each weight is separated by space. If number of weights
  10592. is smaller than number of @var{frames} last specified
  10593. weight will be used for all remaining unset weights.
  10594. @item scale
  10595. Specify scale, if it is set it will be multiplied with sum
  10596. of each weight multiplied with pixel values to give final destination
  10597. pixel value. By default @var{scale} is auto scaled to sum of weights.
  10598. @item duration
  10599. Specify how end of stream is determined.
  10600. @table @samp
  10601. @item longest
  10602. The duration of the longest input. (default)
  10603. @item shortest
  10604. The duration of the shortest input.
  10605. @item first
  10606. The duration of the first input.
  10607. @end table
  10608. @end table
  10609. @section mpdecimate
  10610. Drop frames that do not differ greatly from the previous frame in
  10611. order to reduce frame rate.
  10612. The main use of this filter is for very-low-bitrate encoding
  10613. (e.g. streaming over dialup modem), but it could in theory be used for
  10614. fixing movies that were inverse-telecined incorrectly.
  10615. A description of the accepted options follows.
  10616. @table @option
  10617. @item max
  10618. Set the maximum number of consecutive frames which can be dropped (if
  10619. positive), or the minimum interval between dropped frames (if
  10620. negative). If the value is 0, the frame is dropped disregarding the
  10621. number of previous sequentially dropped frames.
  10622. Default value is 0.
  10623. @item hi
  10624. @item lo
  10625. @item frac
  10626. Set the dropping threshold values.
  10627. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10628. represent actual pixel value differences, so a threshold of 64
  10629. corresponds to 1 unit of difference for each pixel, or the same spread
  10630. out differently over the block.
  10631. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10632. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10633. meaning the whole image) differ by more than a threshold of @option{lo}.
  10634. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10635. 64*5, and default value for @option{frac} is 0.33.
  10636. @end table
  10637. @section negate
  10638. Negate (invert) the input video.
  10639. It accepts the following option:
  10640. @table @option
  10641. @item negate_alpha
  10642. With value 1, it negates the alpha component, if present. Default value is 0.
  10643. @end table
  10644. @anchor{nlmeans}
  10645. @section nlmeans
  10646. Denoise frames using Non-Local Means algorithm.
  10647. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10648. context similarity is defined by comparing their surrounding patches of size
  10649. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10650. around the pixel.
  10651. Note that the research area defines centers for patches, which means some
  10652. patches will be made of pixels outside that research area.
  10653. The filter accepts the following options.
  10654. @table @option
  10655. @item s
  10656. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10657. @item p
  10658. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10659. @item pc
  10660. Same as @option{p} but for chroma planes.
  10661. The default value is @var{0} and means automatic.
  10662. @item r
  10663. Set research size. Default is 15. Must be odd number in range [0, 99].
  10664. @item rc
  10665. Same as @option{r} but for chroma planes.
  10666. The default value is @var{0} and means automatic.
  10667. @end table
  10668. @section nnedi
  10669. Deinterlace video using neural network edge directed interpolation.
  10670. This filter accepts the following options:
  10671. @table @option
  10672. @item weights
  10673. Mandatory option, without binary file filter can not work.
  10674. Currently file can be found here:
  10675. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10676. @item deint
  10677. Set which frames to deinterlace, by default it is @code{all}.
  10678. Can be @code{all} or @code{interlaced}.
  10679. @item field
  10680. Set mode of operation.
  10681. Can be one of the following:
  10682. @table @samp
  10683. @item af
  10684. Use frame flags, both fields.
  10685. @item a
  10686. Use frame flags, single field.
  10687. @item t
  10688. Use top field only.
  10689. @item b
  10690. Use bottom field only.
  10691. @item tf
  10692. Use both fields, top first.
  10693. @item bf
  10694. Use both fields, bottom first.
  10695. @end table
  10696. @item planes
  10697. Set which planes to process, by default filter process all frames.
  10698. @item nsize
  10699. Set size of local neighborhood around each pixel, used by the predictor neural
  10700. network.
  10701. Can be one of the following:
  10702. @table @samp
  10703. @item s8x6
  10704. @item s16x6
  10705. @item s32x6
  10706. @item s48x6
  10707. @item s8x4
  10708. @item s16x4
  10709. @item s32x4
  10710. @end table
  10711. @item nns
  10712. Set the number of neurons in predictor neural network.
  10713. Can be one of the following:
  10714. @table @samp
  10715. @item n16
  10716. @item n32
  10717. @item n64
  10718. @item n128
  10719. @item n256
  10720. @end table
  10721. @item qual
  10722. Controls the number of different neural network predictions that are blended
  10723. together to compute the final output value. Can be @code{fast}, default or
  10724. @code{slow}.
  10725. @item etype
  10726. Set which set of weights to use in the predictor.
  10727. Can be one of the following:
  10728. @table @samp
  10729. @item a
  10730. weights trained to minimize absolute error
  10731. @item s
  10732. weights trained to minimize squared error
  10733. @end table
  10734. @item pscrn
  10735. Controls whether or not the prescreener neural network is used to decide
  10736. which pixels should be processed by the predictor neural network and which
  10737. can be handled by simple cubic interpolation.
  10738. The prescreener is trained to know whether cubic interpolation will be
  10739. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10740. The computational complexity of the prescreener nn is much less than that of
  10741. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10742. using the prescreener generally results in much faster processing.
  10743. The prescreener is pretty accurate, so the difference between using it and not
  10744. using it is almost always unnoticeable.
  10745. Can be one of the following:
  10746. @table @samp
  10747. @item none
  10748. @item original
  10749. @item new
  10750. @end table
  10751. Default is @code{new}.
  10752. @item fapprox
  10753. Set various debugging flags.
  10754. @end table
  10755. @section noformat
  10756. Force libavfilter not to use any of the specified pixel formats for the
  10757. input to the next filter.
  10758. It accepts the following parameters:
  10759. @table @option
  10760. @item pix_fmts
  10761. A '|'-separated list of pixel format names, such as
  10762. pix_fmts=yuv420p|monow|rgb24".
  10763. @end table
  10764. @subsection Examples
  10765. @itemize
  10766. @item
  10767. Force libavfilter to use a format different from @var{yuv420p} for the
  10768. input to the vflip filter:
  10769. @example
  10770. noformat=pix_fmts=yuv420p,vflip
  10771. @end example
  10772. @item
  10773. Convert the input video to any of the formats not contained in the list:
  10774. @example
  10775. noformat=yuv420p|yuv444p|yuv410p
  10776. @end example
  10777. @end itemize
  10778. @section noise
  10779. Add noise on video input frame.
  10780. The filter accepts the following options:
  10781. @table @option
  10782. @item all_seed
  10783. @item c0_seed
  10784. @item c1_seed
  10785. @item c2_seed
  10786. @item c3_seed
  10787. Set noise seed for specific pixel component or all pixel components in case
  10788. of @var{all_seed}. Default value is @code{123457}.
  10789. @item all_strength, alls
  10790. @item c0_strength, c0s
  10791. @item c1_strength, c1s
  10792. @item c2_strength, c2s
  10793. @item c3_strength, c3s
  10794. Set noise strength for specific pixel component or all pixel components in case
  10795. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10796. @item all_flags, allf
  10797. @item c0_flags, c0f
  10798. @item c1_flags, c1f
  10799. @item c2_flags, c2f
  10800. @item c3_flags, c3f
  10801. Set pixel component flags or set flags for all components if @var{all_flags}.
  10802. Available values for component flags are:
  10803. @table @samp
  10804. @item a
  10805. averaged temporal noise (smoother)
  10806. @item p
  10807. mix random noise with a (semi)regular pattern
  10808. @item t
  10809. temporal noise (noise pattern changes between frames)
  10810. @item u
  10811. uniform noise (gaussian otherwise)
  10812. @end table
  10813. @end table
  10814. @subsection Examples
  10815. Add temporal and uniform noise to input video:
  10816. @example
  10817. noise=alls=20:allf=t+u
  10818. @end example
  10819. @section normalize
  10820. Normalize RGB video (aka histogram stretching, contrast stretching).
  10821. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10822. For each channel of each frame, the filter computes the input range and maps
  10823. it linearly to the user-specified output range. The output range defaults
  10824. to the full dynamic range from pure black to pure white.
  10825. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10826. changes in brightness) caused when small dark or bright objects enter or leave
  10827. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10828. video camera, and, like a video camera, it may cause a period of over- or
  10829. under-exposure of the video.
  10830. The R,G,B channels can be normalized independently, which may cause some
  10831. color shifting, or linked together as a single channel, which prevents
  10832. color shifting. Linked normalization preserves hue. Independent normalization
  10833. does not, so it can be used to remove some color casts. Independent and linked
  10834. normalization can be combined in any ratio.
  10835. The normalize filter accepts the following options:
  10836. @table @option
  10837. @item blackpt
  10838. @item whitept
  10839. Colors which define the output range. The minimum input value is mapped to
  10840. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10841. The defaults are black and white respectively. Specifying white for
  10842. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10843. normalized video. Shades of grey can be used to reduce the dynamic range
  10844. (contrast). Specifying saturated colors here can create some interesting
  10845. effects.
  10846. @item smoothing
  10847. The number of previous frames to use for temporal smoothing. The input range
  10848. of each channel is smoothed using a rolling average over the current frame
  10849. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10850. smoothing).
  10851. @item independence
  10852. Controls the ratio of independent (color shifting) channel normalization to
  10853. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10854. independent. Defaults to 1.0 (fully independent).
  10855. @item strength
  10856. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10857. expensive no-op. Defaults to 1.0 (full strength).
  10858. @end table
  10859. @subsection Commands
  10860. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  10861. The command accepts the same syntax of the corresponding option.
  10862. If the specified expression is not valid, it is kept at its current
  10863. value.
  10864. @subsection Examples
  10865. Stretch video contrast to use the full dynamic range, with no temporal
  10866. smoothing; may flicker depending on the source content:
  10867. @example
  10868. normalize=blackpt=black:whitept=white:smoothing=0
  10869. @end example
  10870. As above, but with 50 frames of temporal smoothing; flicker should be
  10871. reduced, depending on the source content:
  10872. @example
  10873. normalize=blackpt=black:whitept=white:smoothing=50
  10874. @end example
  10875. As above, but with hue-preserving linked channel normalization:
  10876. @example
  10877. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10878. @end example
  10879. As above, but with half strength:
  10880. @example
  10881. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10882. @end example
  10883. Map the darkest input color to red, the brightest input color to cyan:
  10884. @example
  10885. normalize=blackpt=red:whitept=cyan
  10886. @end example
  10887. @section null
  10888. Pass the video source unchanged to the output.
  10889. @section ocr
  10890. Optical Character Recognition
  10891. This filter uses Tesseract for optical character recognition. To enable
  10892. compilation of this filter, you need to configure FFmpeg with
  10893. @code{--enable-libtesseract}.
  10894. It accepts the following options:
  10895. @table @option
  10896. @item datapath
  10897. Set datapath to tesseract data. Default is to use whatever was
  10898. set at installation.
  10899. @item language
  10900. Set language, default is "eng".
  10901. @item whitelist
  10902. Set character whitelist.
  10903. @item blacklist
  10904. Set character blacklist.
  10905. @end table
  10906. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10907. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10908. @section ocv
  10909. Apply a video transform using libopencv.
  10910. To enable this filter, install the libopencv library and headers and
  10911. configure FFmpeg with @code{--enable-libopencv}.
  10912. It accepts the following parameters:
  10913. @table @option
  10914. @item filter_name
  10915. The name of the libopencv filter to apply.
  10916. @item filter_params
  10917. The parameters to pass to the libopencv filter. If not specified, the default
  10918. values are assumed.
  10919. @end table
  10920. Refer to the official libopencv documentation for more precise
  10921. information:
  10922. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10923. Several libopencv filters are supported; see the following subsections.
  10924. @anchor{dilate}
  10925. @subsection dilate
  10926. Dilate an image by using a specific structuring element.
  10927. It corresponds to the libopencv function @code{cvDilate}.
  10928. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10929. @var{struct_el} represents a structuring element, and has the syntax:
  10930. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10931. @var{cols} and @var{rows} represent the number of columns and rows of
  10932. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10933. point, and @var{shape} the shape for the structuring element. @var{shape}
  10934. must be "rect", "cross", "ellipse", or "custom".
  10935. If the value for @var{shape} is "custom", it must be followed by a
  10936. string of the form "=@var{filename}". The file with name
  10937. @var{filename} is assumed to represent a binary image, with each
  10938. printable character corresponding to a bright pixel. When a custom
  10939. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10940. or columns and rows of the read file are assumed instead.
  10941. The default value for @var{struct_el} is "3x3+0x0/rect".
  10942. @var{nb_iterations} specifies the number of times the transform is
  10943. applied to the image, and defaults to 1.
  10944. Some examples:
  10945. @example
  10946. # Use the default values
  10947. ocv=dilate
  10948. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10949. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10950. # Read the shape from the file diamond.shape, iterating two times.
  10951. # The file diamond.shape may contain a pattern of characters like this
  10952. # *
  10953. # ***
  10954. # *****
  10955. # ***
  10956. # *
  10957. # The specified columns and rows are ignored
  10958. # but the anchor point coordinates are not
  10959. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10960. @end example
  10961. @subsection erode
  10962. Erode an image by using a specific structuring element.
  10963. It corresponds to the libopencv function @code{cvErode}.
  10964. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10965. with the same syntax and semantics as the @ref{dilate} filter.
  10966. @subsection smooth
  10967. Smooth the input video.
  10968. The filter takes the following parameters:
  10969. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10970. @var{type} is the type of smooth filter to apply, and must be one of
  10971. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10972. or "bilateral". The default value is "gaussian".
  10973. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10974. depends on the smooth type. @var{param1} and
  10975. @var{param2} accept integer positive values or 0. @var{param3} and
  10976. @var{param4} accept floating point values.
  10977. The default value for @var{param1} is 3. The default value for the
  10978. other parameters is 0.
  10979. These parameters correspond to the parameters assigned to the
  10980. libopencv function @code{cvSmooth}.
  10981. @section oscilloscope
  10982. 2D Video Oscilloscope.
  10983. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10984. It accepts the following parameters:
  10985. @table @option
  10986. @item x
  10987. Set scope center x position.
  10988. @item y
  10989. Set scope center y position.
  10990. @item s
  10991. Set scope size, relative to frame diagonal.
  10992. @item t
  10993. Set scope tilt/rotation.
  10994. @item o
  10995. Set trace opacity.
  10996. @item tx
  10997. Set trace center x position.
  10998. @item ty
  10999. Set trace center y position.
  11000. @item tw
  11001. Set trace width, relative to width of frame.
  11002. @item th
  11003. Set trace height, relative to height of frame.
  11004. @item c
  11005. Set which components to trace. By default it traces first three components.
  11006. @item g
  11007. Draw trace grid. By default is enabled.
  11008. @item st
  11009. Draw some statistics. By default is enabled.
  11010. @item sc
  11011. Draw scope. By default is enabled.
  11012. @end table
  11013. @subsection Commands
  11014. This filter supports same @ref{commands} as options.
  11015. The command accepts the same syntax of the corresponding option.
  11016. If the specified expression is not valid, it is kept at its current
  11017. value.
  11018. @subsection Examples
  11019. @itemize
  11020. @item
  11021. Inspect full first row of video frame.
  11022. @example
  11023. oscilloscope=x=0.5:y=0:s=1
  11024. @end example
  11025. @item
  11026. Inspect full last row of video frame.
  11027. @example
  11028. oscilloscope=x=0.5:y=1:s=1
  11029. @end example
  11030. @item
  11031. Inspect full 5th line of video frame of height 1080.
  11032. @example
  11033. oscilloscope=x=0.5:y=5/1080:s=1
  11034. @end example
  11035. @item
  11036. Inspect full last column of video frame.
  11037. @example
  11038. oscilloscope=x=1:y=0.5:s=1:t=1
  11039. @end example
  11040. @end itemize
  11041. @anchor{overlay}
  11042. @section overlay
  11043. Overlay one video on top of another.
  11044. It takes two inputs and has one output. The first input is the "main"
  11045. video on which the second input is overlaid.
  11046. It accepts the following parameters:
  11047. A description of the accepted options follows.
  11048. @table @option
  11049. @item x
  11050. @item y
  11051. Set the expression for the x and y coordinates of the overlaid video
  11052. on the main video. Default value is "0" for both expressions. In case
  11053. the expression is invalid, it is set to a huge value (meaning that the
  11054. overlay will not be displayed within the output visible area).
  11055. @item eof_action
  11056. See @ref{framesync}.
  11057. @item eval
  11058. Set when the expressions for @option{x}, and @option{y} are evaluated.
  11059. It accepts the following values:
  11060. @table @samp
  11061. @item init
  11062. only evaluate expressions once during the filter initialization or
  11063. when a command is processed
  11064. @item frame
  11065. evaluate expressions for each incoming frame
  11066. @end table
  11067. Default value is @samp{frame}.
  11068. @item shortest
  11069. See @ref{framesync}.
  11070. @item format
  11071. Set the format for the output video.
  11072. It accepts the following values:
  11073. @table @samp
  11074. @item yuv420
  11075. force YUV420 output
  11076. @item yuv420p10
  11077. force YUV420p10 output
  11078. @item yuv422
  11079. force YUV422 output
  11080. @item yuv422p10
  11081. force YUV422p10 output
  11082. @item yuv444
  11083. force YUV444 output
  11084. @item rgb
  11085. force packed RGB output
  11086. @item gbrp
  11087. force planar RGB output
  11088. @item auto
  11089. automatically pick format
  11090. @end table
  11091. Default value is @samp{yuv420}.
  11092. @item repeatlast
  11093. See @ref{framesync}.
  11094. @item alpha
  11095. Set format of alpha of the overlaid video, it can be @var{straight} or
  11096. @var{premultiplied}. Default is @var{straight}.
  11097. @end table
  11098. The @option{x}, and @option{y} expressions can contain the following
  11099. parameters.
  11100. @table @option
  11101. @item main_w, W
  11102. @item main_h, H
  11103. The main input width and height.
  11104. @item overlay_w, w
  11105. @item overlay_h, h
  11106. The overlay input width and height.
  11107. @item x
  11108. @item y
  11109. The computed values for @var{x} and @var{y}. They are evaluated for
  11110. each new frame.
  11111. @item hsub
  11112. @item vsub
  11113. horizontal and vertical chroma subsample values of the output
  11114. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  11115. @var{vsub} is 1.
  11116. @item n
  11117. the number of input frame, starting from 0
  11118. @item pos
  11119. the position in the file of the input frame, NAN if unknown
  11120. @item t
  11121. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  11122. @end table
  11123. This filter also supports the @ref{framesync} options.
  11124. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  11125. when evaluation is done @emph{per frame}, and will evaluate to NAN
  11126. when @option{eval} is set to @samp{init}.
  11127. Be aware that frames are taken from each input video in timestamp
  11128. order, hence, if their initial timestamps differ, it is a good idea
  11129. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  11130. have them begin in the same zero timestamp, as the example for
  11131. the @var{movie} filter does.
  11132. You can chain together more overlays but you should test the
  11133. efficiency of such approach.
  11134. @subsection Commands
  11135. This filter supports the following commands:
  11136. @table @option
  11137. @item x
  11138. @item y
  11139. Modify the x and y of the overlay input.
  11140. The command accepts the same syntax of the corresponding option.
  11141. If the specified expression is not valid, it is kept at its current
  11142. value.
  11143. @end table
  11144. @subsection Examples
  11145. @itemize
  11146. @item
  11147. Draw the overlay at 10 pixels from the bottom right corner of the main
  11148. video:
  11149. @example
  11150. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  11151. @end example
  11152. Using named options the example above becomes:
  11153. @example
  11154. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  11155. @end example
  11156. @item
  11157. Insert a transparent PNG logo in the bottom left corner of the input,
  11158. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  11159. @example
  11160. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  11161. @end example
  11162. @item
  11163. Insert 2 different transparent PNG logos (second logo on bottom
  11164. right corner) using the @command{ffmpeg} tool:
  11165. @example
  11166. 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
  11167. @end example
  11168. @item
  11169. Add a transparent color layer on top of the main video; @code{WxH}
  11170. must specify the size of the main input to the overlay filter:
  11171. @example
  11172. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  11173. @end example
  11174. @item
  11175. Play an original video and a filtered version (here with the deshake
  11176. filter) side by side using the @command{ffplay} tool:
  11177. @example
  11178. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  11179. @end example
  11180. The above command is the same as:
  11181. @example
  11182. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  11183. @end example
  11184. @item
  11185. Make a sliding overlay appearing from the left to the right top part of the
  11186. screen starting since time 2:
  11187. @example
  11188. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  11189. @end example
  11190. @item
  11191. Compose output by putting two input videos side to side:
  11192. @example
  11193. ffmpeg -i left.avi -i right.avi -filter_complex "
  11194. nullsrc=size=200x100 [background];
  11195. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  11196. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  11197. [background][left] overlay=shortest=1 [background+left];
  11198. [background+left][right] overlay=shortest=1:x=100 [left+right]
  11199. "
  11200. @end example
  11201. @item
  11202. Mask 10-20 seconds of a video by applying the delogo filter to a section
  11203. @example
  11204. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  11205. -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]'
  11206. masked.avi
  11207. @end example
  11208. @item
  11209. Chain several overlays in cascade:
  11210. @example
  11211. nullsrc=s=200x200 [bg];
  11212. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  11213. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  11214. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  11215. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  11216. [in3] null, [mid2] overlay=100:100 [out0]
  11217. @end example
  11218. @end itemize
  11219. @anchor{overlay_cuda}
  11220. @section overlay_cuda
  11221. Overlay one video on top of another.
  11222. This is the CUDA cariant of the @ref{overlay} filter.
  11223. It only accepts CUDA frames. The underlying input pixel formats have to match.
  11224. It takes two inputs and has one output. The first input is the "main"
  11225. video on which the second input is overlaid.
  11226. It accepts the following parameters:
  11227. @table @option
  11228. @item x
  11229. @item y
  11230. Set the x and y coordinates of the overlaid video on the main video.
  11231. Default value is "0" for both expressions.
  11232. @item eof_action
  11233. See @ref{framesync}.
  11234. @item shortest
  11235. See @ref{framesync}.
  11236. @item repeatlast
  11237. See @ref{framesync}.
  11238. @end table
  11239. This filter also supports the @ref{framesync} options.
  11240. @section owdenoise
  11241. Apply Overcomplete Wavelet denoiser.
  11242. The filter accepts the following options:
  11243. @table @option
  11244. @item depth
  11245. Set depth.
  11246. Larger depth values will denoise lower frequency components more, but
  11247. slow down filtering.
  11248. Must be an int in the range 8-16, default is @code{8}.
  11249. @item luma_strength, ls
  11250. Set luma strength.
  11251. Must be a double value in the range 0-1000, default is @code{1.0}.
  11252. @item chroma_strength, cs
  11253. Set chroma strength.
  11254. Must be a double value in the range 0-1000, default is @code{1.0}.
  11255. @end table
  11256. @anchor{pad}
  11257. @section pad
  11258. Add paddings to the input image, and place the original input at the
  11259. provided @var{x}, @var{y} coordinates.
  11260. It accepts the following parameters:
  11261. @table @option
  11262. @item width, w
  11263. @item height, h
  11264. Specify an expression for the size of the output image with the
  11265. paddings added. If the value for @var{width} or @var{height} is 0, the
  11266. corresponding input size is used for the output.
  11267. The @var{width} expression can reference the value set by the
  11268. @var{height} expression, and vice versa.
  11269. The default value of @var{width} and @var{height} is 0.
  11270. @item x
  11271. @item y
  11272. Specify the offsets to place the input image at within the padded area,
  11273. with respect to the top/left border of the output image.
  11274. The @var{x} expression can reference the value set by the @var{y}
  11275. expression, and vice versa.
  11276. The default value of @var{x} and @var{y} is 0.
  11277. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  11278. so the input image is centered on the padded area.
  11279. @item color
  11280. Specify the color of the padded area. For the syntax of this option,
  11281. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11282. manual,ffmpeg-utils}.
  11283. The default value of @var{color} is "black".
  11284. @item eval
  11285. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  11286. It accepts the following values:
  11287. @table @samp
  11288. @item init
  11289. Only evaluate expressions once during the filter initialization or when
  11290. a command is processed.
  11291. @item frame
  11292. Evaluate expressions for each incoming frame.
  11293. @end table
  11294. Default value is @samp{init}.
  11295. @item aspect
  11296. Pad to aspect instead to a resolution.
  11297. @end table
  11298. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  11299. options are expressions containing the following constants:
  11300. @table @option
  11301. @item in_w
  11302. @item in_h
  11303. The input video width and height.
  11304. @item iw
  11305. @item ih
  11306. These are the same as @var{in_w} and @var{in_h}.
  11307. @item out_w
  11308. @item out_h
  11309. The output width and height (the size of the padded area), as
  11310. specified by the @var{width} and @var{height} expressions.
  11311. @item ow
  11312. @item oh
  11313. These are the same as @var{out_w} and @var{out_h}.
  11314. @item x
  11315. @item y
  11316. The x and y offsets as specified by the @var{x} and @var{y}
  11317. expressions, or NAN if not yet specified.
  11318. @item a
  11319. same as @var{iw} / @var{ih}
  11320. @item sar
  11321. input sample aspect ratio
  11322. @item dar
  11323. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  11324. @item hsub
  11325. @item vsub
  11326. The horizontal and vertical chroma subsample values. For example for the
  11327. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11328. @end table
  11329. @subsection Examples
  11330. @itemize
  11331. @item
  11332. Add paddings with the color "violet" to the input video. The output video
  11333. size is 640x480, and the top-left corner of the input video is placed at
  11334. column 0, row 40
  11335. @example
  11336. pad=640:480:0:40:violet
  11337. @end example
  11338. The example above is equivalent to the following command:
  11339. @example
  11340. pad=width=640:height=480:x=0:y=40:color=violet
  11341. @end example
  11342. @item
  11343. Pad the input to get an output with dimensions increased by 3/2,
  11344. and put the input video at the center of the padded area:
  11345. @example
  11346. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  11347. @end example
  11348. @item
  11349. Pad the input to get a squared output with size equal to the maximum
  11350. value between the input width and height, and put the input video at
  11351. the center of the padded area:
  11352. @example
  11353. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  11354. @end example
  11355. @item
  11356. Pad the input to get a final w/h ratio of 16:9:
  11357. @example
  11358. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  11359. @end example
  11360. @item
  11361. In case of anamorphic video, in order to set the output display aspect
  11362. correctly, it is necessary to use @var{sar} in the expression,
  11363. according to the relation:
  11364. @example
  11365. (ih * X / ih) * sar = output_dar
  11366. X = output_dar / sar
  11367. @end example
  11368. Thus the previous example needs to be modified to:
  11369. @example
  11370. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  11371. @end example
  11372. @item
  11373. Double the output size and put the input video in the bottom-right
  11374. corner of the output padded area:
  11375. @example
  11376. pad="2*iw:2*ih:ow-iw:oh-ih"
  11377. @end example
  11378. @end itemize
  11379. @anchor{palettegen}
  11380. @section palettegen
  11381. Generate one palette for a whole video stream.
  11382. It accepts the following options:
  11383. @table @option
  11384. @item max_colors
  11385. Set the maximum number of colors to quantize in the palette.
  11386. Note: the palette will still contain 256 colors; the unused palette entries
  11387. will be black.
  11388. @item reserve_transparent
  11389. Create a palette of 255 colors maximum and reserve the last one for
  11390. transparency. Reserving the transparency color is useful for GIF optimization.
  11391. If not set, the maximum of colors in the palette will be 256. You probably want
  11392. to disable this option for a standalone image.
  11393. Set by default.
  11394. @item transparency_color
  11395. Set the color that will be used as background for transparency.
  11396. @item stats_mode
  11397. Set statistics mode.
  11398. It accepts the following values:
  11399. @table @samp
  11400. @item full
  11401. Compute full frame histograms.
  11402. @item diff
  11403. Compute histograms only for the part that differs from previous frame. This
  11404. might be relevant to give more importance to the moving part of your input if
  11405. the background is static.
  11406. @item single
  11407. Compute new histogram for each frame.
  11408. @end table
  11409. Default value is @var{full}.
  11410. @end table
  11411. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11412. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11413. color quantization of the palette. This information is also visible at
  11414. @var{info} logging level.
  11415. @subsection Examples
  11416. @itemize
  11417. @item
  11418. Generate a representative palette of a given video using @command{ffmpeg}:
  11419. @example
  11420. ffmpeg -i input.mkv -vf palettegen palette.png
  11421. @end example
  11422. @end itemize
  11423. @section paletteuse
  11424. Use a palette to downsample an input video stream.
  11425. The filter takes two inputs: one video stream and a palette. The palette must
  11426. be a 256 pixels image.
  11427. It accepts the following options:
  11428. @table @option
  11429. @item dither
  11430. Select dithering mode. Available algorithms are:
  11431. @table @samp
  11432. @item bayer
  11433. Ordered 8x8 bayer dithering (deterministic)
  11434. @item heckbert
  11435. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11436. Note: this dithering is sometimes considered "wrong" and is included as a
  11437. reference.
  11438. @item floyd_steinberg
  11439. Floyd and Steingberg dithering (error diffusion)
  11440. @item sierra2
  11441. Frankie Sierra dithering v2 (error diffusion)
  11442. @item sierra2_4a
  11443. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11444. @end table
  11445. Default is @var{sierra2_4a}.
  11446. @item bayer_scale
  11447. When @var{bayer} dithering is selected, this option defines the scale of the
  11448. pattern (how much the crosshatch pattern is visible). A low value means more
  11449. visible pattern for less banding, and higher value means less visible pattern
  11450. at the cost of more banding.
  11451. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11452. @item diff_mode
  11453. If set, define the zone to process
  11454. @table @samp
  11455. @item rectangle
  11456. Only the changing rectangle will be reprocessed. This is similar to GIF
  11457. cropping/offsetting compression mechanism. This option can be useful for speed
  11458. if only a part of the image is changing, and has use cases such as limiting the
  11459. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11460. moving scene (it leads to more deterministic output if the scene doesn't change
  11461. much, and as a result less moving noise and better GIF compression).
  11462. @end table
  11463. Default is @var{none}.
  11464. @item new
  11465. Take new palette for each output frame.
  11466. @item alpha_threshold
  11467. Sets the alpha threshold for transparency. Alpha values above this threshold
  11468. will be treated as completely opaque, and values below this threshold will be
  11469. treated as completely transparent.
  11470. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11471. @end table
  11472. @subsection Examples
  11473. @itemize
  11474. @item
  11475. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11476. using @command{ffmpeg}:
  11477. @example
  11478. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11479. @end example
  11480. @end itemize
  11481. @section perspective
  11482. Correct perspective of video not recorded perpendicular to the screen.
  11483. A description of the accepted parameters follows.
  11484. @table @option
  11485. @item x0
  11486. @item y0
  11487. @item x1
  11488. @item y1
  11489. @item x2
  11490. @item y2
  11491. @item x3
  11492. @item y3
  11493. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11494. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11495. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11496. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11497. then the corners of the source will be sent to the specified coordinates.
  11498. The expressions can use the following variables:
  11499. @table @option
  11500. @item W
  11501. @item H
  11502. the width and height of video frame.
  11503. @item in
  11504. Input frame count.
  11505. @item on
  11506. Output frame count.
  11507. @end table
  11508. @item interpolation
  11509. Set interpolation for perspective correction.
  11510. It accepts the following values:
  11511. @table @samp
  11512. @item linear
  11513. @item cubic
  11514. @end table
  11515. Default value is @samp{linear}.
  11516. @item sense
  11517. Set interpretation of coordinate options.
  11518. It accepts the following values:
  11519. @table @samp
  11520. @item 0, source
  11521. Send point in the source specified by the given coordinates to
  11522. the corners of the destination.
  11523. @item 1, destination
  11524. Send the corners of the source to the point in the destination specified
  11525. by the given coordinates.
  11526. Default value is @samp{source}.
  11527. @end table
  11528. @item eval
  11529. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11530. It accepts the following values:
  11531. @table @samp
  11532. @item init
  11533. only evaluate expressions once during the filter initialization or
  11534. when a command is processed
  11535. @item frame
  11536. evaluate expressions for each incoming frame
  11537. @end table
  11538. Default value is @samp{init}.
  11539. @end table
  11540. @section phase
  11541. Delay interlaced video by one field time so that the field order changes.
  11542. The intended use is to fix PAL movies that have been captured with the
  11543. opposite field order to the film-to-video transfer.
  11544. A description of the accepted parameters follows.
  11545. @table @option
  11546. @item mode
  11547. Set phase mode.
  11548. It accepts the following values:
  11549. @table @samp
  11550. @item t
  11551. Capture field order top-first, transfer bottom-first.
  11552. Filter will delay the bottom field.
  11553. @item b
  11554. Capture field order bottom-first, transfer top-first.
  11555. Filter will delay the top field.
  11556. @item p
  11557. Capture and transfer with the same field order. This mode only exists
  11558. for the documentation of the other options to refer to, but if you
  11559. actually select it, the filter will faithfully do nothing.
  11560. @item a
  11561. Capture field order determined automatically by field flags, transfer
  11562. opposite.
  11563. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11564. basis using field flags. If no field information is available,
  11565. then this works just like @samp{u}.
  11566. @item u
  11567. Capture unknown or varying, transfer opposite.
  11568. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11569. analyzing the images and selecting the alternative that produces best
  11570. match between the fields.
  11571. @item T
  11572. Capture top-first, transfer unknown or varying.
  11573. Filter selects among @samp{t} and @samp{p} using image analysis.
  11574. @item B
  11575. Capture bottom-first, transfer unknown or varying.
  11576. Filter selects among @samp{b} and @samp{p} using image analysis.
  11577. @item A
  11578. Capture determined by field flags, transfer unknown or varying.
  11579. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11580. image analysis. If no field information is available, then this works just
  11581. like @samp{U}. This is the default mode.
  11582. @item U
  11583. Both capture and transfer unknown or varying.
  11584. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11585. @end table
  11586. @end table
  11587. @section photosensitivity
  11588. Reduce various flashes in video, so to help users with epilepsy.
  11589. It accepts the following options:
  11590. @table @option
  11591. @item frames, f
  11592. Set how many frames to use when filtering. Default is 30.
  11593. @item threshold, t
  11594. Set detection threshold factor. Default is 1.
  11595. Lower is stricter.
  11596. @item skip
  11597. Set how many pixels to skip when sampling frames. Default is 1.
  11598. Allowed range is from 1 to 1024.
  11599. @item bypass
  11600. Leave frames unchanged. Default is disabled.
  11601. @end table
  11602. @section pixdesctest
  11603. Pixel format descriptor test filter, mainly useful for internal
  11604. testing. The output video should be equal to the input video.
  11605. For example:
  11606. @example
  11607. format=monow, pixdesctest
  11608. @end example
  11609. can be used to test the monowhite pixel format descriptor definition.
  11610. @section pixscope
  11611. Display sample values of color channels. Mainly useful for checking color
  11612. and levels. Minimum supported resolution is 640x480.
  11613. The filters accept the following options:
  11614. @table @option
  11615. @item x
  11616. Set scope X position, relative offset on X axis.
  11617. @item y
  11618. Set scope Y position, relative offset on Y axis.
  11619. @item w
  11620. Set scope width.
  11621. @item h
  11622. Set scope height.
  11623. @item o
  11624. Set window opacity. This window also holds statistics about pixel area.
  11625. @item wx
  11626. Set window X position, relative offset on X axis.
  11627. @item wy
  11628. Set window Y position, relative offset on Y axis.
  11629. @end table
  11630. @section pp
  11631. Enable the specified chain of postprocessing subfilters using libpostproc. This
  11632. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  11633. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  11634. Each subfilter and some options have a short and a long name that can be used
  11635. interchangeably, i.e. dr/dering are the same.
  11636. The filters accept the following options:
  11637. @table @option
  11638. @item subfilters
  11639. Set postprocessing subfilters string.
  11640. @end table
  11641. All subfilters share common options to determine their scope:
  11642. @table @option
  11643. @item a/autoq
  11644. Honor the quality commands for this subfilter.
  11645. @item c/chrom
  11646. Do chrominance filtering, too (default).
  11647. @item y/nochrom
  11648. Do luminance filtering only (no chrominance).
  11649. @item n/noluma
  11650. Do chrominance filtering only (no luminance).
  11651. @end table
  11652. These options can be appended after the subfilter name, separated by a '|'.
  11653. Available subfilters are:
  11654. @table @option
  11655. @item hb/hdeblock[|difference[|flatness]]
  11656. Horizontal deblocking filter
  11657. @table @option
  11658. @item difference
  11659. Difference factor where higher values mean more deblocking (default: @code{32}).
  11660. @item flatness
  11661. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11662. @end table
  11663. @item vb/vdeblock[|difference[|flatness]]
  11664. Vertical deblocking filter
  11665. @table @option
  11666. @item difference
  11667. Difference factor where higher values mean more deblocking (default: @code{32}).
  11668. @item flatness
  11669. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11670. @end table
  11671. @item ha/hadeblock[|difference[|flatness]]
  11672. Accurate horizontal deblocking filter
  11673. @table @option
  11674. @item difference
  11675. Difference factor where higher values mean more deblocking (default: @code{32}).
  11676. @item flatness
  11677. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11678. @end table
  11679. @item va/vadeblock[|difference[|flatness]]
  11680. Accurate vertical deblocking filter
  11681. @table @option
  11682. @item difference
  11683. Difference factor where higher values mean more deblocking (default: @code{32}).
  11684. @item flatness
  11685. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11686. @end table
  11687. @end table
  11688. The horizontal and vertical deblocking filters share the difference and
  11689. flatness values so you cannot set different horizontal and vertical
  11690. thresholds.
  11691. @table @option
  11692. @item h1/x1hdeblock
  11693. Experimental horizontal deblocking filter
  11694. @item v1/x1vdeblock
  11695. Experimental vertical deblocking filter
  11696. @item dr/dering
  11697. Deringing filter
  11698. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  11699. @table @option
  11700. @item threshold1
  11701. larger -> stronger filtering
  11702. @item threshold2
  11703. larger -> stronger filtering
  11704. @item threshold3
  11705. larger -> stronger filtering
  11706. @end table
  11707. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  11708. @table @option
  11709. @item f/fullyrange
  11710. Stretch luminance to @code{0-255}.
  11711. @end table
  11712. @item lb/linblenddeint
  11713. Linear blend deinterlacing filter that deinterlaces the given block by
  11714. filtering all lines with a @code{(1 2 1)} filter.
  11715. @item li/linipoldeint
  11716. Linear interpolating deinterlacing filter that deinterlaces the given block by
  11717. linearly interpolating every second line.
  11718. @item ci/cubicipoldeint
  11719. Cubic interpolating deinterlacing filter deinterlaces the given block by
  11720. cubically interpolating every second line.
  11721. @item md/mediandeint
  11722. Median deinterlacing filter that deinterlaces the given block by applying a
  11723. median filter to every second line.
  11724. @item fd/ffmpegdeint
  11725. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  11726. second line with a @code{(-1 4 2 4 -1)} filter.
  11727. @item l5/lowpass5
  11728. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  11729. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  11730. @item fq/forceQuant[|quantizer]
  11731. Overrides the quantizer table from the input with the constant quantizer you
  11732. specify.
  11733. @table @option
  11734. @item quantizer
  11735. Quantizer to use
  11736. @end table
  11737. @item de/default
  11738. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  11739. @item fa/fast
  11740. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  11741. @item ac
  11742. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11743. @end table
  11744. @subsection Examples
  11745. @itemize
  11746. @item
  11747. Apply horizontal and vertical deblocking, deringing and automatic
  11748. brightness/contrast:
  11749. @example
  11750. pp=hb/vb/dr/al
  11751. @end example
  11752. @item
  11753. Apply default filters without brightness/contrast correction:
  11754. @example
  11755. pp=de/-al
  11756. @end example
  11757. @item
  11758. Apply default filters and temporal denoiser:
  11759. @example
  11760. pp=default/tmpnoise|1|2|3
  11761. @end example
  11762. @item
  11763. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11764. automatically depending on available CPU time:
  11765. @example
  11766. pp=hb|y/vb|a
  11767. @end example
  11768. @end itemize
  11769. @section pp7
  11770. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11771. similar to spp = 6 with 7 point DCT, where only the center sample is
  11772. used after IDCT.
  11773. The filter accepts the following options:
  11774. @table @option
  11775. @item qp
  11776. Force a constant quantization parameter. It accepts an integer in range
  11777. 0 to 63. If not set, the filter will use the QP from the video stream
  11778. (if available).
  11779. @item mode
  11780. Set thresholding mode. Available modes are:
  11781. @table @samp
  11782. @item hard
  11783. Set hard thresholding.
  11784. @item soft
  11785. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11786. @item medium
  11787. Set medium thresholding (good results, default).
  11788. @end table
  11789. @end table
  11790. @section premultiply
  11791. Apply alpha premultiply effect to input video stream using first plane
  11792. of second stream as alpha.
  11793. Both streams must have same dimensions and same pixel format.
  11794. The filter accepts the following option:
  11795. @table @option
  11796. @item planes
  11797. Set which planes will be processed, unprocessed planes will be copied.
  11798. By default value 0xf, all planes will be processed.
  11799. @item inplace
  11800. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11801. @end table
  11802. @section prewitt
  11803. Apply prewitt operator to input video stream.
  11804. The filter accepts the following option:
  11805. @table @option
  11806. @item planes
  11807. Set which planes will be processed, unprocessed planes will be copied.
  11808. By default value 0xf, all planes will be processed.
  11809. @item scale
  11810. Set value which will be multiplied with filtered result.
  11811. @item delta
  11812. Set value which will be added to filtered result.
  11813. @end table
  11814. @section pseudocolor
  11815. Alter frame colors in video with pseudocolors.
  11816. This filter accepts the following options:
  11817. @table @option
  11818. @item c0
  11819. set pixel first component expression
  11820. @item c1
  11821. set pixel second component expression
  11822. @item c2
  11823. set pixel third component expression
  11824. @item c3
  11825. set pixel fourth component expression, corresponds to the alpha component
  11826. @item i
  11827. set component to use as base for altering colors
  11828. @end table
  11829. Each of them specifies the expression to use for computing the lookup table for
  11830. the corresponding pixel component values.
  11831. The expressions can contain the following constants and functions:
  11832. @table @option
  11833. @item w
  11834. @item h
  11835. The input width and height.
  11836. @item val
  11837. The input value for the pixel component.
  11838. @item ymin, umin, vmin, amin
  11839. The minimum allowed component value.
  11840. @item ymax, umax, vmax, amax
  11841. The maximum allowed component value.
  11842. @end table
  11843. All expressions default to "val".
  11844. @subsection Examples
  11845. @itemize
  11846. @item
  11847. Change too high luma values to gradient:
  11848. @example
  11849. 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'"
  11850. @end example
  11851. @end itemize
  11852. @section psnr
  11853. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11854. Ratio) between two input videos.
  11855. This filter takes in input two input videos, the first input is
  11856. considered the "main" source and is passed unchanged to the
  11857. output. The second input is used as a "reference" video for computing
  11858. the PSNR.
  11859. Both video inputs must have the same resolution and pixel format for
  11860. this filter to work correctly. Also it assumes that both inputs
  11861. have the same number of frames, which are compared one by one.
  11862. The obtained average PSNR is printed through the logging system.
  11863. The filter stores the accumulated MSE (mean squared error) of each
  11864. frame, and at the end of the processing it is averaged across all frames
  11865. equally, and the following formula is applied to obtain the PSNR:
  11866. @example
  11867. PSNR = 10*log10(MAX^2/MSE)
  11868. @end example
  11869. Where MAX is the average of the maximum values of each component of the
  11870. image.
  11871. The description of the accepted parameters follows.
  11872. @table @option
  11873. @item stats_file, f
  11874. If specified the filter will use the named file to save the PSNR of
  11875. each individual frame. When filename equals "-" the data is sent to
  11876. standard output.
  11877. @item stats_version
  11878. Specifies which version of the stats file format to use. Details of
  11879. each format are written below.
  11880. Default value is 1.
  11881. @item stats_add_max
  11882. Determines whether the max value is output to the stats log.
  11883. Default value is 0.
  11884. Requires stats_version >= 2. If this is set and stats_version < 2,
  11885. the filter will return an error.
  11886. @end table
  11887. This filter also supports the @ref{framesync} options.
  11888. The file printed if @var{stats_file} is selected, contains a sequence of
  11889. key/value pairs of the form @var{key}:@var{value} for each compared
  11890. couple of frames.
  11891. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11892. the list of per-frame-pair stats, with key value pairs following the frame
  11893. format with the following parameters:
  11894. @table @option
  11895. @item psnr_log_version
  11896. The version of the log file format. Will match @var{stats_version}.
  11897. @item fields
  11898. A comma separated list of the per-frame-pair parameters included in
  11899. the log.
  11900. @end table
  11901. A description of each shown per-frame-pair parameter follows:
  11902. @table @option
  11903. @item n
  11904. sequential number of the input frame, starting from 1
  11905. @item mse_avg
  11906. Mean Square Error pixel-by-pixel average difference of the compared
  11907. frames, averaged over all the image components.
  11908. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11909. Mean Square Error pixel-by-pixel average difference of the compared
  11910. frames for the component specified by the suffix.
  11911. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11912. Peak Signal to Noise ratio of the compared frames for the component
  11913. specified by the suffix.
  11914. @item max_avg, max_y, max_u, max_v
  11915. Maximum allowed value for each channel, and average over all
  11916. channels.
  11917. @end table
  11918. @subsection Examples
  11919. @itemize
  11920. @item
  11921. For example:
  11922. @example
  11923. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11924. [main][ref] psnr="stats_file=stats.log" [out]
  11925. @end example
  11926. On this example the input file being processed is compared with the
  11927. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11928. is stored in @file{stats.log}.
  11929. @item
  11930. Another example with different containers:
  11931. @example
  11932. 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 -
  11933. @end example
  11934. @end itemize
  11935. @anchor{pullup}
  11936. @section pullup
  11937. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11938. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11939. content.
  11940. The pullup filter is designed to take advantage of future context in making
  11941. its decisions. This filter is stateless in the sense that it does not lock
  11942. onto a pattern to follow, but it instead looks forward to the following
  11943. fields in order to identify matches and rebuild progressive frames.
  11944. To produce content with an even framerate, insert the fps filter after
  11945. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11946. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11947. The filter accepts the following options:
  11948. @table @option
  11949. @item jl
  11950. @item jr
  11951. @item jt
  11952. @item jb
  11953. These options set the amount of "junk" to ignore at the left, right, top, and
  11954. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11955. while top and bottom are in units of 2 lines.
  11956. The default is 8 pixels on each side.
  11957. @item sb
  11958. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11959. filter generating an occasional mismatched frame, but it may also cause an
  11960. excessive number of frames to be dropped during high motion sequences.
  11961. Conversely, setting it to -1 will make filter match fields more easily.
  11962. This may help processing of video where there is slight blurring between
  11963. the fields, but may also cause there to be interlaced frames in the output.
  11964. Default value is @code{0}.
  11965. @item mp
  11966. Set the metric plane to use. It accepts the following values:
  11967. @table @samp
  11968. @item l
  11969. Use luma plane.
  11970. @item u
  11971. Use chroma blue plane.
  11972. @item v
  11973. Use chroma red plane.
  11974. @end table
  11975. This option may be set to use chroma plane instead of the default luma plane
  11976. for doing filter's computations. This may improve accuracy on very clean
  11977. source material, but more likely will decrease accuracy, especially if there
  11978. is chroma noise (rainbow effect) or any grayscale video.
  11979. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11980. load and make pullup usable in realtime on slow machines.
  11981. @end table
  11982. For best results (without duplicated frames in the output file) it is
  11983. necessary to change the output frame rate. For example, to inverse
  11984. telecine NTSC input:
  11985. @example
  11986. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11987. @end example
  11988. @section qp
  11989. Change video quantization parameters (QP).
  11990. The filter accepts the following option:
  11991. @table @option
  11992. @item qp
  11993. Set expression for quantization parameter.
  11994. @end table
  11995. The expression is evaluated through the eval API and can contain, among others,
  11996. the following constants:
  11997. @table @var
  11998. @item known
  11999. 1 if index is not 129, 0 otherwise.
  12000. @item qp
  12001. Sequential index starting from -129 to 128.
  12002. @end table
  12003. @subsection Examples
  12004. @itemize
  12005. @item
  12006. Some equation like:
  12007. @example
  12008. qp=2+2*sin(PI*qp)
  12009. @end example
  12010. @end itemize
  12011. @section random
  12012. Flush video frames from internal cache of frames into a random order.
  12013. No frame is discarded.
  12014. Inspired by @ref{frei0r} nervous filter.
  12015. @table @option
  12016. @item frames
  12017. Set size in number of frames of internal cache, in range from @code{2} to
  12018. @code{512}. Default is @code{30}.
  12019. @item seed
  12020. Set seed for random number generator, must be an integer included between
  12021. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12022. less than @code{0}, the filter will try to use a good random seed on a
  12023. best effort basis.
  12024. @end table
  12025. @section readeia608
  12026. Read closed captioning (EIA-608) information from the top lines of a video frame.
  12027. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  12028. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  12029. with EIA-608 data (starting from 0). A description of each metadata value follows:
  12030. @table @option
  12031. @item lavfi.readeia608.X.cc
  12032. The two bytes stored as EIA-608 data (printed in hexadecimal).
  12033. @item lavfi.readeia608.X.line
  12034. The number of the line on which the EIA-608 data was identified and read.
  12035. @end table
  12036. This filter accepts the following options:
  12037. @table @option
  12038. @item scan_min
  12039. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  12040. @item scan_max
  12041. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  12042. @item spw
  12043. Set the ratio of width reserved for sync code detection.
  12044. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  12045. @item chp
  12046. Enable checking the parity bit. In the event of a parity error, the filter will output
  12047. @code{0x00} for that character. Default is false.
  12048. @item lp
  12049. Lowpass lines prior to further processing. Default is enabled.
  12050. @end table
  12051. @subsection Examples
  12052. @itemize
  12053. @item
  12054. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  12055. @example
  12056. 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
  12057. @end example
  12058. @end itemize
  12059. @section readvitc
  12060. Read vertical interval timecode (VITC) information from the top lines of a
  12061. video frame.
  12062. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  12063. timecode value, if a valid timecode has been detected. Further metadata key
  12064. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  12065. timecode data has been found or not.
  12066. This filter accepts the following options:
  12067. @table @option
  12068. @item scan_max
  12069. Set the maximum number of lines to scan for VITC data. If the value is set to
  12070. @code{-1} the full video frame is scanned. Default is @code{45}.
  12071. @item thr_b
  12072. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  12073. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  12074. @item thr_w
  12075. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  12076. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  12077. @end table
  12078. @subsection Examples
  12079. @itemize
  12080. @item
  12081. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  12082. draw @code{--:--:--:--} as a placeholder:
  12083. @example
  12084. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  12085. @end example
  12086. @end itemize
  12087. @section remap
  12088. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  12089. Destination pixel at position (X, Y) will be picked from source (x, y) position
  12090. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  12091. value for pixel will be used for destination pixel.
  12092. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  12093. will have Xmap/Ymap video stream dimensions.
  12094. Xmap and Ymap input video streams are 16bit depth, single channel.
  12095. @table @option
  12096. @item format
  12097. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  12098. Default is @code{color}.
  12099. @item fill
  12100. Specify the color of the unmapped pixels. For the syntax of this option,
  12101. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12102. manual,ffmpeg-utils}. Default color is @code{black}.
  12103. @end table
  12104. @section removegrain
  12105. The removegrain filter is a spatial denoiser for progressive video.
  12106. @table @option
  12107. @item m0
  12108. Set mode for the first plane.
  12109. @item m1
  12110. Set mode for the second plane.
  12111. @item m2
  12112. Set mode for the third plane.
  12113. @item m3
  12114. Set mode for the fourth plane.
  12115. @end table
  12116. Range of mode is from 0 to 24. Description of each mode follows:
  12117. @table @var
  12118. @item 0
  12119. Leave input plane unchanged. Default.
  12120. @item 1
  12121. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  12122. @item 2
  12123. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  12124. @item 3
  12125. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  12126. @item 4
  12127. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  12128. This is equivalent to a median filter.
  12129. @item 5
  12130. Line-sensitive clipping giving the minimal change.
  12131. @item 6
  12132. Line-sensitive clipping, intermediate.
  12133. @item 7
  12134. Line-sensitive clipping, intermediate.
  12135. @item 8
  12136. Line-sensitive clipping, intermediate.
  12137. @item 9
  12138. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  12139. @item 10
  12140. Replaces the target pixel with the closest neighbour.
  12141. @item 11
  12142. [1 2 1] horizontal and vertical kernel blur.
  12143. @item 12
  12144. Same as mode 11.
  12145. @item 13
  12146. Bob mode, interpolates top field from the line where the neighbours
  12147. pixels are the closest.
  12148. @item 14
  12149. Bob mode, interpolates bottom field from the line where the neighbours
  12150. pixels are the closest.
  12151. @item 15
  12152. Bob mode, interpolates top field. Same as 13 but with a more complicated
  12153. interpolation formula.
  12154. @item 16
  12155. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  12156. interpolation formula.
  12157. @item 17
  12158. Clips the pixel with the minimum and maximum of respectively the maximum and
  12159. minimum of each pair of opposite neighbour pixels.
  12160. @item 18
  12161. Line-sensitive clipping using opposite neighbours whose greatest distance from
  12162. the current pixel is minimal.
  12163. @item 19
  12164. Replaces the pixel with the average of its 8 neighbours.
  12165. @item 20
  12166. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  12167. @item 21
  12168. Clips pixels using the averages of opposite neighbour.
  12169. @item 22
  12170. Same as mode 21 but simpler and faster.
  12171. @item 23
  12172. Small edge and halo removal, but reputed useless.
  12173. @item 24
  12174. Similar as 23.
  12175. @end table
  12176. @section removelogo
  12177. Suppress a TV station logo, using an image file to determine which
  12178. pixels comprise the logo. It works by filling in the pixels that
  12179. comprise the logo with neighboring pixels.
  12180. The filter accepts the following options:
  12181. @table @option
  12182. @item filename, f
  12183. Set the filter bitmap file, which can be any image format supported by
  12184. libavformat. The width and height of the image file must match those of the
  12185. video stream being processed.
  12186. @end table
  12187. Pixels in the provided bitmap image with a value of zero are not
  12188. considered part of the logo, non-zero pixels are considered part of
  12189. the logo. If you use white (255) for the logo and black (0) for the
  12190. rest, you will be safe. For making the filter bitmap, it is
  12191. recommended to take a screen capture of a black frame with the logo
  12192. visible, and then using a threshold filter followed by the erode
  12193. filter once or twice.
  12194. If needed, little splotches can be fixed manually. Remember that if
  12195. logo pixels are not covered, the filter quality will be much
  12196. reduced. Marking too many pixels as part of the logo does not hurt as
  12197. much, but it will increase the amount of blurring needed to cover over
  12198. the image and will destroy more information than necessary, and extra
  12199. pixels will slow things down on a large logo.
  12200. @section repeatfields
  12201. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  12202. fields based on its value.
  12203. @section reverse
  12204. Reverse a video clip.
  12205. Warning: This filter requires memory to buffer the entire clip, so trimming
  12206. is suggested.
  12207. @subsection Examples
  12208. @itemize
  12209. @item
  12210. Take the first 5 seconds of a clip, and reverse it.
  12211. @example
  12212. trim=end=5,reverse
  12213. @end example
  12214. @end itemize
  12215. @section rgbashift
  12216. Shift R/G/B/A pixels horizontally and/or vertically.
  12217. The filter accepts the following options:
  12218. @table @option
  12219. @item rh
  12220. Set amount to shift red horizontally.
  12221. @item rv
  12222. Set amount to shift red vertically.
  12223. @item gh
  12224. Set amount to shift green horizontally.
  12225. @item gv
  12226. Set amount to shift green vertically.
  12227. @item bh
  12228. Set amount to shift blue horizontally.
  12229. @item bv
  12230. Set amount to shift blue vertically.
  12231. @item ah
  12232. Set amount to shift alpha horizontally.
  12233. @item av
  12234. Set amount to shift alpha vertically.
  12235. @item edge
  12236. Set edge mode, can be @var{smear}, default, or @var{warp}.
  12237. @end table
  12238. @subsection Commands
  12239. This filter supports the all above options as @ref{commands}.
  12240. @section roberts
  12241. Apply roberts cross operator to input video stream.
  12242. The filter accepts the following option:
  12243. @table @option
  12244. @item planes
  12245. Set which planes will be processed, unprocessed planes will be copied.
  12246. By default value 0xf, all planes will be processed.
  12247. @item scale
  12248. Set value which will be multiplied with filtered result.
  12249. @item delta
  12250. Set value which will be added to filtered result.
  12251. @end table
  12252. @section rotate
  12253. Rotate video by an arbitrary angle expressed in radians.
  12254. The filter accepts the following options:
  12255. A description of the optional parameters follows.
  12256. @table @option
  12257. @item angle, a
  12258. Set an expression for the angle by which to rotate the input video
  12259. clockwise, expressed as a number of radians. A negative value will
  12260. result in a counter-clockwise rotation. By default it is set to "0".
  12261. This expression is evaluated for each frame.
  12262. @item out_w, ow
  12263. Set the output width expression, default value is "iw".
  12264. This expression is evaluated just once during configuration.
  12265. @item out_h, oh
  12266. Set the output height expression, default value is "ih".
  12267. This expression is evaluated just once during configuration.
  12268. @item bilinear
  12269. Enable bilinear interpolation if set to 1, a value of 0 disables
  12270. it. Default value is 1.
  12271. @item fillcolor, c
  12272. Set the color used to fill the output area not covered by the rotated
  12273. image. For the general syntax of this option, check the
  12274. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12275. If the special value "none" is selected then no
  12276. background is printed (useful for example if the background is never shown).
  12277. Default value is "black".
  12278. @end table
  12279. The expressions for the angle and the output size can contain the
  12280. following constants and functions:
  12281. @table @option
  12282. @item n
  12283. sequential number of the input frame, starting from 0. It is always NAN
  12284. before the first frame is filtered.
  12285. @item t
  12286. time in seconds of the input frame, it is set to 0 when the filter is
  12287. configured. It is always NAN before the first frame is filtered.
  12288. @item hsub
  12289. @item vsub
  12290. horizontal and vertical chroma subsample values. For example for the
  12291. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12292. @item in_w, iw
  12293. @item in_h, ih
  12294. the input video width and height
  12295. @item out_w, ow
  12296. @item out_h, oh
  12297. the output width and height, that is the size of the padded area as
  12298. specified by the @var{width} and @var{height} expressions
  12299. @item rotw(a)
  12300. @item roth(a)
  12301. the minimal width/height required for completely containing the input
  12302. video rotated by @var{a} radians.
  12303. These are only available when computing the @option{out_w} and
  12304. @option{out_h} expressions.
  12305. @end table
  12306. @subsection Examples
  12307. @itemize
  12308. @item
  12309. Rotate the input by PI/6 radians clockwise:
  12310. @example
  12311. rotate=PI/6
  12312. @end example
  12313. @item
  12314. Rotate the input by PI/6 radians counter-clockwise:
  12315. @example
  12316. rotate=-PI/6
  12317. @end example
  12318. @item
  12319. Rotate the input by 45 degrees clockwise:
  12320. @example
  12321. rotate=45*PI/180
  12322. @end example
  12323. @item
  12324. Apply a constant rotation with period T, starting from an angle of PI/3:
  12325. @example
  12326. rotate=PI/3+2*PI*t/T
  12327. @end example
  12328. @item
  12329. Make the input video rotation oscillating with a period of T
  12330. seconds and an amplitude of A radians:
  12331. @example
  12332. rotate=A*sin(2*PI/T*t)
  12333. @end example
  12334. @item
  12335. Rotate the video, output size is chosen so that the whole rotating
  12336. input video is always completely contained in the output:
  12337. @example
  12338. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12339. @end example
  12340. @item
  12341. Rotate the video, reduce the output size so that no background is ever
  12342. shown:
  12343. @example
  12344. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12345. @end example
  12346. @end itemize
  12347. @subsection Commands
  12348. The filter supports the following commands:
  12349. @table @option
  12350. @item a, angle
  12351. Set the angle expression.
  12352. The command accepts the same syntax of the corresponding option.
  12353. If the specified expression is not valid, it is kept at its current
  12354. value.
  12355. @end table
  12356. @section sab
  12357. Apply Shape Adaptive Blur.
  12358. The filter accepts the following options:
  12359. @table @option
  12360. @item luma_radius, lr
  12361. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12362. value is 1.0. A greater value will result in a more blurred image, and
  12363. in slower processing.
  12364. @item luma_pre_filter_radius, lpfr
  12365. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12366. value is 1.0.
  12367. @item luma_strength, ls
  12368. Set luma maximum difference between pixels to still be considered, must
  12369. be a value in the 0.1-100.0 range, default value is 1.0.
  12370. @item chroma_radius, cr
  12371. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12372. greater value will result in a more blurred image, and in slower
  12373. processing.
  12374. @item chroma_pre_filter_radius, cpfr
  12375. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12376. @item chroma_strength, cs
  12377. Set chroma maximum difference between pixels to still be considered,
  12378. must be a value in the -0.9-100.0 range.
  12379. @end table
  12380. Each chroma option value, if not explicitly specified, is set to the
  12381. corresponding luma option value.
  12382. @anchor{scale}
  12383. @section scale
  12384. Scale (resize) the input video, using the libswscale library.
  12385. The scale filter forces the output display aspect ratio to be the same
  12386. of the input, by changing the output sample aspect ratio.
  12387. If the input image format is different from the format requested by
  12388. the next filter, the scale filter will convert the input to the
  12389. requested format.
  12390. @subsection Options
  12391. The filter accepts the following options, or any of the options
  12392. supported by the libswscale scaler.
  12393. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12394. the complete list of scaler options.
  12395. @table @option
  12396. @item width, w
  12397. @item height, h
  12398. Set the output video dimension expression. Default value is the input
  12399. dimension.
  12400. If the @var{width} or @var{w} value is 0, the input width is used for
  12401. the output. If the @var{height} or @var{h} value is 0, the input height
  12402. is used for the output.
  12403. If one and only one of the values is -n with n >= 1, the scale filter
  12404. will use a value that maintains the aspect ratio of the input image,
  12405. calculated from the other specified dimension. After that it will,
  12406. however, make sure that the calculated dimension is divisible by n and
  12407. adjust the value if necessary.
  12408. If both values are -n with n >= 1, the behavior will be identical to
  12409. both values being set to 0 as previously detailed.
  12410. See below for the list of accepted constants for use in the dimension
  12411. expression.
  12412. @item eval
  12413. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12414. @table @samp
  12415. @item init
  12416. Only evaluate expressions once during the filter initialization or when a command is processed.
  12417. @item frame
  12418. Evaluate expressions for each incoming frame.
  12419. @end table
  12420. Default value is @samp{init}.
  12421. @item interl
  12422. Set the interlacing mode. It accepts the following values:
  12423. @table @samp
  12424. @item 1
  12425. Force interlaced aware scaling.
  12426. @item 0
  12427. Do not apply interlaced scaling.
  12428. @item -1
  12429. Select interlaced aware scaling depending on whether the source frames
  12430. are flagged as interlaced or not.
  12431. @end table
  12432. Default value is @samp{0}.
  12433. @item flags
  12434. Set libswscale scaling flags. See
  12435. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12436. complete list of values. If not explicitly specified the filter applies
  12437. the default flags.
  12438. @item param0, param1
  12439. Set libswscale input parameters for scaling algorithms that need them. See
  12440. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12441. complete documentation. If not explicitly specified the filter applies
  12442. empty parameters.
  12443. @item size, s
  12444. Set the video size. For the syntax of this option, check the
  12445. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12446. @item in_color_matrix
  12447. @item out_color_matrix
  12448. Set in/output YCbCr color space type.
  12449. This allows the autodetected value to be overridden as well as allows forcing
  12450. a specific value used for the output and encoder.
  12451. If not specified, the color space type depends on the pixel format.
  12452. Possible values:
  12453. @table @samp
  12454. @item auto
  12455. Choose automatically.
  12456. @item bt709
  12457. Format conforming to International Telecommunication Union (ITU)
  12458. Recommendation BT.709.
  12459. @item fcc
  12460. Set color space conforming to the United States Federal Communications
  12461. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12462. @item bt601
  12463. @item bt470
  12464. @item smpte170m
  12465. Set color space conforming to:
  12466. @itemize
  12467. @item
  12468. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12469. @item
  12470. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12471. @item
  12472. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12473. @end itemize
  12474. @item smpte240m
  12475. Set color space conforming to SMPTE ST 240:1999.
  12476. @item bt2020
  12477. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12478. @end table
  12479. @item in_range
  12480. @item out_range
  12481. Set in/output YCbCr sample range.
  12482. This allows the autodetected value to be overridden as well as allows forcing
  12483. a specific value used for the output and encoder. If not specified, the
  12484. range depends on the pixel format. Possible values:
  12485. @table @samp
  12486. @item auto/unknown
  12487. Choose automatically.
  12488. @item jpeg/full/pc
  12489. Set full range (0-255 in case of 8-bit luma).
  12490. @item mpeg/limited/tv
  12491. Set "MPEG" range (16-235 in case of 8-bit luma).
  12492. @end table
  12493. @item force_original_aspect_ratio
  12494. Enable decreasing or increasing output video width or height if necessary to
  12495. keep the original aspect ratio. Possible values:
  12496. @table @samp
  12497. @item disable
  12498. Scale the video as specified and disable this feature.
  12499. @item decrease
  12500. The output video dimensions will automatically be decreased if needed.
  12501. @item increase
  12502. The output video dimensions will automatically be increased if needed.
  12503. @end table
  12504. One useful instance of this option is that when you know a specific device's
  12505. maximum allowed resolution, you can use this to limit the output video to
  12506. that, while retaining the aspect ratio. For example, device A allows
  12507. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12508. decrease) and specifying 1280x720 to the command line makes the output
  12509. 1280x533.
  12510. Please note that this is a different thing than specifying -1 for @option{w}
  12511. or @option{h}, you still need to specify the output resolution for this option
  12512. to work.
  12513. @item force_divisible_by
  12514. Ensures that both the output dimensions, width and height, are divisible by the
  12515. given integer when used together with @option{force_original_aspect_ratio}. This
  12516. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12517. This option respects the value set for @option{force_original_aspect_ratio},
  12518. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12519. may be slightly modified.
  12520. This option can be handy if you need to have a video fit within or exceed
  12521. a defined resolution using @option{force_original_aspect_ratio} but also have
  12522. encoder restrictions on width or height divisibility.
  12523. @end table
  12524. The values of the @option{w} and @option{h} options are expressions
  12525. containing the following constants:
  12526. @table @var
  12527. @item in_w
  12528. @item in_h
  12529. The input width and height
  12530. @item iw
  12531. @item ih
  12532. These are the same as @var{in_w} and @var{in_h}.
  12533. @item out_w
  12534. @item out_h
  12535. The output (scaled) width and height
  12536. @item ow
  12537. @item oh
  12538. These are the same as @var{out_w} and @var{out_h}
  12539. @item a
  12540. The same as @var{iw} / @var{ih}
  12541. @item sar
  12542. input sample aspect ratio
  12543. @item dar
  12544. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12545. @item hsub
  12546. @item vsub
  12547. horizontal and vertical input chroma subsample values. For example for the
  12548. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12549. @item ohsub
  12550. @item ovsub
  12551. horizontal and vertical output chroma subsample values. For example for the
  12552. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12553. @item n
  12554. The (sequential) number of the input frame, starting from 0.
  12555. Only available with @code{eval=frame}.
  12556. @item t
  12557. The presentation timestamp of the input frame, expressed as a number of
  12558. seconds. Only available with @code{eval=frame}.
  12559. @item pos
  12560. The position (byte offset) of the frame in the input stream, or NaN if
  12561. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12562. Only available with @code{eval=frame}.
  12563. @end table
  12564. @subsection Examples
  12565. @itemize
  12566. @item
  12567. Scale the input video to a size of 200x100
  12568. @example
  12569. scale=w=200:h=100
  12570. @end example
  12571. This is equivalent to:
  12572. @example
  12573. scale=200:100
  12574. @end example
  12575. or:
  12576. @example
  12577. scale=200x100
  12578. @end example
  12579. @item
  12580. Specify a size abbreviation for the output size:
  12581. @example
  12582. scale=qcif
  12583. @end example
  12584. which can also be written as:
  12585. @example
  12586. scale=size=qcif
  12587. @end example
  12588. @item
  12589. Scale the input to 2x:
  12590. @example
  12591. scale=w=2*iw:h=2*ih
  12592. @end example
  12593. @item
  12594. The above is the same as:
  12595. @example
  12596. scale=2*in_w:2*in_h
  12597. @end example
  12598. @item
  12599. Scale the input to 2x with forced interlaced scaling:
  12600. @example
  12601. scale=2*iw:2*ih:interl=1
  12602. @end example
  12603. @item
  12604. Scale the input to half size:
  12605. @example
  12606. scale=w=iw/2:h=ih/2
  12607. @end example
  12608. @item
  12609. Increase the width, and set the height to the same size:
  12610. @example
  12611. scale=3/2*iw:ow
  12612. @end example
  12613. @item
  12614. Seek Greek harmony:
  12615. @example
  12616. scale=iw:1/PHI*iw
  12617. scale=ih*PHI:ih
  12618. @end example
  12619. @item
  12620. Increase the height, and set the width to 3/2 of the height:
  12621. @example
  12622. scale=w=3/2*oh:h=3/5*ih
  12623. @end example
  12624. @item
  12625. Increase the size, making the size a multiple of the chroma
  12626. subsample values:
  12627. @example
  12628. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12629. @end example
  12630. @item
  12631. Increase the width to a maximum of 500 pixels,
  12632. keeping the same aspect ratio as the input:
  12633. @example
  12634. scale=w='min(500\, iw*3/2):h=-1'
  12635. @end example
  12636. @item
  12637. Make pixels square by combining scale and setsar:
  12638. @example
  12639. scale='trunc(ih*dar):ih',setsar=1/1
  12640. @end example
  12641. @item
  12642. Make pixels square by combining scale and setsar,
  12643. making sure the resulting resolution is even (required by some codecs):
  12644. @example
  12645. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12646. @end example
  12647. @end itemize
  12648. @subsection Commands
  12649. This filter supports the following commands:
  12650. @table @option
  12651. @item width, w
  12652. @item height, h
  12653. Set the output video dimension expression.
  12654. The command accepts the same syntax of the corresponding option.
  12655. If the specified expression is not valid, it is kept at its current
  12656. value.
  12657. @end table
  12658. @section scale_npp
  12659. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12660. format conversion on CUDA video frames. Setting the output width and height
  12661. works in the same way as for the @var{scale} filter.
  12662. The following additional options are accepted:
  12663. @table @option
  12664. @item format
  12665. The pixel format of the output CUDA frames. If set to the string "same" (the
  12666. default), the input format will be kept. Note that automatic format negotiation
  12667. and conversion is not yet supported for hardware frames
  12668. @item interp_algo
  12669. The interpolation algorithm used for resizing. One of the following:
  12670. @table @option
  12671. @item nn
  12672. Nearest neighbour.
  12673. @item linear
  12674. @item cubic
  12675. @item cubic2p_bspline
  12676. 2-parameter cubic (B=1, C=0)
  12677. @item cubic2p_catmullrom
  12678. 2-parameter cubic (B=0, C=1/2)
  12679. @item cubic2p_b05c03
  12680. 2-parameter cubic (B=1/2, C=3/10)
  12681. @item super
  12682. Supersampling
  12683. @item lanczos
  12684. @end table
  12685. @item force_original_aspect_ratio
  12686. Enable decreasing or increasing output video width or height if necessary to
  12687. keep the original aspect ratio. Possible values:
  12688. @table @samp
  12689. @item disable
  12690. Scale the video as specified and disable this feature.
  12691. @item decrease
  12692. The output video dimensions will automatically be decreased if needed.
  12693. @item increase
  12694. The output video dimensions will automatically be increased if needed.
  12695. @end table
  12696. One useful instance of this option is that when you know a specific device's
  12697. maximum allowed resolution, you can use this to limit the output video to
  12698. that, while retaining the aspect ratio. For example, device A allows
  12699. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12700. decrease) and specifying 1280x720 to the command line makes the output
  12701. 1280x533.
  12702. Please note that this is a different thing than specifying -1 for @option{w}
  12703. or @option{h}, you still need to specify the output resolution for this option
  12704. to work.
  12705. @item force_divisible_by
  12706. Ensures that both the output dimensions, width and height, are divisible by the
  12707. given integer when used together with @option{force_original_aspect_ratio}. This
  12708. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12709. This option respects the value set for @option{force_original_aspect_ratio},
  12710. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12711. may be slightly modified.
  12712. This option can be handy if you need to have a video fit within or exceed
  12713. a defined resolution using @option{force_original_aspect_ratio} but also have
  12714. encoder restrictions on width or height divisibility.
  12715. @end table
  12716. @section scale2ref
  12717. Scale (resize) the input video, based on a reference video.
  12718. See the scale filter for available options, scale2ref supports the same but
  12719. uses the reference video instead of the main input as basis. scale2ref also
  12720. supports the following additional constants for the @option{w} and
  12721. @option{h} options:
  12722. @table @var
  12723. @item main_w
  12724. @item main_h
  12725. The main input video's width and height
  12726. @item main_a
  12727. The same as @var{main_w} / @var{main_h}
  12728. @item main_sar
  12729. The main input video's sample aspect ratio
  12730. @item main_dar, mdar
  12731. The main input video's display aspect ratio. Calculated from
  12732. @code{(main_w / main_h) * main_sar}.
  12733. @item main_hsub
  12734. @item main_vsub
  12735. The main input video's horizontal and vertical chroma subsample values.
  12736. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12737. is 1.
  12738. @item main_n
  12739. The (sequential) number of the main input frame, starting from 0.
  12740. Only available with @code{eval=frame}.
  12741. @item main_t
  12742. The presentation timestamp of the main input frame, expressed as a number of
  12743. seconds. Only available with @code{eval=frame}.
  12744. @item main_pos
  12745. The position (byte offset) of the frame in the main input stream, or NaN if
  12746. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12747. Only available with @code{eval=frame}.
  12748. @end table
  12749. @subsection Examples
  12750. @itemize
  12751. @item
  12752. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12753. @example
  12754. 'scale2ref[b][a];[a][b]overlay'
  12755. @end example
  12756. @item
  12757. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12758. @example
  12759. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12760. @end example
  12761. @end itemize
  12762. @subsection Commands
  12763. This filter supports the following commands:
  12764. @table @option
  12765. @item width, w
  12766. @item height, h
  12767. Set the output video dimension expression.
  12768. The command accepts the same syntax of the corresponding option.
  12769. If the specified expression is not valid, it is kept at its current
  12770. value.
  12771. @end table
  12772. @section scroll
  12773. Scroll input video horizontally and/or vertically by constant speed.
  12774. The filter accepts the following options:
  12775. @table @option
  12776. @item horizontal, h
  12777. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12778. Negative values changes scrolling direction.
  12779. @item vertical, v
  12780. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12781. Negative values changes scrolling direction.
  12782. @item hpos
  12783. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12784. @item vpos
  12785. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12786. @end table
  12787. @subsection Commands
  12788. This filter supports the following @ref{commands}:
  12789. @table @option
  12790. @item horizontal, h
  12791. Set the horizontal scrolling speed.
  12792. @item vertical, v
  12793. Set the vertical scrolling speed.
  12794. @end table
  12795. @anchor{scdet}
  12796. @section scdet
  12797. Detect video scene change.
  12798. This filter sets frame metadata with mafd between frame, the scene score, and
  12799. forward the frame to the next filter, so they can use these metadata to detect
  12800. scene change or others.
  12801. In addition, this filter logs a message and sets frame metadata when it detects
  12802. a scene change by @option{threshold}.
  12803. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  12804. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  12805. to detect scene change.
  12806. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  12807. detect scene change with @option{threshold}.
  12808. The filter accepts the following options:
  12809. @table @option
  12810. @item threshold, t
  12811. Set the scene change detection threshold as a percentage of maximum change. Good
  12812. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  12813. @code{[0., 100.]}.
  12814. Default value is @code{10.}.
  12815. @item sc_pass, s
  12816. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  12817. You can enable it if you want to get snapshot of scene change frames only.
  12818. @end table
  12819. @anchor{selectivecolor}
  12820. @section selectivecolor
  12821. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12822. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12823. by the "purity" of the color (that is, how saturated it already is).
  12824. This filter is similar to the Adobe Photoshop Selective Color tool.
  12825. The filter accepts the following options:
  12826. @table @option
  12827. @item correction_method
  12828. Select color correction method.
  12829. Available values are:
  12830. @table @samp
  12831. @item absolute
  12832. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12833. component value).
  12834. @item relative
  12835. Specified adjustments are relative to the original component value.
  12836. @end table
  12837. Default is @code{absolute}.
  12838. @item reds
  12839. Adjustments for red pixels (pixels where the red component is the maximum)
  12840. @item yellows
  12841. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12842. @item greens
  12843. Adjustments for green pixels (pixels where the green component is the maximum)
  12844. @item cyans
  12845. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12846. @item blues
  12847. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12848. @item magentas
  12849. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12850. @item whites
  12851. Adjustments for white pixels (pixels where all components are greater than 128)
  12852. @item neutrals
  12853. Adjustments for all pixels except pure black and pure white
  12854. @item blacks
  12855. Adjustments for black pixels (pixels where all components are lesser than 128)
  12856. @item psfile
  12857. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12858. @end table
  12859. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12860. 4 space separated floating point adjustment values in the [-1,1] range,
  12861. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12862. pixels of its range.
  12863. @subsection Examples
  12864. @itemize
  12865. @item
  12866. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12867. increase magenta by 27% in blue areas:
  12868. @example
  12869. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12870. @end example
  12871. @item
  12872. Use a Photoshop selective color preset:
  12873. @example
  12874. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12875. @end example
  12876. @end itemize
  12877. @anchor{separatefields}
  12878. @section separatefields
  12879. The @code{separatefields} takes a frame-based video input and splits
  12880. each frame into its components fields, producing a new half height clip
  12881. with twice the frame rate and twice the frame count.
  12882. This filter use field-dominance information in frame to decide which
  12883. of each pair of fields to place first in the output.
  12884. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12885. @section setdar, setsar
  12886. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12887. output video.
  12888. This is done by changing the specified Sample (aka Pixel) Aspect
  12889. Ratio, according to the following equation:
  12890. @example
  12891. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12892. @end example
  12893. Keep in mind that the @code{setdar} filter does not modify the pixel
  12894. dimensions of the video frame. Also, the display aspect ratio set by
  12895. this filter may be changed by later filters in the filterchain,
  12896. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12897. applied.
  12898. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12899. the filter output video.
  12900. Note that as a consequence of the application of this filter, the
  12901. output display aspect ratio will change according to the equation
  12902. above.
  12903. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12904. filter may be changed by later filters in the filterchain, e.g. if
  12905. another "setsar" or a "setdar" filter is applied.
  12906. It accepts the following parameters:
  12907. @table @option
  12908. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12909. Set the aspect ratio used by the filter.
  12910. The parameter can be a floating point number string, an expression, or
  12911. a string of the form @var{num}:@var{den}, where @var{num} and
  12912. @var{den} are the numerator and denominator of the aspect ratio. If
  12913. the parameter is not specified, it is assumed the value "0".
  12914. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12915. should be escaped.
  12916. @item max
  12917. Set the maximum integer value to use for expressing numerator and
  12918. denominator when reducing the expressed aspect ratio to a rational.
  12919. Default value is @code{100}.
  12920. @end table
  12921. The parameter @var{sar} is an expression containing
  12922. the following constants:
  12923. @table @option
  12924. @item E, PI, PHI
  12925. These are approximated values for the mathematical constants e
  12926. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12927. @item w, h
  12928. The input width and height.
  12929. @item a
  12930. These are the same as @var{w} / @var{h}.
  12931. @item sar
  12932. The input sample aspect ratio.
  12933. @item dar
  12934. The input display aspect ratio. It is the same as
  12935. (@var{w} / @var{h}) * @var{sar}.
  12936. @item hsub, vsub
  12937. Horizontal and vertical chroma subsample values. For example, for the
  12938. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12939. @end table
  12940. @subsection Examples
  12941. @itemize
  12942. @item
  12943. To change the display aspect ratio to 16:9, specify one of the following:
  12944. @example
  12945. setdar=dar=1.77777
  12946. setdar=dar=16/9
  12947. @end example
  12948. @item
  12949. To change the sample aspect ratio to 10:11, specify:
  12950. @example
  12951. setsar=sar=10/11
  12952. @end example
  12953. @item
  12954. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12955. 1000 in the aspect ratio reduction, use the command:
  12956. @example
  12957. setdar=ratio=16/9:max=1000
  12958. @end example
  12959. @end itemize
  12960. @anchor{setfield}
  12961. @section setfield
  12962. Force field for the output video frame.
  12963. The @code{setfield} filter marks the interlace type field for the
  12964. output frames. It does not change the input frame, but only sets the
  12965. corresponding property, which affects how the frame is treated by
  12966. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12967. The filter accepts the following options:
  12968. @table @option
  12969. @item mode
  12970. Available values are:
  12971. @table @samp
  12972. @item auto
  12973. Keep the same field property.
  12974. @item bff
  12975. Mark the frame as bottom-field-first.
  12976. @item tff
  12977. Mark the frame as top-field-first.
  12978. @item prog
  12979. Mark the frame as progressive.
  12980. @end table
  12981. @end table
  12982. @anchor{setparams}
  12983. @section setparams
  12984. Force frame parameter for the output video frame.
  12985. The @code{setparams} filter marks interlace and color range for the
  12986. output frames. It does not change the input frame, but only sets the
  12987. corresponding property, which affects how the frame is treated by
  12988. filters/encoders.
  12989. @table @option
  12990. @item field_mode
  12991. Available values are:
  12992. @table @samp
  12993. @item auto
  12994. Keep the same field property (default).
  12995. @item bff
  12996. Mark the frame as bottom-field-first.
  12997. @item tff
  12998. Mark the frame as top-field-first.
  12999. @item prog
  13000. Mark the frame as progressive.
  13001. @end table
  13002. @item range
  13003. Available values are:
  13004. @table @samp
  13005. @item auto
  13006. Keep the same color range property (default).
  13007. @item unspecified, unknown
  13008. Mark the frame as unspecified color range.
  13009. @item limited, tv, mpeg
  13010. Mark the frame as limited range.
  13011. @item full, pc, jpeg
  13012. Mark the frame as full range.
  13013. @end table
  13014. @item color_primaries
  13015. Set the color primaries.
  13016. Available values are:
  13017. @table @samp
  13018. @item auto
  13019. Keep the same color primaries property (default).
  13020. @item bt709
  13021. @item unknown
  13022. @item bt470m
  13023. @item bt470bg
  13024. @item smpte170m
  13025. @item smpte240m
  13026. @item film
  13027. @item bt2020
  13028. @item smpte428
  13029. @item smpte431
  13030. @item smpte432
  13031. @item jedec-p22
  13032. @end table
  13033. @item color_trc
  13034. Set the color transfer.
  13035. Available values are:
  13036. @table @samp
  13037. @item auto
  13038. Keep the same color trc property (default).
  13039. @item bt709
  13040. @item unknown
  13041. @item bt470m
  13042. @item bt470bg
  13043. @item smpte170m
  13044. @item smpte240m
  13045. @item linear
  13046. @item log100
  13047. @item log316
  13048. @item iec61966-2-4
  13049. @item bt1361e
  13050. @item iec61966-2-1
  13051. @item bt2020-10
  13052. @item bt2020-12
  13053. @item smpte2084
  13054. @item smpte428
  13055. @item arib-std-b67
  13056. @end table
  13057. @item colorspace
  13058. Set the colorspace.
  13059. Available values are:
  13060. @table @samp
  13061. @item auto
  13062. Keep the same colorspace property (default).
  13063. @item gbr
  13064. @item bt709
  13065. @item unknown
  13066. @item fcc
  13067. @item bt470bg
  13068. @item smpte170m
  13069. @item smpte240m
  13070. @item ycgco
  13071. @item bt2020nc
  13072. @item bt2020c
  13073. @item smpte2085
  13074. @item chroma-derived-nc
  13075. @item chroma-derived-c
  13076. @item ictcp
  13077. @end table
  13078. @end table
  13079. @section showinfo
  13080. Show a line containing various information for each input video frame.
  13081. The input video is not modified.
  13082. This filter supports the following options:
  13083. @table @option
  13084. @item checksum
  13085. Calculate checksums of each plane. By default enabled.
  13086. @end table
  13087. The shown line contains a sequence of key/value pairs of the form
  13088. @var{key}:@var{value}.
  13089. The following values are shown in the output:
  13090. @table @option
  13091. @item n
  13092. The (sequential) number of the input frame, starting from 0.
  13093. @item pts
  13094. The Presentation TimeStamp of the input frame, expressed as a number of
  13095. time base units. The time base unit depends on the filter input pad.
  13096. @item pts_time
  13097. The Presentation TimeStamp of the input frame, expressed as a number of
  13098. seconds.
  13099. @item pos
  13100. The position of the frame in the input stream, or -1 if this information is
  13101. unavailable and/or meaningless (for example in case of synthetic video).
  13102. @item fmt
  13103. The pixel format name.
  13104. @item sar
  13105. The sample aspect ratio of the input frame, expressed in the form
  13106. @var{num}/@var{den}.
  13107. @item s
  13108. The size of the input frame. For the syntax of this option, check the
  13109. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13110. @item i
  13111. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  13112. for bottom field first).
  13113. @item iskey
  13114. This is 1 if the frame is a key frame, 0 otherwise.
  13115. @item type
  13116. The picture type of the input frame ("I" for an I-frame, "P" for a
  13117. P-frame, "B" for a B-frame, or "?" for an unknown type).
  13118. Also refer to the documentation of the @code{AVPictureType} enum and of
  13119. the @code{av_get_picture_type_char} function defined in
  13120. @file{libavutil/avutil.h}.
  13121. @item checksum
  13122. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  13123. @item plane_checksum
  13124. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  13125. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  13126. @item mean
  13127. The mean value of pixels in each plane of the input frame, expressed in the form
  13128. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  13129. @item stdev
  13130. The standard deviation of pixel values in each plane of the input frame, expressed
  13131. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  13132. @end table
  13133. @section showpalette
  13134. Displays the 256 colors palette of each frame. This filter is only relevant for
  13135. @var{pal8} pixel format frames.
  13136. It accepts the following option:
  13137. @table @option
  13138. @item s
  13139. Set the size of the box used to represent one palette color entry. Default is
  13140. @code{30} (for a @code{30x30} pixel box).
  13141. @end table
  13142. @section shuffleframes
  13143. Reorder and/or duplicate and/or drop video frames.
  13144. It accepts the following parameters:
  13145. @table @option
  13146. @item mapping
  13147. Set the destination indexes of input frames.
  13148. This is space or '|' separated list of indexes that maps input frames to output
  13149. frames. Number of indexes also sets maximal value that each index may have.
  13150. '-1' index have special meaning and that is to drop frame.
  13151. @end table
  13152. The first frame has the index 0. The default is to keep the input unchanged.
  13153. @subsection Examples
  13154. @itemize
  13155. @item
  13156. Swap second and third frame of every three frames of the input:
  13157. @example
  13158. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  13159. @end example
  13160. @item
  13161. Swap 10th and 1st frame of every ten frames of the input:
  13162. @example
  13163. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  13164. @end example
  13165. @end itemize
  13166. @section shuffleplanes
  13167. Reorder and/or duplicate video planes.
  13168. It accepts the following parameters:
  13169. @table @option
  13170. @item map0
  13171. The index of the input plane to be used as the first output plane.
  13172. @item map1
  13173. The index of the input plane to be used as the second output plane.
  13174. @item map2
  13175. The index of the input plane to be used as the third output plane.
  13176. @item map3
  13177. The index of the input plane to be used as the fourth output plane.
  13178. @end table
  13179. The first plane has the index 0. The default is to keep the input unchanged.
  13180. @subsection Examples
  13181. @itemize
  13182. @item
  13183. Swap the second and third planes of the input:
  13184. @example
  13185. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  13186. @end example
  13187. @end itemize
  13188. @anchor{signalstats}
  13189. @section signalstats
  13190. Evaluate various visual metrics that assist in determining issues associated
  13191. with the digitization of analog video media.
  13192. By default the filter will log these metadata values:
  13193. @table @option
  13194. @item YMIN
  13195. Display the minimal Y value contained within the input frame. Expressed in
  13196. range of [0-255].
  13197. @item YLOW
  13198. Display the Y value at the 10% percentile within the input frame. Expressed in
  13199. range of [0-255].
  13200. @item YAVG
  13201. Display the average Y value within the input frame. Expressed in range of
  13202. [0-255].
  13203. @item YHIGH
  13204. Display the Y value at the 90% percentile within the input frame. Expressed in
  13205. range of [0-255].
  13206. @item YMAX
  13207. Display the maximum Y value contained within the input frame. Expressed in
  13208. range of [0-255].
  13209. @item UMIN
  13210. Display the minimal U value contained within the input frame. Expressed in
  13211. range of [0-255].
  13212. @item ULOW
  13213. Display the U value at the 10% percentile within the input frame. Expressed in
  13214. range of [0-255].
  13215. @item UAVG
  13216. Display the average U value within the input frame. Expressed in range of
  13217. [0-255].
  13218. @item UHIGH
  13219. Display the U value at the 90% percentile within the input frame. Expressed in
  13220. range of [0-255].
  13221. @item UMAX
  13222. Display the maximum U value contained within the input frame. Expressed in
  13223. range of [0-255].
  13224. @item VMIN
  13225. Display the minimal V value contained within the input frame. Expressed in
  13226. range of [0-255].
  13227. @item VLOW
  13228. Display the V value at the 10% percentile within the input frame. Expressed in
  13229. range of [0-255].
  13230. @item VAVG
  13231. Display the average V value within the input frame. Expressed in range of
  13232. [0-255].
  13233. @item VHIGH
  13234. Display the V value at the 90% percentile within the input frame. Expressed in
  13235. range of [0-255].
  13236. @item VMAX
  13237. Display the maximum V value contained within the input frame. Expressed in
  13238. range of [0-255].
  13239. @item SATMIN
  13240. Display the minimal saturation value contained within the input frame.
  13241. Expressed in range of [0-~181.02].
  13242. @item SATLOW
  13243. Display the saturation value at the 10% percentile within the input frame.
  13244. Expressed in range of [0-~181.02].
  13245. @item SATAVG
  13246. Display the average saturation value within the input frame. Expressed in range
  13247. of [0-~181.02].
  13248. @item SATHIGH
  13249. Display the saturation value at the 90% percentile within the input frame.
  13250. Expressed in range of [0-~181.02].
  13251. @item SATMAX
  13252. Display the maximum saturation value contained within the input frame.
  13253. Expressed in range of [0-~181.02].
  13254. @item HUEMED
  13255. Display the median value for hue within the input frame. Expressed in range of
  13256. [0-360].
  13257. @item HUEAVG
  13258. Display the average value for hue within the input frame. Expressed in range of
  13259. [0-360].
  13260. @item YDIF
  13261. Display the average of sample value difference between all values of the Y
  13262. plane in the current frame and corresponding values of the previous input frame.
  13263. Expressed in range of [0-255].
  13264. @item UDIF
  13265. Display the average of sample value difference between all values of the U
  13266. plane in the current frame and corresponding values of the previous input frame.
  13267. Expressed in range of [0-255].
  13268. @item VDIF
  13269. Display the average of sample value difference between all values of the V
  13270. plane in the current frame and corresponding values of the previous input frame.
  13271. Expressed in range of [0-255].
  13272. @item YBITDEPTH
  13273. Display bit depth of Y plane in current frame.
  13274. Expressed in range of [0-16].
  13275. @item UBITDEPTH
  13276. Display bit depth of U plane in current frame.
  13277. Expressed in range of [0-16].
  13278. @item VBITDEPTH
  13279. Display bit depth of V plane in current frame.
  13280. Expressed in range of [0-16].
  13281. @end table
  13282. The filter accepts the following options:
  13283. @table @option
  13284. @item stat
  13285. @item out
  13286. @option{stat} specify an additional form of image analysis.
  13287. @option{out} output video with the specified type of pixel highlighted.
  13288. Both options accept the following values:
  13289. @table @samp
  13290. @item tout
  13291. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  13292. unlike the neighboring pixels of the same field. Examples of temporal outliers
  13293. include the results of video dropouts, head clogs, or tape tracking issues.
  13294. @item vrep
  13295. Identify @var{vertical line repetition}. Vertical line repetition includes
  13296. similar rows of pixels within a frame. In born-digital video vertical line
  13297. repetition is common, but this pattern is uncommon in video digitized from an
  13298. analog source. When it occurs in video that results from the digitization of an
  13299. analog source it can indicate concealment from a dropout compensator.
  13300. @item brng
  13301. Identify pixels that fall outside of legal broadcast range.
  13302. @end table
  13303. @item color, c
  13304. Set the highlight color for the @option{out} option. The default color is
  13305. yellow.
  13306. @end table
  13307. @subsection Examples
  13308. @itemize
  13309. @item
  13310. Output data of various video metrics:
  13311. @example
  13312. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  13313. @end example
  13314. @item
  13315. Output specific data about the minimum and maximum values of the Y plane per frame:
  13316. @example
  13317. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  13318. @end example
  13319. @item
  13320. Playback video while highlighting pixels that are outside of broadcast range in red.
  13321. @example
  13322. ffplay example.mov -vf signalstats="out=brng:color=red"
  13323. @end example
  13324. @item
  13325. Playback video with signalstats metadata drawn over the frame.
  13326. @example
  13327. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  13328. @end example
  13329. The contents of signalstat_drawtext.txt used in the command are:
  13330. @example
  13331. time %@{pts:hms@}
  13332. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  13333. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  13334. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  13335. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  13336. @end example
  13337. @end itemize
  13338. @anchor{signature}
  13339. @section signature
  13340. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  13341. input. In this case the matching between the inputs can be calculated additionally.
  13342. The filter always passes through the first input. The signature of each stream can
  13343. be written into a file.
  13344. It accepts the following options:
  13345. @table @option
  13346. @item detectmode
  13347. Enable or disable the matching process.
  13348. Available values are:
  13349. @table @samp
  13350. @item off
  13351. Disable the calculation of a matching (default).
  13352. @item full
  13353. Calculate the matching for the whole video and output whether the whole video
  13354. matches or only parts.
  13355. @item fast
  13356. Calculate only until a matching is found or the video ends. Should be faster in
  13357. some cases.
  13358. @end table
  13359. @item nb_inputs
  13360. Set the number of inputs. The option value must be a non negative integer.
  13361. Default value is 1.
  13362. @item filename
  13363. Set the path to which the output is written. If there is more than one input,
  13364. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  13365. integer), that will be replaced with the input number. If no filename is
  13366. specified, no output will be written. This is the default.
  13367. @item format
  13368. Choose the output format.
  13369. Available values are:
  13370. @table @samp
  13371. @item binary
  13372. Use the specified binary representation (default).
  13373. @item xml
  13374. Use the specified xml representation.
  13375. @end table
  13376. @item th_d
  13377. Set threshold to detect one word as similar. The option value must be an integer
  13378. greater than zero. The default value is 9000.
  13379. @item th_dc
  13380. Set threshold to detect all words as similar. The option value must be an integer
  13381. greater than zero. The default value is 60000.
  13382. @item th_xh
  13383. Set threshold to detect frames as similar. The option value must be an integer
  13384. greater than zero. The default value is 116.
  13385. @item th_di
  13386. Set the minimum length of a sequence in frames to recognize it as matching
  13387. sequence. The option value must be a non negative integer value.
  13388. The default value is 0.
  13389. @item th_it
  13390. Set the minimum relation, that matching frames to all frames must have.
  13391. The option value must be a double value between 0 and 1. The default value is 0.5.
  13392. @end table
  13393. @subsection Examples
  13394. @itemize
  13395. @item
  13396. To calculate the signature of an input video and store it in signature.bin:
  13397. @example
  13398. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13399. @end example
  13400. @item
  13401. To detect whether two videos match and store the signatures in XML format in
  13402. signature0.xml and signature1.xml:
  13403. @example
  13404. 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 -
  13405. @end example
  13406. @end itemize
  13407. @anchor{smartblur}
  13408. @section smartblur
  13409. Blur the input video without impacting the outlines.
  13410. It accepts the following options:
  13411. @table @option
  13412. @item luma_radius, lr
  13413. Set the luma radius. The option value must be a float number in
  13414. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13415. used to blur the image (slower if larger). Default value is 1.0.
  13416. @item luma_strength, ls
  13417. Set the luma strength. The option value must be a float number
  13418. in the range [-1.0,1.0] that configures the blurring. A value included
  13419. in [0.0,1.0] will blur the image whereas a value included in
  13420. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13421. @item luma_threshold, lt
  13422. Set the luma threshold used as a coefficient to determine
  13423. whether a pixel should be blurred or not. The option value must be an
  13424. integer in the range [-30,30]. A value of 0 will filter all the image,
  13425. a value included in [0,30] will filter flat areas and a value included
  13426. in [-30,0] will filter edges. Default value is 0.
  13427. @item chroma_radius, cr
  13428. Set the chroma radius. The option value must be a float number in
  13429. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13430. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13431. @item chroma_strength, cs
  13432. Set the chroma strength. The option value must be a float number
  13433. in the range [-1.0,1.0] that configures the blurring. A value included
  13434. in [0.0,1.0] will blur the image whereas a value included in
  13435. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13436. @item chroma_threshold, ct
  13437. Set the chroma threshold used as a coefficient to determine
  13438. whether a pixel should be blurred or not. The option value must be an
  13439. integer in the range [-30,30]. A value of 0 will filter all the image,
  13440. a value included in [0,30] will filter flat areas and a value included
  13441. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13442. @end table
  13443. If a chroma option is not explicitly set, the corresponding luma value
  13444. is set.
  13445. @section sobel
  13446. Apply sobel operator to input video stream.
  13447. The filter accepts the following option:
  13448. @table @option
  13449. @item planes
  13450. Set which planes will be processed, unprocessed planes will be copied.
  13451. By default value 0xf, all planes will be processed.
  13452. @item scale
  13453. Set value which will be multiplied with filtered result.
  13454. @item delta
  13455. Set value which will be added to filtered result.
  13456. @end table
  13457. @anchor{spp}
  13458. @section spp
  13459. Apply a simple postprocessing filter that compresses and decompresses the image
  13460. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13461. and average the results.
  13462. The filter accepts the following options:
  13463. @table @option
  13464. @item quality
  13465. Set quality. This option defines the number of levels for averaging. It accepts
  13466. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13467. effect. A value of @code{6} means the higher quality. For each increment of
  13468. that value the speed drops by a factor of approximately 2. Default value is
  13469. @code{3}.
  13470. @item qp
  13471. Force a constant quantization parameter. If not set, the filter will use the QP
  13472. from the video stream (if available).
  13473. @item mode
  13474. Set thresholding mode. Available modes are:
  13475. @table @samp
  13476. @item hard
  13477. Set hard thresholding (default).
  13478. @item soft
  13479. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13480. @end table
  13481. @item use_bframe_qp
  13482. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13483. option may cause flicker since the B-Frames have often larger QP. Default is
  13484. @code{0} (not enabled).
  13485. @end table
  13486. @subsection Commands
  13487. This filter supports the following commands:
  13488. @table @option
  13489. @item quality, level
  13490. Set quality level. The value @code{max} can be used to set the maximum level,
  13491. currently @code{6}.
  13492. @end table
  13493. @anchor{sr}
  13494. @section sr
  13495. Scale the input by applying one of the super-resolution methods based on
  13496. convolutional neural networks. Supported models:
  13497. @itemize
  13498. @item
  13499. Super-Resolution Convolutional Neural Network model (SRCNN).
  13500. See @url{https://arxiv.org/abs/1501.00092}.
  13501. @item
  13502. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13503. See @url{https://arxiv.org/abs/1609.05158}.
  13504. @end itemize
  13505. Training scripts as well as scripts for model file (.pb) saving can be found at
  13506. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13507. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13508. Native model files (.model) can be generated from TensorFlow model
  13509. files (.pb) by using tools/python/convert.py
  13510. The filter accepts the following options:
  13511. @table @option
  13512. @item dnn_backend
  13513. Specify which DNN backend to use for model loading and execution. This option accepts
  13514. the following values:
  13515. @table @samp
  13516. @item native
  13517. Native implementation of DNN loading and execution.
  13518. @item tensorflow
  13519. TensorFlow backend. To enable this backend you
  13520. need to install the TensorFlow for C library (see
  13521. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13522. @code{--enable-libtensorflow}
  13523. @end table
  13524. Default value is @samp{native}.
  13525. @item model
  13526. Set path to model file specifying network architecture and its parameters.
  13527. Note that different backends use different file formats. TensorFlow backend
  13528. can load files for both formats, while native backend can load files for only
  13529. its format.
  13530. @item scale_factor
  13531. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13532. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13533. input upscaled using bicubic upscaling with proper scale factor.
  13534. @end table
  13535. This feature can also be finished with @ref{dnn_processing} filter.
  13536. @section ssim
  13537. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13538. This filter takes in input two input videos, the first input is
  13539. considered the "main" source and is passed unchanged to the
  13540. output. The second input is used as a "reference" video for computing
  13541. the SSIM.
  13542. Both video inputs must have the same resolution and pixel format for
  13543. this filter to work correctly. Also it assumes that both inputs
  13544. have the same number of frames, which are compared one by one.
  13545. The filter stores the calculated SSIM of each frame.
  13546. The description of the accepted parameters follows.
  13547. @table @option
  13548. @item stats_file, f
  13549. If specified the filter will use the named file to save the SSIM of
  13550. each individual frame. When filename equals "-" the data is sent to
  13551. standard output.
  13552. @end table
  13553. The file printed if @var{stats_file} is selected, contains a sequence of
  13554. key/value pairs of the form @var{key}:@var{value} for each compared
  13555. couple of frames.
  13556. A description of each shown parameter follows:
  13557. @table @option
  13558. @item n
  13559. sequential number of the input frame, starting from 1
  13560. @item Y, U, V, R, G, B
  13561. SSIM of the compared frames for the component specified by the suffix.
  13562. @item All
  13563. SSIM of the compared frames for the whole frame.
  13564. @item dB
  13565. Same as above but in dB representation.
  13566. @end table
  13567. This filter also supports the @ref{framesync} options.
  13568. @subsection Examples
  13569. @itemize
  13570. @item
  13571. For example:
  13572. @example
  13573. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13574. [main][ref] ssim="stats_file=stats.log" [out]
  13575. @end example
  13576. On this example the input file being processed is compared with the
  13577. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  13578. is stored in @file{stats.log}.
  13579. @item
  13580. Another example with both psnr and ssim at same time:
  13581. @example
  13582. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  13583. @end example
  13584. @item
  13585. Another example with different containers:
  13586. @example
  13587. 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 -
  13588. @end example
  13589. @end itemize
  13590. @section stereo3d
  13591. Convert between different stereoscopic image formats.
  13592. The filters accept the following options:
  13593. @table @option
  13594. @item in
  13595. Set stereoscopic image format of input.
  13596. Available values for input image formats are:
  13597. @table @samp
  13598. @item sbsl
  13599. side by side parallel (left eye left, right eye right)
  13600. @item sbsr
  13601. side by side crosseye (right eye left, left eye right)
  13602. @item sbs2l
  13603. side by side parallel with half width resolution
  13604. (left eye left, right eye right)
  13605. @item sbs2r
  13606. side by side crosseye with half width resolution
  13607. (right eye left, left eye right)
  13608. @item abl
  13609. @item tbl
  13610. above-below (left eye above, right eye below)
  13611. @item abr
  13612. @item tbr
  13613. above-below (right eye above, left eye below)
  13614. @item ab2l
  13615. @item tb2l
  13616. above-below with half height resolution
  13617. (left eye above, right eye below)
  13618. @item ab2r
  13619. @item tb2r
  13620. above-below with half height resolution
  13621. (right eye above, left eye below)
  13622. @item al
  13623. alternating frames (left eye first, right eye second)
  13624. @item ar
  13625. alternating frames (right eye first, left eye second)
  13626. @item irl
  13627. interleaved rows (left eye has top row, right eye starts on next row)
  13628. @item irr
  13629. interleaved rows (right eye has top row, left eye starts on next row)
  13630. @item icl
  13631. interleaved columns, left eye first
  13632. @item icr
  13633. interleaved columns, right eye first
  13634. Default value is @samp{sbsl}.
  13635. @end table
  13636. @item out
  13637. Set stereoscopic image format of output.
  13638. @table @samp
  13639. @item sbsl
  13640. side by side parallel (left eye left, right eye right)
  13641. @item sbsr
  13642. side by side crosseye (right eye left, left eye right)
  13643. @item sbs2l
  13644. side by side parallel with half width resolution
  13645. (left eye left, right eye right)
  13646. @item sbs2r
  13647. side by side crosseye with half width resolution
  13648. (right eye left, left eye right)
  13649. @item abl
  13650. @item tbl
  13651. above-below (left eye above, right eye below)
  13652. @item abr
  13653. @item tbr
  13654. above-below (right eye above, left eye below)
  13655. @item ab2l
  13656. @item tb2l
  13657. above-below with half height resolution
  13658. (left eye above, right eye below)
  13659. @item ab2r
  13660. @item tb2r
  13661. above-below with half height resolution
  13662. (right eye above, left eye below)
  13663. @item al
  13664. alternating frames (left eye first, right eye second)
  13665. @item ar
  13666. alternating frames (right eye first, left eye second)
  13667. @item irl
  13668. interleaved rows (left eye has top row, right eye starts on next row)
  13669. @item irr
  13670. interleaved rows (right eye has top row, left eye starts on next row)
  13671. @item arbg
  13672. anaglyph red/blue gray
  13673. (red filter on left eye, blue filter on right eye)
  13674. @item argg
  13675. anaglyph red/green gray
  13676. (red filter on left eye, green filter on right eye)
  13677. @item arcg
  13678. anaglyph red/cyan gray
  13679. (red filter on left eye, cyan filter on right eye)
  13680. @item arch
  13681. anaglyph red/cyan half colored
  13682. (red filter on left eye, cyan filter on right eye)
  13683. @item arcc
  13684. anaglyph red/cyan color
  13685. (red filter on left eye, cyan filter on right eye)
  13686. @item arcd
  13687. anaglyph red/cyan color optimized with the least squares projection of dubois
  13688. (red filter on left eye, cyan filter on right eye)
  13689. @item agmg
  13690. anaglyph green/magenta gray
  13691. (green filter on left eye, magenta filter on right eye)
  13692. @item agmh
  13693. anaglyph green/magenta half colored
  13694. (green filter on left eye, magenta filter on right eye)
  13695. @item agmc
  13696. anaglyph green/magenta colored
  13697. (green filter on left eye, magenta filter on right eye)
  13698. @item agmd
  13699. anaglyph green/magenta color optimized with the least squares projection of dubois
  13700. (green filter on left eye, magenta filter on right eye)
  13701. @item aybg
  13702. anaglyph yellow/blue gray
  13703. (yellow filter on left eye, blue filter on right eye)
  13704. @item aybh
  13705. anaglyph yellow/blue half colored
  13706. (yellow filter on left eye, blue filter on right eye)
  13707. @item aybc
  13708. anaglyph yellow/blue colored
  13709. (yellow filter on left eye, blue filter on right eye)
  13710. @item aybd
  13711. anaglyph yellow/blue color optimized with the least squares projection of dubois
  13712. (yellow filter on left eye, blue filter on right eye)
  13713. @item ml
  13714. mono output (left eye only)
  13715. @item mr
  13716. mono output (right eye only)
  13717. @item chl
  13718. checkerboard, left eye first
  13719. @item chr
  13720. checkerboard, right eye first
  13721. @item icl
  13722. interleaved columns, left eye first
  13723. @item icr
  13724. interleaved columns, right eye first
  13725. @item hdmi
  13726. HDMI frame pack
  13727. @end table
  13728. Default value is @samp{arcd}.
  13729. @end table
  13730. @subsection Examples
  13731. @itemize
  13732. @item
  13733. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  13734. @example
  13735. stereo3d=sbsl:aybd
  13736. @end example
  13737. @item
  13738. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  13739. @example
  13740. stereo3d=abl:sbsr
  13741. @end example
  13742. @end itemize
  13743. @section streamselect, astreamselect
  13744. Select video or audio streams.
  13745. The filter accepts the following options:
  13746. @table @option
  13747. @item inputs
  13748. Set number of inputs. Default is 2.
  13749. @item map
  13750. Set input indexes to remap to outputs.
  13751. @end table
  13752. @subsection Commands
  13753. The @code{streamselect} and @code{astreamselect} filter supports the following
  13754. commands:
  13755. @table @option
  13756. @item map
  13757. Set input indexes to remap to outputs.
  13758. @end table
  13759. @subsection Examples
  13760. @itemize
  13761. @item
  13762. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13763. @example
  13764. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13765. @end example
  13766. @item
  13767. Same as above, but for audio:
  13768. @example
  13769. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13770. @end example
  13771. @end itemize
  13772. @anchor{subtitles}
  13773. @section subtitles
  13774. Draw subtitles on top of input video using the libass library.
  13775. To enable compilation of this filter you need to configure FFmpeg with
  13776. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13777. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13778. Alpha) subtitles format.
  13779. The filter accepts the following options:
  13780. @table @option
  13781. @item filename, f
  13782. Set the filename of the subtitle file to read. It must be specified.
  13783. @item original_size
  13784. Specify the size of the original video, the video for which the ASS file
  13785. was composed. For the syntax of this option, check the
  13786. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13787. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13788. correctly scale the fonts if the aspect ratio has been changed.
  13789. @item fontsdir
  13790. Set a directory path containing fonts that can be used by the filter.
  13791. These fonts will be used in addition to whatever the font provider uses.
  13792. @item alpha
  13793. Process alpha channel, by default alpha channel is untouched.
  13794. @item charenc
  13795. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13796. useful if not UTF-8.
  13797. @item stream_index, si
  13798. Set subtitles stream index. @code{subtitles} filter only.
  13799. @item force_style
  13800. Override default style or script info parameters of the subtitles. It accepts a
  13801. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13802. @end table
  13803. If the first key is not specified, it is assumed that the first value
  13804. specifies the @option{filename}.
  13805. For example, to render the file @file{sub.srt} on top of the input
  13806. video, use the command:
  13807. @example
  13808. subtitles=sub.srt
  13809. @end example
  13810. which is equivalent to:
  13811. @example
  13812. subtitles=filename=sub.srt
  13813. @end example
  13814. To render the default subtitles stream from file @file{video.mkv}, use:
  13815. @example
  13816. subtitles=video.mkv
  13817. @end example
  13818. To render the second subtitles stream from that file, use:
  13819. @example
  13820. subtitles=video.mkv:si=1
  13821. @end example
  13822. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13823. @code{DejaVu Serif}, use:
  13824. @example
  13825. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13826. @end example
  13827. @section super2xsai
  13828. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13829. Interpolate) pixel art scaling algorithm.
  13830. Useful for enlarging pixel art images without reducing sharpness.
  13831. @section swaprect
  13832. Swap two rectangular objects in video.
  13833. This filter accepts the following options:
  13834. @table @option
  13835. @item w
  13836. Set object width.
  13837. @item h
  13838. Set object height.
  13839. @item x1
  13840. Set 1st rect x coordinate.
  13841. @item y1
  13842. Set 1st rect y coordinate.
  13843. @item x2
  13844. Set 2nd rect x coordinate.
  13845. @item y2
  13846. Set 2nd rect y coordinate.
  13847. All expressions are evaluated once for each frame.
  13848. @end table
  13849. The all options are expressions containing the following constants:
  13850. @table @option
  13851. @item w
  13852. @item h
  13853. The input width and height.
  13854. @item a
  13855. same as @var{w} / @var{h}
  13856. @item sar
  13857. input sample aspect ratio
  13858. @item dar
  13859. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13860. @item n
  13861. The number of the input frame, starting from 0.
  13862. @item t
  13863. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13864. @item pos
  13865. the position in the file of the input frame, NAN if unknown
  13866. @end table
  13867. @section swapuv
  13868. Swap U & V plane.
  13869. @section tblend
  13870. Blend successive video frames.
  13871. See @ref{blend}
  13872. @section telecine
  13873. Apply telecine process to the video.
  13874. This filter accepts the following options:
  13875. @table @option
  13876. @item first_field
  13877. @table @samp
  13878. @item top, t
  13879. top field first
  13880. @item bottom, b
  13881. bottom field first
  13882. The default value is @code{top}.
  13883. @end table
  13884. @item pattern
  13885. A string of numbers representing the pulldown pattern you wish to apply.
  13886. The default value is @code{23}.
  13887. @end table
  13888. @example
  13889. Some typical patterns:
  13890. NTSC output (30i):
  13891. 27.5p: 32222
  13892. 24p: 23 (classic)
  13893. 24p: 2332 (preferred)
  13894. 20p: 33
  13895. 18p: 334
  13896. 16p: 3444
  13897. PAL output (25i):
  13898. 27.5p: 12222
  13899. 24p: 222222222223 ("Euro pulldown")
  13900. 16.67p: 33
  13901. 16p: 33333334
  13902. @end example
  13903. @section thistogram
  13904. Compute and draw a color distribution histogram for the input video across time.
  13905. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  13906. at certain time, this filter shows also past histograms of number of frames defined
  13907. by @code{width} option.
  13908. The computed histogram is a representation of the color component
  13909. distribution in an image.
  13910. The filter accepts the following options:
  13911. @table @option
  13912. @item width, w
  13913. Set width of single color component output. Default value is @code{0}.
  13914. Value of @code{0} means width will be picked from input video.
  13915. This also set number of passed histograms to keep.
  13916. Allowed range is [0, 8192].
  13917. @item display_mode, d
  13918. Set display mode.
  13919. It accepts the following values:
  13920. @table @samp
  13921. @item stack
  13922. Per color component graphs are placed below each other.
  13923. @item parade
  13924. Per color component graphs are placed side by side.
  13925. @item overlay
  13926. Presents information identical to that in the @code{parade}, except
  13927. that the graphs representing color components are superimposed directly
  13928. over one another.
  13929. @end table
  13930. Default is @code{stack}.
  13931. @item levels_mode, m
  13932. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  13933. Default is @code{linear}.
  13934. @item components, c
  13935. Set what color components to display.
  13936. Default is @code{7}.
  13937. @item bgopacity, b
  13938. Set background opacity. Default is @code{0.9}.
  13939. @item envelope, e
  13940. Show envelope. Default is disabled.
  13941. @item ecolor, ec
  13942. Set envelope color. Default is @code{gold}.
  13943. @item slide
  13944. Set slide mode.
  13945. Available values for slide is:
  13946. @table @samp
  13947. @item frame
  13948. Draw new frame when right border is reached.
  13949. @item replace
  13950. Replace old columns with new ones.
  13951. @item scroll
  13952. Scroll from right to left.
  13953. @item rscroll
  13954. Scroll from left to right.
  13955. @item picture
  13956. Draw single picture.
  13957. @end table
  13958. Default is @code{replace}.
  13959. @end table
  13960. @section threshold
  13961. Apply threshold effect to video stream.
  13962. This filter needs four video streams to perform thresholding.
  13963. First stream is stream we are filtering.
  13964. Second stream is holding threshold values, third stream is holding min values,
  13965. and last, fourth stream is holding max values.
  13966. The filter accepts the following option:
  13967. @table @option
  13968. @item planes
  13969. Set which planes will be processed, unprocessed planes will be copied.
  13970. By default value 0xf, all planes will be processed.
  13971. @end table
  13972. For example if first stream pixel's component value is less then threshold value
  13973. of pixel component from 2nd threshold stream, third stream value will picked,
  13974. otherwise fourth stream pixel component value will be picked.
  13975. Using color source filter one can perform various types of thresholding:
  13976. @subsection Examples
  13977. @itemize
  13978. @item
  13979. Binary threshold, using gray color as threshold:
  13980. @example
  13981. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13982. @end example
  13983. @item
  13984. Inverted binary threshold, using gray color as threshold:
  13985. @example
  13986. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13987. @end example
  13988. @item
  13989. Truncate binary threshold, using gray color as threshold:
  13990. @example
  13991. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13992. @end example
  13993. @item
  13994. Threshold to zero, using gray color as threshold:
  13995. @example
  13996. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13997. @end example
  13998. @item
  13999. Inverted threshold to zero, using gray color as threshold:
  14000. @example
  14001. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  14002. @end example
  14003. @end itemize
  14004. @section thumbnail
  14005. Select the most representative frame in a given sequence of consecutive frames.
  14006. The filter accepts the following options:
  14007. @table @option
  14008. @item n
  14009. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  14010. will pick one of them, and then handle the next batch of @var{n} frames until
  14011. the end. Default is @code{100}.
  14012. @end table
  14013. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  14014. value will result in a higher memory usage, so a high value is not recommended.
  14015. @subsection Examples
  14016. @itemize
  14017. @item
  14018. Extract one picture each 50 frames:
  14019. @example
  14020. thumbnail=50
  14021. @end example
  14022. @item
  14023. Complete example of a thumbnail creation with @command{ffmpeg}:
  14024. @example
  14025. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  14026. @end example
  14027. @end itemize
  14028. @anchor{tile}
  14029. @section tile
  14030. Tile several successive frames together.
  14031. The @ref{untile} filter can do the reverse.
  14032. The filter accepts the following options:
  14033. @table @option
  14034. @item layout
  14035. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14036. this option, check the
  14037. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14038. @item nb_frames
  14039. Set the maximum number of frames to render in the given area. It must be less
  14040. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  14041. the area will be used.
  14042. @item margin
  14043. Set the outer border margin in pixels.
  14044. @item padding
  14045. Set the inner border thickness (i.e. the number of pixels between frames). For
  14046. more advanced padding options (such as having different values for the edges),
  14047. refer to the pad video filter.
  14048. @item color
  14049. Specify the color of the unused area. For the syntax of this option, check the
  14050. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14051. The default value of @var{color} is "black".
  14052. @item overlap
  14053. Set the number of frames to overlap when tiling several successive frames together.
  14054. The value must be between @code{0} and @var{nb_frames - 1}.
  14055. @item init_padding
  14056. Set the number of frames to initially be empty before displaying first output frame.
  14057. This controls how soon will one get first output frame.
  14058. The value must be between @code{0} and @var{nb_frames - 1}.
  14059. @end table
  14060. @subsection Examples
  14061. @itemize
  14062. @item
  14063. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  14064. @example
  14065. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  14066. @end example
  14067. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  14068. duplicating each output frame to accommodate the originally detected frame
  14069. rate.
  14070. @item
  14071. Display @code{5} pictures in an area of @code{3x2} frames,
  14072. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  14073. mixed flat and named options:
  14074. @example
  14075. tile=3x2:nb_frames=5:padding=7:margin=2
  14076. @end example
  14077. @end itemize
  14078. @section tinterlace
  14079. Perform various types of temporal field interlacing.
  14080. Frames are counted starting from 1, so the first input frame is
  14081. considered odd.
  14082. The filter accepts the following options:
  14083. @table @option
  14084. @item mode
  14085. Specify the mode of the interlacing. This option can also be specified
  14086. as a value alone. See below for a list of values for this option.
  14087. Available values are:
  14088. @table @samp
  14089. @item merge, 0
  14090. Move odd frames into the upper field, even into the lower field,
  14091. generating a double height frame at half frame rate.
  14092. @example
  14093. ------> time
  14094. Input:
  14095. Frame 1 Frame 2 Frame 3 Frame 4
  14096. 11111 22222 33333 44444
  14097. 11111 22222 33333 44444
  14098. 11111 22222 33333 44444
  14099. 11111 22222 33333 44444
  14100. Output:
  14101. 11111 33333
  14102. 22222 44444
  14103. 11111 33333
  14104. 22222 44444
  14105. 11111 33333
  14106. 22222 44444
  14107. 11111 33333
  14108. 22222 44444
  14109. @end example
  14110. @item drop_even, 1
  14111. Only output odd frames, even frames are dropped, generating a frame with
  14112. unchanged height at half frame rate.
  14113. @example
  14114. ------> time
  14115. Input:
  14116. Frame 1 Frame 2 Frame 3 Frame 4
  14117. 11111 22222 33333 44444
  14118. 11111 22222 33333 44444
  14119. 11111 22222 33333 44444
  14120. 11111 22222 33333 44444
  14121. Output:
  14122. 11111 33333
  14123. 11111 33333
  14124. 11111 33333
  14125. 11111 33333
  14126. @end example
  14127. @item drop_odd, 2
  14128. Only output even frames, odd frames are dropped, generating a frame with
  14129. unchanged height at half frame rate.
  14130. @example
  14131. ------> time
  14132. Input:
  14133. Frame 1 Frame 2 Frame 3 Frame 4
  14134. 11111 22222 33333 44444
  14135. 11111 22222 33333 44444
  14136. 11111 22222 33333 44444
  14137. 11111 22222 33333 44444
  14138. Output:
  14139. 22222 44444
  14140. 22222 44444
  14141. 22222 44444
  14142. 22222 44444
  14143. @end example
  14144. @item pad, 3
  14145. Expand each frame to full height, but pad alternate lines with black,
  14146. generating a frame with double height at the same input frame rate.
  14147. @example
  14148. ------> time
  14149. Input:
  14150. Frame 1 Frame 2 Frame 3 Frame 4
  14151. 11111 22222 33333 44444
  14152. 11111 22222 33333 44444
  14153. 11111 22222 33333 44444
  14154. 11111 22222 33333 44444
  14155. Output:
  14156. 11111 ..... 33333 .....
  14157. ..... 22222 ..... 44444
  14158. 11111 ..... 33333 .....
  14159. ..... 22222 ..... 44444
  14160. 11111 ..... 33333 .....
  14161. ..... 22222 ..... 44444
  14162. 11111 ..... 33333 .....
  14163. ..... 22222 ..... 44444
  14164. @end example
  14165. @item interleave_top, 4
  14166. Interleave the upper field from odd frames with the lower field from
  14167. even frames, generating a frame with unchanged height at half frame rate.
  14168. @example
  14169. ------> time
  14170. Input:
  14171. Frame 1 Frame 2 Frame 3 Frame 4
  14172. 11111<- 22222 33333<- 44444
  14173. 11111 22222<- 33333 44444<-
  14174. 11111<- 22222 33333<- 44444
  14175. 11111 22222<- 33333 44444<-
  14176. Output:
  14177. 11111 33333
  14178. 22222 44444
  14179. 11111 33333
  14180. 22222 44444
  14181. @end example
  14182. @item interleave_bottom, 5
  14183. Interleave the lower field from odd frames with the upper field from
  14184. even frames, generating a frame with unchanged height at half frame rate.
  14185. @example
  14186. ------> time
  14187. Input:
  14188. Frame 1 Frame 2 Frame 3 Frame 4
  14189. 11111 22222<- 33333 44444<-
  14190. 11111<- 22222 33333<- 44444
  14191. 11111 22222<- 33333 44444<-
  14192. 11111<- 22222 33333<- 44444
  14193. Output:
  14194. 22222 44444
  14195. 11111 33333
  14196. 22222 44444
  14197. 11111 33333
  14198. @end example
  14199. @item interlacex2, 6
  14200. Double frame rate with unchanged height. Frames are inserted each
  14201. containing the second temporal field from the previous input frame and
  14202. the first temporal field from the next input frame. This mode relies on
  14203. the top_field_first flag. Useful for interlaced video displays with no
  14204. field synchronisation.
  14205. @example
  14206. ------> time
  14207. Input:
  14208. Frame 1 Frame 2 Frame 3 Frame 4
  14209. 11111 22222 33333 44444
  14210. 11111 22222 33333 44444
  14211. 11111 22222 33333 44444
  14212. 11111 22222 33333 44444
  14213. Output:
  14214. 11111 22222 22222 33333 33333 44444 44444
  14215. 11111 11111 22222 22222 33333 33333 44444
  14216. 11111 22222 22222 33333 33333 44444 44444
  14217. 11111 11111 22222 22222 33333 33333 44444
  14218. @end example
  14219. @item mergex2, 7
  14220. Move odd frames into the upper field, even into the lower field,
  14221. generating a double height frame at same frame rate.
  14222. @example
  14223. ------> time
  14224. Input:
  14225. Frame 1 Frame 2 Frame 3 Frame 4
  14226. 11111 22222 33333 44444
  14227. 11111 22222 33333 44444
  14228. 11111 22222 33333 44444
  14229. 11111 22222 33333 44444
  14230. Output:
  14231. 11111 33333 33333 55555
  14232. 22222 22222 44444 44444
  14233. 11111 33333 33333 55555
  14234. 22222 22222 44444 44444
  14235. 11111 33333 33333 55555
  14236. 22222 22222 44444 44444
  14237. 11111 33333 33333 55555
  14238. 22222 22222 44444 44444
  14239. @end example
  14240. @end table
  14241. Numeric values are deprecated but are accepted for backward
  14242. compatibility reasons.
  14243. Default mode is @code{merge}.
  14244. @item flags
  14245. Specify flags influencing the filter process.
  14246. Available value for @var{flags} is:
  14247. @table @option
  14248. @item low_pass_filter, vlpf
  14249. Enable linear vertical low-pass filtering in the filter.
  14250. Vertical low-pass filtering is required when creating an interlaced
  14251. destination from a progressive source which contains high-frequency
  14252. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  14253. patterning.
  14254. @item complex_filter, cvlpf
  14255. Enable complex vertical low-pass filtering.
  14256. This will slightly less reduce interlace 'twitter' and Moire
  14257. patterning but better retain detail and subjective sharpness impression.
  14258. @item bypass_il
  14259. Bypass already interlaced frames, only adjust the frame rate.
  14260. @end table
  14261. Vertical low-pass filtering and bypassing already interlaced frames can only be
  14262. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  14263. @end table
  14264. @section tmedian
  14265. Pick median pixels from several successive input video frames.
  14266. The filter accepts the following options:
  14267. @table @option
  14268. @item radius
  14269. Set radius of median filter.
  14270. Default is 1. Allowed range is from 1 to 127.
  14271. @item planes
  14272. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14273. @item percentile
  14274. Set median percentile. Default value is @code{0.5}.
  14275. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  14276. minimum values, and @code{1} maximum values.
  14277. @end table
  14278. @section tmix
  14279. Mix successive video frames.
  14280. A description of the accepted options follows.
  14281. @table @option
  14282. @item frames
  14283. The number of successive frames to mix. If unspecified, it defaults to 3.
  14284. @item weights
  14285. Specify weight of each input video frame.
  14286. Each weight is separated by space. If number of weights is smaller than
  14287. number of @var{frames} last specified weight will be used for all remaining
  14288. unset weights.
  14289. @item scale
  14290. Specify scale, if it is set it will be multiplied with sum
  14291. of each weight multiplied with pixel values to give final destination
  14292. pixel value. By default @var{scale} is auto scaled to sum of weights.
  14293. @end table
  14294. @subsection Examples
  14295. @itemize
  14296. @item
  14297. Average 7 successive frames:
  14298. @example
  14299. tmix=frames=7:weights="1 1 1 1 1 1 1"
  14300. @end example
  14301. @item
  14302. Apply simple temporal convolution:
  14303. @example
  14304. tmix=frames=3:weights="-1 3 -1"
  14305. @end example
  14306. @item
  14307. Similar as above but only showing temporal differences:
  14308. @example
  14309. tmix=frames=3:weights="-1 2 -1":scale=1
  14310. @end example
  14311. @end itemize
  14312. @anchor{tonemap}
  14313. @section tonemap
  14314. Tone map colors from different dynamic ranges.
  14315. This filter expects data in single precision floating point, as it needs to
  14316. operate on (and can output) out-of-range values. Another filter, such as
  14317. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  14318. The tonemapping algorithms implemented only work on linear light, so input
  14319. data should be linearized beforehand (and possibly correctly tagged).
  14320. @example
  14321. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  14322. @end example
  14323. @subsection Options
  14324. The filter accepts the following options.
  14325. @table @option
  14326. @item tonemap
  14327. Set the tone map algorithm to use.
  14328. Possible values are:
  14329. @table @var
  14330. @item none
  14331. Do not apply any tone map, only desaturate overbright pixels.
  14332. @item clip
  14333. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  14334. in-range values, while distorting out-of-range values.
  14335. @item linear
  14336. Stretch the entire reference gamut to a linear multiple of the display.
  14337. @item gamma
  14338. Fit a logarithmic transfer between the tone curves.
  14339. @item reinhard
  14340. Preserve overall image brightness with a simple curve, using nonlinear
  14341. contrast, which results in flattening details and degrading color accuracy.
  14342. @item hable
  14343. Preserve both dark and bright details better than @var{reinhard}, at the cost
  14344. of slightly darkening everything. Use it when detail preservation is more
  14345. important than color and brightness accuracy.
  14346. @item mobius
  14347. Smoothly map out-of-range values, while retaining contrast and colors for
  14348. in-range material as much as possible. Use it when color accuracy is more
  14349. important than detail preservation.
  14350. @end table
  14351. Default is none.
  14352. @item param
  14353. Tune the tone mapping algorithm.
  14354. This affects the following algorithms:
  14355. @table @var
  14356. @item none
  14357. Ignored.
  14358. @item linear
  14359. Specifies the scale factor to use while stretching.
  14360. Default to 1.0.
  14361. @item gamma
  14362. Specifies the exponent of the function.
  14363. Default to 1.8.
  14364. @item clip
  14365. Specify an extra linear coefficient to multiply into the signal before clipping.
  14366. Default to 1.0.
  14367. @item reinhard
  14368. Specify the local contrast coefficient at the display peak.
  14369. Default to 0.5, which means that in-gamut values will be about half as bright
  14370. as when clipping.
  14371. @item hable
  14372. Ignored.
  14373. @item mobius
  14374. Specify the transition point from linear to mobius transform. Every value
  14375. below this point is guaranteed to be mapped 1:1. The higher the value, the
  14376. more accurate the result will be, at the cost of losing bright details.
  14377. Default to 0.3, which due to the steep initial slope still preserves in-range
  14378. colors fairly accurately.
  14379. @end table
  14380. @item desat
  14381. Apply desaturation for highlights that exceed this level of brightness. The
  14382. higher the parameter, the more color information will be preserved. This
  14383. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14384. (smoothly) turning into white instead. This makes images feel more natural,
  14385. at the cost of reducing information about out-of-range colors.
  14386. The default of 2.0 is somewhat conservative and will mostly just apply to
  14387. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  14388. This option works only if the input frame has a supported color tag.
  14389. @item peak
  14390. Override signal/nominal/reference peak with this value. Useful when the
  14391. embedded peak information in display metadata is not reliable or when tone
  14392. mapping from a lower range to a higher range.
  14393. @end table
  14394. @section tpad
  14395. Temporarily pad video frames.
  14396. The filter accepts the following options:
  14397. @table @option
  14398. @item start
  14399. Specify number of delay frames before input video stream. Default is 0.
  14400. @item stop
  14401. Specify number of padding frames after input video stream.
  14402. Set to -1 to pad indefinitely. Default is 0.
  14403. @item start_mode
  14404. Set kind of frames added to beginning of stream.
  14405. Can be either @var{add} or @var{clone}.
  14406. With @var{add} frames of solid-color are added.
  14407. With @var{clone} frames are clones of first frame.
  14408. Default is @var{add}.
  14409. @item stop_mode
  14410. Set kind of frames added to end of stream.
  14411. Can be either @var{add} or @var{clone}.
  14412. With @var{add} frames of solid-color are added.
  14413. With @var{clone} frames are clones of last frame.
  14414. Default is @var{add}.
  14415. @item start_duration, stop_duration
  14416. Specify the duration of the start/stop delay. See
  14417. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14418. for the accepted syntax.
  14419. These options override @var{start} and @var{stop}. Default is 0.
  14420. @item color
  14421. Specify the color of the padded area. For the syntax of this option,
  14422. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14423. manual,ffmpeg-utils}.
  14424. The default value of @var{color} is "black".
  14425. @end table
  14426. @anchor{transpose}
  14427. @section transpose
  14428. Transpose rows with columns in the input video and optionally flip it.
  14429. It accepts the following parameters:
  14430. @table @option
  14431. @item dir
  14432. Specify the transposition direction.
  14433. Can assume the following values:
  14434. @table @samp
  14435. @item 0, 4, cclock_flip
  14436. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  14437. @example
  14438. L.R L.l
  14439. . . -> . .
  14440. l.r R.r
  14441. @end example
  14442. @item 1, 5, clock
  14443. Rotate by 90 degrees clockwise, that is:
  14444. @example
  14445. L.R l.L
  14446. . . -> . .
  14447. l.r r.R
  14448. @end example
  14449. @item 2, 6, cclock
  14450. Rotate by 90 degrees counterclockwise, that is:
  14451. @example
  14452. L.R R.r
  14453. . . -> . .
  14454. l.r L.l
  14455. @end example
  14456. @item 3, 7, clock_flip
  14457. Rotate by 90 degrees clockwise and vertically flip, that is:
  14458. @example
  14459. L.R r.R
  14460. . . -> . .
  14461. l.r l.L
  14462. @end example
  14463. @end table
  14464. For values between 4-7, the transposition is only done if the input
  14465. video geometry is portrait and not landscape. These values are
  14466. deprecated, the @code{passthrough} option should be used instead.
  14467. Numerical values are deprecated, and should be dropped in favor of
  14468. symbolic constants.
  14469. @item passthrough
  14470. Do not apply the transposition if the input geometry matches the one
  14471. specified by the specified value. It accepts the following values:
  14472. @table @samp
  14473. @item none
  14474. Always apply transposition.
  14475. @item portrait
  14476. Preserve portrait geometry (when @var{height} >= @var{width}).
  14477. @item landscape
  14478. Preserve landscape geometry (when @var{width} >= @var{height}).
  14479. @end table
  14480. Default value is @code{none}.
  14481. @end table
  14482. For example to rotate by 90 degrees clockwise and preserve portrait
  14483. layout:
  14484. @example
  14485. transpose=dir=1:passthrough=portrait
  14486. @end example
  14487. The command above can also be specified as:
  14488. @example
  14489. transpose=1:portrait
  14490. @end example
  14491. @section transpose_npp
  14492. Transpose rows with columns in the input video and optionally flip it.
  14493. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14494. It accepts the following parameters:
  14495. @table @option
  14496. @item dir
  14497. Specify the transposition direction.
  14498. Can assume the following values:
  14499. @table @samp
  14500. @item cclock_flip
  14501. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14502. @item clock
  14503. Rotate by 90 degrees clockwise.
  14504. @item cclock
  14505. Rotate by 90 degrees counterclockwise.
  14506. @item clock_flip
  14507. Rotate by 90 degrees clockwise and vertically flip.
  14508. @end table
  14509. @item passthrough
  14510. Do not apply the transposition if the input geometry matches the one
  14511. specified by the specified value. It accepts the following values:
  14512. @table @samp
  14513. @item none
  14514. Always apply transposition. (default)
  14515. @item portrait
  14516. Preserve portrait geometry (when @var{height} >= @var{width}).
  14517. @item landscape
  14518. Preserve landscape geometry (when @var{width} >= @var{height}).
  14519. @end table
  14520. @end table
  14521. @section trim
  14522. Trim the input so that the output contains one continuous subpart of the input.
  14523. It accepts the following parameters:
  14524. @table @option
  14525. @item start
  14526. Specify the time of the start of the kept section, i.e. the frame with the
  14527. timestamp @var{start} will be the first frame in the output.
  14528. @item end
  14529. Specify the time of the first frame that will be dropped, i.e. the frame
  14530. immediately preceding the one with the timestamp @var{end} will be the last
  14531. frame in the output.
  14532. @item start_pts
  14533. This is the same as @var{start}, except this option sets the start timestamp
  14534. in timebase units instead of seconds.
  14535. @item end_pts
  14536. This is the same as @var{end}, except this option sets the end timestamp
  14537. in timebase units instead of seconds.
  14538. @item duration
  14539. The maximum duration of the output in seconds.
  14540. @item start_frame
  14541. The number of the first frame that should be passed to the output.
  14542. @item end_frame
  14543. The number of the first frame that should be dropped.
  14544. @end table
  14545. @option{start}, @option{end}, and @option{duration} are expressed as time
  14546. duration specifications; see
  14547. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14548. for the accepted syntax.
  14549. Note that the first two sets of the start/end options and the @option{duration}
  14550. option look at the frame timestamp, while the _frame variants simply count the
  14551. frames that pass through the filter. Also note that this filter does not modify
  14552. the timestamps. If you wish for the output timestamps to start at zero, insert a
  14553. setpts filter after the trim filter.
  14554. If multiple start or end options are set, this filter tries to be greedy and
  14555. keep all the frames that match at least one of the specified constraints. To keep
  14556. only the part that matches all the constraints at once, chain multiple trim
  14557. filters.
  14558. The defaults are such that all the input is kept. So it is possible to set e.g.
  14559. just the end values to keep everything before the specified time.
  14560. Examples:
  14561. @itemize
  14562. @item
  14563. Drop everything except the second minute of input:
  14564. @example
  14565. ffmpeg -i INPUT -vf trim=60:120
  14566. @end example
  14567. @item
  14568. Keep only the first second:
  14569. @example
  14570. ffmpeg -i INPUT -vf trim=duration=1
  14571. @end example
  14572. @end itemize
  14573. @section unpremultiply
  14574. Apply alpha unpremultiply effect to input video stream using first plane
  14575. of second stream as alpha.
  14576. Both streams must have same dimensions and same pixel format.
  14577. The filter accepts the following option:
  14578. @table @option
  14579. @item planes
  14580. Set which planes will be processed, unprocessed planes will be copied.
  14581. By default value 0xf, all planes will be processed.
  14582. If the format has 1 or 2 components, then luma is bit 0.
  14583. If the format has 3 or 4 components:
  14584. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  14585. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  14586. If present, the alpha channel is always the last bit.
  14587. @item inplace
  14588. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14589. @end table
  14590. @anchor{unsharp}
  14591. @section unsharp
  14592. Sharpen or blur the input video.
  14593. It accepts the following parameters:
  14594. @table @option
  14595. @item luma_msize_x, lx
  14596. Set the luma matrix horizontal size. It must be an odd integer between
  14597. 3 and 23. The default value is 5.
  14598. @item luma_msize_y, ly
  14599. Set the luma matrix vertical size. It must be an odd integer between 3
  14600. and 23. The default value is 5.
  14601. @item luma_amount, la
  14602. Set the luma effect strength. It must be a floating point number, reasonable
  14603. values lay between -1.5 and 1.5.
  14604. Negative values will blur the input video, while positive values will
  14605. sharpen it, a value of zero will disable the effect.
  14606. Default value is 1.0.
  14607. @item chroma_msize_x, cx
  14608. Set the chroma matrix horizontal size. It must be an odd integer
  14609. between 3 and 23. The default value is 5.
  14610. @item chroma_msize_y, cy
  14611. Set the chroma matrix vertical size. It must be an odd integer
  14612. between 3 and 23. The default value is 5.
  14613. @item chroma_amount, ca
  14614. Set the chroma effect strength. It must be a floating point number, reasonable
  14615. values lay between -1.5 and 1.5.
  14616. Negative values will blur the input video, while positive values will
  14617. sharpen it, a value of zero will disable the effect.
  14618. Default value is 0.0.
  14619. @end table
  14620. All parameters are optional and default to the equivalent of the
  14621. string '5:5:1.0:5:5:0.0'.
  14622. @subsection Examples
  14623. @itemize
  14624. @item
  14625. Apply strong luma sharpen effect:
  14626. @example
  14627. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  14628. @end example
  14629. @item
  14630. Apply a strong blur of both luma and chroma parameters:
  14631. @example
  14632. unsharp=7:7:-2:7:7:-2
  14633. @end example
  14634. @end itemize
  14635. @anchor{untile}
  14636. @section untile
  14637. Decompose a video made of tiled images into the individual images.
  14638. The frame rate of the output video is the frame rate of the input video
  14639. multiplied by the number of tiles.
  14640. This filter does the reverse of @ref{tile}.
  14641. The filter accepts the following options:
  14642. @table @option
  14643. @item layout
  14644. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14645. this option, check the
  14646. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14647. @end table
  14648. @subsection Examples
  14649. @itemize
  14650. @item
  14651. Produce a 1-second video from a still image file made of 25 frames stacked
  14652. vertically, like an analogic film reel:
  14653. @example
  14654. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  14655. @end example
  14656. @end itemize
  14657. @section uspp
  14658. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  14659. the image at several (or - in the case of @option{quality} level @code{8} - all)
  14660. shifts and average the results.
  14661. The way this differs from the behavior of spp is that uspp actually encodes &
  14662. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  14663. DCT similar to MJPEG.
  14664. The filter accepts the following options:
  14665. @table @option
  14666. @item quality
  14667. Set quality. This option defines the number of levels for averaging. It accepts
  14668. an integer in the range 0-8. If set to @code{0}, the filter will have no
  14669. effect. A value of @code{8} means the higher quality. For each increment of
  14670. that value the speed drops by a factor of approximately 2. Default value is
  14671. @code{3}.
  14672. @item qp
  14673. Force a constant quantization parameter. If not set, the filter will use the QP
  14674. from the video stream (if available).
  14675. @end table
  14676. @section v360
  14677. Convert 360 videos between various formats.
  14678. The filter accepts the following options:
  14679. @table @option
  14680. @item input
  14681. @item output
  14682. Set format of the input/output video.
  14683. Available formats:
  14684. @table @samp
  14685. @item e
  14686. @item equirect
  14687. Equirectangular projection.
  14688. @item c3x2
  14689. @item c6x1
  14690. @item c1x6
  14691. Cubemap with 3x2/6x1/1x6 layout.
  14692. Format specific options:
  14693. @table @option
  14694. @item in_pad
  14695. @item out_pad
  14696. Set padding proportion for the input/output cubemap. Values in decimals.
  14697. Example values:
  14698. @table @samp
  14699. @item 0
  14700. No padding.
  14701. @item 0.01
  14702. 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)
  14703. @end table
  14704. Default value is @b{@samp{0}}.
  14705. Maximum value is @b{@samp{0.1}}.
  14706. @item fin_pad
  14707. @item fout_pad
  14708. Set fixed padding for the input/output cubemap. Values in pixels.
  14709. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  14710. @item in_forder
  14711. @item out_forder
  14712. Set order of faces for the input/output cubemap. Choose one direction for each position.
  14713. Designation of directions:
  14714. @table @samp
  14715. @item r
  14716. right
  14717. @item l
  14718. left
  14719. @item u
  14720. up
  14721. @item d
  14722. down
  14723. @item f
  14724. forward
  14725. @item b
  14726. back
  14727. @end table
  14728. Default value is @b{@samp{rludfb}}.
  14729. @item in_frot
  14730. @item out_frot
  14731. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  14732. Designation of angles:
  14733. @table @samp
  14734. @item 0
  14735. 0 degrees clockwise
  14736. @item 1
  14737. 90 degrees clockwise
  14738. @item 2
  14739. 180 degrees clockwise
  14740. @item 3
  14741. 270 degrees clockwise
  14742. @end table
  14743. Default value is @b{@samp{000000}}.
  14744. @end table
  14745. @item eac
  14746. Equi-Angular Cubemap.
  14747. @item flat
  14748. @item gnomonic
  14749. @item rectilinear
  14750. Regular video.
  14751. Format specific options:
  14752. @table @option
  14753. @item h_fov
  14754. @item v_fov
  14755. @item d_fov
  14756. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14757. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14758. @item ih_fov
  14759. @item iv_fov
  14760. @item id_fov
  14761. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14762. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14763. @end table
  14764. @item dfisheye
  14765. Dual fisheye.
  14766. Format specific options:
  14767. @table @option
  14768. @item h_fov
  14769. @item v_fov
  14770. @item d_fov
  14771. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14772. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14773. @item ih_fov
  14774. @item iv_fov
  14775. @item id_fov
  14776. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14777. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14778. @end table
  14779. @item barrel
  14780. @item fb
  14781. @item barrelsplit
  14782. Facebook's 360 formats.
  14783. @item sg
  14784. Stereographic format.
  14785. Format specific options:
  14786. @table @option
  14787. @item h_fov
  14788. @item v_fov
  14789. @item d_fov
  14790. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14791. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14792. @item ih_fov
  14793. @item iv_fov
  14794. @item id_fov
  14795. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14796. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14797. @end table
  14798. @item mercator
  14799. Mercator format.
  14800. @item ball
  14801. Ball format, gives significant distortion toward the back.
  14802. @item hammer
  14803. Hammer-Aitoff map projection format.
  14804. @item sinusoidal
  14805. Sinusoidal map projection format.
  14806. @item fisheye
  14807. Fisheye projection.
  14808. Format specific options:
  14809. @table @option
  14810. @item h_fov
  14811. @item v_fov
  14812. @item d_fov
  14813. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14814. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14815. @item ih_fov
  14816. @item iv_fov
  14817. @item id_fov
  14818. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14819. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14820. @end table
  14821. @item pannini
  14822. Pannini projection.
  14823. Format specific options:
  14824. @table @option
  14825. @item h_fov
  14826. Set output pannini parameter.
  14827. @item ih_fov
  14828. Set input pannini parameter.
  14829. @end table
  14830. @item cylindrical
  14831. Cylindrical projection.
  14832. Format specific options:
  14833. @table @option
  14834. @item h_fov
  14835. @item v_fov
  14836. @item d_fov
  14837. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14838. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14839. @item ih_fov
  14840. @item iv_fov
  14841. @item id_fov
  14842. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14843. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14844. @end table
  14845. @item perspective
  14846. Perspective projection. @i{(output only)}
  14847. Format specific options:
  14848. @table @option
  14849. @item v_fov
  14850. Set perspective parameter.
  14851. @end table
  14852. @item tetrahedron
  14853. Tetrahedron projection.
  14854. @item tsp
  14855. Truncated square pyramid projection.
  14856. @item he
  14857. @item hequirect
  14858. Half equirectangular projection.
  14859. @item equisolid
  14860. Equisolid format.
  14861. Format specific options:
  14862. @table @option
  14863. @item h_fov
  14864. @item v_fov
  14865. @item d_fov
  14866. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14867. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14868. @item ih_fov
  14869. @item iv_fov
  14870. @item id_fov
  14871. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14872. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14873. @end table
  14874. @item og
  14875. Orthographic format.
  14876. Format specific options:
  14877. @table @option
  14878. @item h_fov
  14879. @item v_fov
  14880. @item d_fov
  14881. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14882. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14883. @item ih_fov
  14884. @item iv_fov
  14885. @item id_fov
  14886. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14887. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14888. @end table
  14889. @item octahedron
  14890. Octahedron projection.
  14891. @end table
  14892. @item interp
  14893. Set interpolation method.@*
  14894. @i{Note: more complex interpolation methods require much more memory to run.}
  14895. Available methods:
  14896. @table @samp
  14897. @item near
  14898. @item nearest
  14899. Nearest neighbour.
  14900. @item line
  14901. @item linear
  14902. Bilinear interpolation.
  14903. @item lagrange9
  14904. Lagrange9 interpolation.
  14905. @item cube
  14906. @item cubic
  14907. Bicubic interpolation.
  14908. @item lanc
  14909. @item lanczos
  14910. Lanczos interpolation.
  14911. @item sp16
  14912. @item spline16
  14913. Spline16 interpolation.
  14914. @item gauss
  14915. @item gaussian
  14916. Gaussian interpolation.
  14917. @item mitchell
  14918. Mitchell interpolation.
  14919. @end table
  14920. Default value is @b{@samp{line}}.
  14921. @item w
  14922. @item h
  14923. Set the output video resolution.
  14924. Default resolution depends on formats.
  14925. @item in_stereo
  14926. @item out_stereo
  14927. Set the input/output stereo format.
  14928. @table @samp
  14929. @item 2d
  14930. 2D mono
  14931. @item sbs
  14932. Side by side
  14933. @item tb
  14934. Top bottom
  14935. @end table
  14936. Default value is @b{@samp{2d}} for input and output format.
  14937. @item yaw
  14938. @item pitch
  14939. @item roll
  14940. Set rotation for the output video. Values in degrees.
  14941. @item rorder
  14942. Set rotation order for the output video. Choose one item for each position.
  14943. @table @samp
  14944. @item y, Y
  14945. yaw
  14946. @item p, P
  14947. pitch
  14948. @item r, R
  14949. roll
  14950. @end table
  14951. Default value is @b{@samp{ypr}}.
  14952. @item h_flip
  14953. @item v_flip
  14954. @item d_flip
  14955. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  14956. @item ih_flip
  14957. @item iv_flip
  14958. Set if input video is flipped horizontally/vertically. Boolean values.
  14959. @item in_trans
  14960. Set if input video is transposed. Boolean value, by default disabled.
  14961. @item out_trans
  14962. Set if output video needs to be transposed. Boolean value, by default disabled.
  14963. @item alpha_mask
  14964. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  14965. @end table
  14966. @subsection Examples
  14967. @itemize
  14968. @item
  14969. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  14970. @example
  14971. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  14972. @end example
  14973. @item
  14974. Extract back view of Equi-Angular Cubemap:
  14975. @example
  14976. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  14977. @end example
  14978. @item
  14979. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  14980. @example
  14981. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  14982. @end example
  14983. @end itemize
  14984. @subsection Commands
  14985. This filter supports subset of above options as @ref{commands}.
  14986. @section vaguedenoiser
  14987. Apply a wavelet based denoiser.
  14988. It transforms each frame from the video input into the wavelet domain,
  14989. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  14990. the obtained coefficients. It does an inverse wavelet transform after.
  14991. Due to wavelet properties, it should give a nice smoothed result, and
  14992. reduced noise, without blurring picture features.
  14993. This filter accepts the following options:
  14994. @table @option
  14995. @item threshold
  14996. The filtering strength. The higher, the more filtered the video will be.
  14997. Hard thresholding can use a higher threshold than soft thresholding
  14998. before the video looks overfiltered. Default value is 2.
  14999. @item method
  15000. The filtering method the filter will use.
  15001. It accepts the following values:
  15002. @table @samp
  15003. @item hard
  15004. All values under the threshold will be zeroed.
  15005. @item soft
  15006. All values under the threshold will be zeroed. All values above will be
  15007. reduced by the threshold.
  15008. @item garrote
  15009. Scales or nullifies coefficients - intermediary between (more) soft and
  15010. (less) hard thresholding.
  15011. @end table
  15012. Default is garrote.
  15013. @item nsteps
  15014. Number of times, the wavelet will decompose the picture. Picture can't
  15015. be decomposed beyond a particular point (typically, 8 for a 640x480
  15016. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  15017. @item percent
  15018. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  15019. @item planes
  15020. A list of the planes to process. By default all planes are processed.
  15021. @item type
  15022. The threshold type the filter will use.
  15023. It accepts the following values:
  15024. @table @samp
  15025. @item universal
  15026. Threshold used is same for all decompositions.
  15027. @item bayes
  15028. Threshold used depends also on each decomposition coefficients.
  15029. @end table
  15030. Default is universal.
  15031. @end table
  15032. @section vectorscope
  15033. Display 2 color component values in the two dimensional graph (which is called
  15034. a vectorscope).
  15035. This filter accepts the following options:
  15036. @table @option
  15037. @item mode, m
  15038. Set vectorscope mode.
  15039. It accepts the following values:
  15040. @table @samp
  15041. @item gray
  15042. @item tint
  15043. Gray values are displayed on graph, higher brightness means more pixels have
  15044. same component color value on location in graph. This is the default mode.
  15045. @item color
  15046. Gray values are displayed on graph. Surrounding pixels values which are not
  15047. present in video frame are drawn in gradient of 2 color components which are
  15048. set by option @code{x} and @code{y}. The 3rd color component is static.
  15049. @item color2
  15050. Actual color components values present in video frame are displayed on graph.
  15051. @item color3
  15052. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  15053. on graph increases value of another color component, which is luminance by
  15054. default values of @code{x} and @code{y}.
  15055. @item color4
  15056. Actual colors present in video frame are displayed on graph. If two different
  15057. colors map to same position on graph then color with higher value of component
  15058. not present in graph is picked.
  15059. @item color5
  15060. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  15061. component picked from radial gradient.
  15062. @end table
  15063. @item x
  15064. Set which color component will be represented on X-axis. Default is @code{1}.
  15065. @item y
  15066. Set which color component will be represented on Y-axis. Default is @code{2}.
  15067. @item intensity, i
  15068. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  15069. of color component which represents frequency of (X, Y) location in graph.
  15070. @item envelope, e
  15071. @table @samp
  15072. @item none
  15073. No envelope, this is default.
  15074. @item instant
  15075. Instant envelope, even darkest single pixel will be clearly highlighted.
  15076. @item peak
  15077. Hold maximum and minimum values presented in graph over time. This way you
  15078. can still spot out of range values without constantly looking at vectorscope.
  15079. @item peak+instant
  15080. Peak and instant envelope combined together.
  15081. @end table
  15082. @item graticule, g
  15083. Set what kind of graticule to draw.
  15084. @table @samp
  15085. @item none
  15086. @item green
  15087. @item color
  15088. @item invert
  15089. @end table
  15090. @item opacity, o
  15091. Set graticule opacity.
  15092. @item flags, f
  15093. Set graticule flags.
  15094. @table @samp
  15095. @item white
  15096. Draw graticule for white point.
  15097. @item black
  15098. Draw graticule for black point.
  15099. @item name
  15100. Draw color points short names.
  15101. @end table
  15102. @item bgopacity, b
  15103. Set background opacity.
  15104. @item lthreshold, l
  15105. Set low threshold for color component not represented on X or Y axis.
  15106. Values lower than this value will be ignored. Default is 0.
  15107. Note this value is multiplied with actual max possible value one pixel component
  15108. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  15109. is 0.1 * 255 = 25.
  15110. @item hthreshold, h
  15111. Set high threshold for color component not represented on X or Y axis.
  15112. Values higher than this value will be ignored. Default is 1.
  15113. Note this value is multiplied with actual max possible value one pixel component
  15114. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  15115. is 0.9 * 255 = 230.
  15116. @item colorspace, c
  15117. Set what kind of colorspace to use when drawing graticule.
  15118. @table @samp
  15119. @item auto
  15120. @item 601
  15121. @item 709
  15122. @end table
  15123. Default is auto.
  15124. @item tint0, t0
  15125. @item tint1, t1
  15126. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  15127. This means no tint, and output will remain gray.
  15128. @end table
  15129. @anchor{vidstabdetect}
  15130. @section vidstabdetect
  15131. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  15132. @ref{vidstabtransform} for pass 2.
  15133. This filter generates a file with relative translation and rotation
  15134. transform information about subsequent frames, which is then used by
  15135. the @ref{vidstabtransform} filter.
  15136. To enable compilation of this filter you need to configure FFmpeg with
  15137. @code{--enable-libvidstab}.
  15138. This filter accepts the following options:
  15139. @table @option
  15140. @item result
  15141. Set the path to the file used to write the transforms information.
  15142. Default value is @file{transforms.trf}.
  15143. @item shakiness
  15144. Set how shaky the video is and how quick the camera is. It accepts an
  15145. integer in the range 1-10, a value of 1 means little shakiness, a
  15146. value of 10 means strong shakiness. Default value is 5.
  15147. @item accuracy
  15148. Set the accuracy of the detection process. It must be a value in the
  15149. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  15150. accuracy. Default value is 15.
  15151. @item stepsize
  15152. Set stepsize of the search process. The region around minimum is
  15153. scanned with 1 pixel resolution. Default value is 6.
  15154. @item mincontrast
  15155. Set minimum contrast. Below this value a local measurement field is
  15156. discarded. Must be a floating point value in the range 0-1. Default
  15157. value is 0.3.
  15158. @item tripod
  15159. Set reference frame number for tripod mode.
  15160. If enabled, the motion of the frames is compared to a reference frame
  15161. in the filtered stream, identified by the specified number. The idea
  15162. is to compensate all movements in a more-or-less static scene and keep
  15163. the camera view absolutely still.
  15164. If set to 0, it is disabled. The frames are counted starting from 1.
  15165. @item show
  15166. Show fields and transforms in the resulting frames. It accepts an
  15167. integer in the range 0-2. Default value is 0, which disables any
  15168. visualization.
  15169. @end table
  15170. @subsection Examples
  15171. @itemize
  15172. @item
  15173. Use default values:
  15174. @example
  15175. vidstabdetect
  15176. @end example
  15177. @item
  15178. Analyze strongly shaky movie and put the results in file
  15179. @file{mytransforms.trf}:
  15180. @example
  15181. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  15182. @end example
  15183. @item
  15184. Visualize the result of internal transformations in the resulting
  15185. video:
  15186. @example
  15187. vidstabdetect=show=1
  15188. @end example
  15189. @item
  15190. Analyze a video with medium shakiness using @command{ffmpeg}:
  15191. @example
  15192. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  15193. @end example
  15194. @end itemize
  15195. @anchor{vidstabtransform}
  15196. @section vidstabtransform
  15197. Video stabilization/deshaking: pass 2 of 2,
  15198. see @ref{vidstabdetect} for pass 1.
  15199. Read a file with transform information for each frame and
  15200. apply/compensate them. Together with the @ref{vidstabdetect}
  15201. filter this can be used to deshake videos. See also
  15202. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  15203. the @ref{unsharp} filter, see below.
  15204. To enable compilation of this filter you need to configure FFmpeg with
  15205. @code{--enable-libvidstab}.
  15206. @subsection Options
  15207. @table @option
  15208. @item input
  15209. Set path to the file used to read the transforms. Default value is
  15210. @file{transforms.trf}.
  15211. @item smoothing
  15212. Set the number of frames (value*2 + 1) used for lowpass filtering the
  15213. camera movements. Default value is 10.
  15214. For example a number of 10 means that 21 frames are used (10 in the
  15215. past and 10 in the future) to smoothen the motion in the video. A
  15216. larger value leads to a smoother video, but limits the acceleration of
  15217. the camera (pan/tilt movements). 0 is a special case where a static
  15218. camera is simulated.
  15219. @item optalgo
  15220. Set the camera path optimization algorithm.
  15221. Accepted values are:
  15222. @table @samp
  15223. @item gauss
  15224. gaussian kernel low-pass filter on camera motion (default)
  15225. @item avg
  15226. averaging on transformations
  15227. @end table
  15228. @item maxshift
  15229. Set maximal number of pixels to translate frames. Default value is -1,
  15230. meaning no limit.
  15231. @item maxangle
  15232. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  15233. value is -1, meaning no limit.
  15234. @item crop
  15235. Specify how to deal with borders that may be visible due to movement
  15236. compensation.
  15237. Available values are:
  15238. @table @samp
  15239. @item keep
  15240. keep image information from previous frame (default)
  15241. @item black
  15242. fill the border black
  15243. @end table
  15244. @item invert
  15245. Invert transforms if set to 1. Default value is 0.
  15246. @item relative
  15247. Consider transforms as relative to previous frame if set to 1,
  15248. absolute if set to 0. Default value is 0.
  15249. @item zoom
  15250. Set percentage to zoom. A positive value will result in a zoom-in
  15251. effect, a negative value in a zoom-out effect. Default value is 0 (no
  15252. zoom).
  15253. @item optzoom
  15254. Set optimal zooming to avoid borders.
  15255. Accepted values are:
  15256. @table @samp
  15257. @item 0
  15258. disabled
  15259. @item 1
  15260. optimal static zoom value is determined (only very strong movements
  15261. will lead to visible borders) (default)
  15262. @item 2
  15263. optimal adaptive zoom value is determined (no borders will be
  15264. visible), see @option{zoomspeed}
  15265. @end table
  15266. Note that the value given at zoom is added to the one calculated here.
  15267. @item zoomspeed
  15268. Set percent to zoom maximally each frame (enabled when
  15269. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  15270. 0.25.
  15271. @item interpol
  15272. Specify type of interpolation.
  15273. Available values are:
  15274. @table @samp
  15275. @item no
  15276. no interpolation
  15277. @item linear
  15278. linear only horizontal
  15279. @item bilinear
  15280. linear in both directions (default)
  15281. @item bicubic
  15282. cubic in both directions (slow)
  15283. @end table
  15284. @item tripod
  15285. Enable virtual tripod mode if set to 1, which is equivalent to
  15286. @code{relative=0:smoothing=0}. Default value is 0.
  15287. Use also @code{tripod} option of @ref{vidstabdetect}.
  15288. @item debug
  15289. Increase log verbosity if set to 1. Also the detected global motions
  15290. are written to the temporary file @file{global_motions.trf}. Default
  15291. value is 0.
  15292. @end table
  15293. @subsection Examples
  15294. @itemize
  15295. @item
  15296. Use @command{ffmpeg} for a typical stabilization with default values:
  15297. @example
  15298. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  15299. @end example
  15300. Note the use of the @ref{unsharp} filter which is always recommended.
  15301. @item
  15302. Zoom in a bit more and load transform data from a given file:
  15303. @example
  15304. vidstabtransform=zoom=5:input="mytransforms.trf"
  15305. @end example
  15306. @item
  15307. Smoothen the video even more:
  15308. @example
  15309. vidstabtransform=smoothing=30
  15310. @end example
  15311. @end itemize
  15312. @section vflip
  15313. Flip the input video vertically.
  15314. For example, to vertically flip a video with @command{ffmpeg}:
  15315. @example
  15316. ffmpeg -i in.avi -vf "vflip" out.avi
  15317. @end example
  15318. @section vfrdet
  15319. Detect variable frame rate video.
  15320. This filter tries to detect if the input is variable or constant frame rate.
  15321. At end it will output number of frames detected as having variable delta pts,
  15322. and ones with constant delta pts.
  15323. If there was frames with variable delta, than it will also show min, max and
  15324. average delta encountered.
  15325. @section vibrance
  15326. Boost or alter saturation.
  15327. The filter accepts the following options:
  15328. @table @option
  15329. @item intensity
  15330. Set strength of boost if positive value or strength of alter if negative value.
  15331. Default is 0. Allowed range is from -2 to 2.
  15332. @item rbal
  15333. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  15334. @item gbal
  15335. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  15336. @item bbal
  15337. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  15338. @item rlum
  15339. Set the red luma coefficient.
  15340. @item glum
  15341. Set the green luma coefficient.
  15342. @item blum
  15343. Set the blue luma coefficient.
  15344. @item alternate
  15345. If @code{intensity} is negative and this is set to 1, colors will change,
  15346. otherwise colors will be less saturated, more towards gray.
  15347. @end table
  15348. @subsection Commands
  15349. This filter supports the all above options as @ref{commands}.
  15350. @anchor{vignette}
  15351. @section vignette
  15352. Make or reverse a natural vignetting effect.
  15353. The filter accepts the following options:
  15354. @table @option
  15355. @item angle, a
  15356. Set lens angle expression as a number of radians.
  15357. The value is clipped in the @code{[0,PI/2]} range.
  15358. Default value: @code{"PI/5"}
  15359. @item x0
  15360. @item y0
  15361. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  15362. by default.
  15363. @item mode
  15364. Set forward/backward mode.
  15365. Available modes are:
  15366. @table @samp
  15367. @item forward
  15368. The larger the distance from the central point, the darker the image becomes.
  15369. @item backward
  15370. The larger the distance from the central point, the brighter the image becomes.
  15371. This can be used to reverse a vignette effect, though there is no automatic
  15372. detection to extract the lens @option{angle} and other settings (yet). It can
  15373. also be used to create a burning effect.
  15374. @end table
  15375. Default value is @samp{forward}.
  15376. @item eval
  15377. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  15378. It accepts the following values:
  15379. @table @samp
  15380. @item init
  15381. Evaluate expressions only once during the filter initialization.
  15382. @item frame
  15383. Evaluate expressions for each incoming frame. This is way slower than the
  15384. @samp{init} mode since it requires all the scalers to be re-computed, but it
  15385. allows advanced dynamic expressions.
  15386. @end table
  15387. Default value is @samp{init}.
  15388. @item dither
  15389. Set dithering to reduce the circular banding effects. Default is @code{1}
  15390. (enabled).
  15391. @item aspect
  15392. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  15393. Setting this value to the SAR of the input will make a rectangular vignetting
  15394. following the dimensions of the video.
  15395. Default is @code{1/1}.
  15396. @end table
  15397. @subsection Expressions
  15398. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  15399. following parameters.
  15400. @table @option
  15401. @item w
  15402. @item h
  15403. input width and height
  15404. @item n
  15405. the number of input frame, starting from 0
  15406. @item pts
  15407. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  15408. @var{TB} units, NAN if undefined
  15409. @item r
  15410. frame rate of the input video, NAN if the input frame rate is unknown
  15411. @item t
  15412. the PTS (Presentation TimeStamp) of the filtered video frame,
  15413. expressed in seconds, NAN if undefined
  15414. @item tb
  15415. time base of the input video
  15416. @end table
  15417. @subsection Examples
  15418. @itemize
  15419. @item
  15420. Apply simple strong vignetting effect:
  15421. @example
  15422. vignette=PI/4
  15423. @end example
  15424. @item
  15425. Make a flickering vignetting:
  15426. @example
  15427. vignette='PI/4+random(1)*PI/50':eval=frame
  15428. @end example
  15429. @end itemize
  15430. @section vmafmotion
  15431. Obtain the average VMAF motion score of a video.
  15432. It is one of the component metrics of VMAF.
  15433. The obtained average motion score is printed through the logging system.
  15434. The filter accepts the following options:
  15435. @table @option
  15436. @item stats_file
  15437. If specified, the filter will use the named file to save the motion score of
  15438. each frame with respect to the previous frame.
  15439. When filename equals "-" the data is sent to standard output.
  15440. @end table
  15441. Example:
  15442. @example
  15443. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  15444. @end example
  15445. @section vstack
  15446. Stack input videos vertically.
  15447. All streams must be of same pixel format and of same width.
  15448. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  15449. to create same output.
  15450. The filter accepts the following options:
  15451. @table @option
  15452. @item inputs
  15453. Set number of input streams. Default is 2.
  15454. @item shortest
  15455. If set to 1, force the output to terminate when the shortest input
  15456. terminates. Default value is 0.
  15457. @end table
  15458. @section w3fdif
  15459. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  15460. Deinterlacing Filter").
  15461. Based on the process described by Martin Weston for BBC R&D, and
  15462. implemented based on the de-interlace algorithm written by Jim
  15463. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  15464. uses filter coefficients calculated by BBC R&D.
  15465. This filter uses field-dominance information in frame to decide which
  15466. of each pair of fields to place first in the output.
  15467. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  15468. There are two sets of filter coefficients, so called "simple"
  15469. and "complex". Which set of filter coefficients is used can
  15470. be set by passing an optional parameter:
  15471. @table @option
  15472. @item filter
  15473. Set the interlacing filter coefficients. Accepts one of the following values:
  15474. @table @samp
  15475. @item simple
  15476. Simple filter coefficient set.
  15477. @item complex
  15478. More-complex filter coefficient set.
  15479. @end table
  15480. Default value is @samp{complex}.
  15481. @item deint
  15482. Specify which frames to deinterlace. Accepts one of the following values:
  15483. @table @samp
  15484. @item all
  15485. Deinterlace all frames,
  15486. @item interlaced
  15487. Only deinterlace frames marked as interlaced.
  15488. @end table
  15489. Default value is @samp{all}.
  15490. @end table
  15491. @section waveform
  15492. Video waveform monitor.
  15493. The waveform monitor plots color component intensity. By default luminance
  15494. only. Each column of the waveform corresponds to a column of pixels in the
  15495. source video.
  15496. It accepts the following options:
  15497. @table @option
  15498. @item mode, m
  15499. Can be either @code{row}, or @code{column}. Default is @code{column}.
  15500. In row mode, the graph on the left side represents color component value 0 and
  15501. the right side represents value = 255. In column mode, the top side represents
  15502. color component value = 0 and bottom side represents value = 255.
  15503. @item intensity, i
  15504. Set intensity. Smaller values are useful to find out how many values of the same
  15505. luminance are distributed across input rows/columns.
  15506. Default value is @code{0.04}. Allowed range is [0, 1].
  15507. @item mirror, r
  15508. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  15509. In mirrored mode, higher values will be represented on the left
  15510. side for @code{row} mode and at the top for @code{column} mode. Default is
  15511. @code{1} (mirrored).
  15512. @item display, d
  15513. Set display mode.
  15514. It accepts the following values:
  15515. @table @samp
  15516. @item overlay
  15517. Presents information identical to that in the @code{parade}, except
  15518. that the graphs representing color components are superimposed directly
  15519. over one another.
  15520. This display mode makes it easier to spot relative differences or similarities
  15521. in overlapping areas of the color components that are supposed to be identical,
  15522. such as neutral whites, grays, or blacks.
  15523. @item stack
  15524. Display separate graph for the color components side by side in
  15525. @code{row} mode or one below the other in @code{column} mode.
  15526. @item parade
  15527. Display separate graph for the color components side by side in
  15528. @code{column} mode or one below the other in @code{row} mode.
  15529. Using this display mode makes it easy to spot color casts in the highlights
  15530. and shadows of an image, by comparing the contours of the top and the bottom
  15531. graphs of each waveform. Since whites, grays, and blacks are characterized
  15532. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  15533. should display three waveforms of roughly equal width/height. If not, the
  15534. correction is easy to perform by making level adjustments the three waveforms.
  15535. @end table
  15536. Default is @code{stack}.
  15537. @item components, c
  15538. Set which color components to display. Default is 1, which means only luminance
  15539. or red color component if input is in RGB colorspace. If is set for example to
  15540. 7 it will display all 3 (if) available color components.
  15541. @item envelope, e
  15542. @table @samp
  15543. @item none
  15544. No envelope, this is default.
  15545. @item instant
  15546. Instant envelope, minimum and maximum values presented in graph will be easily
  15547. visible even with small @code{step} value.
  15548. @item peak
  15549. Hold minimum and maximum values presented in graph across time. This way you
  15550. can still spot out of range values without constantly looking at waveforms.
  15551. @item peak+instant
  15552. Peak and instant envelope combined together.
  15553. @end table
  15554. @item filter, f
  15555. @table @samp
  15556. @item lowpass
  15557. No filtering, this is default.
  15558. @item flat
  15559. Luma and chroma combined together.
  15560. @item aflat
  15561. Similar as above, but shows difference between blue and red chroma.
  15562. @item xflat
  15563. Similar as above, but use different colors.
  15564. @item yflat
  15565. Similar as above, but again with different colors.
  15566. @item chroma
  15567. Displays only chroma.
  15568. @item color
  15569. Displays actual color value on waveform.
  15570. @item acolor
  15571. Similar as above, but with luma showing frequency of chroma values.
  15572. @end table
  15573. @item graticule, g
  15574. Set which graticule to display.
  15575. @table @samp
  15576. @item none
  15577. Do not display graticule.
  15578. @item green
  15579. Display green graticule showing legal broadcast ranges.
  15580. @item orange
  15581. Display orange graticule showing legal broadcast ranges.
  15582. @item invert
  15583. Display invert graticule showing legal broadcast ranges.
  15584. @end table
  15585. @item opacity, o
  15586. Set graticule opacity.
  15587. @item flags, fl
  15588. Set graticule flags.
  15589. @table @samp
  15590. @item numbers
  15591. Draw numbers above lines. By default enabled.
  15592. @item dots
  15593. Draw dots instead of lines.
  15594. @end table
  15595. @item scale, s
  15596. Set scale used for displaying graticule.
  15597. @table @samp
  15598. @item digital
  15599. @item millivolts
  15600. @item ire
  15601. @end table
  15602. Default is digital.
  15603. @item bgopacity, b
  15604. Set background opacity.
  15605. @item tint0, t0
  15606. @item tint1, t1
  15607. Set tint for output.
  15608. Only used with lowpass filter and when display is not overlay and input
  15609. pixel formats are not RGB.
  15610. @end table
  15611. @section weave, doubleweave
  15612. The @code{weave} takes a field-based video input and join
  15613. each two sequential fields into single frame, producing a new double
  15614. height clip with half the frame rate and half the frame count.
  15615. The @code{doubleweave} works same as @code{weave} but without
  15616. halving frame rate and frame count.
  15617. It accepts the following option:
  15618. @table @option
  15619. @item first_field
  15620. Set first field. Available values are:
  15621. @table @samp
  15622. @item top, t
  15623. Set the frame as top-field-first.
  15624. @item bottom, b
  15625. Set the frame as bottom-field-first.
  15626. @end table
  15627. @end table
  15628. @subsection Examples
  15629. @itemize
  15630. @item
  15631. Interlace video using @ref{select} and @ref{separatefields} filter:
  15632. @example
  15633. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  15634. @end example
  15635. @end itemize
  15636. @section xbr
  15637. Apply the xBR high-quality magnification filter which is designed for pixel
  15638. art. It follows a set of edge-detection rules, see
  15639. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  15640. It accepts the following option:
  15641. @table @option
  15642. @item n
  15643. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  15644. @code{3xBR} and @code{4} for @code{4xBR}.
  15645. Default is @code{3}.
  15646. @end table
  15647. @section xfade
  15648. Apply cross fade from one input video stream to another input video stream.
  15649. The cross fade is applied for specified duration.
  15650. The filter accepts the following options:
  15651. @table @option
  15652. @item transition
  15653. Set one of available transition effects:
  15654. @table @samp
  15655. @item custom
  15656. @item fade
  15657. @item wipeleft
  15658. @item wiperight
  15659. @item wipeup
  15660. @item wipedown
  15661. @item slideleft
  15662. @item slideright
  15663. @item slideup
  15664. @item slidedown
  15665. @item circlecrop
  15666. @item rectcrop
  15667. @item distance
  15668. @item fadeblack
  15669. @item fadewhite
  15670. @item radial
  15671. @item smoothleft
  15672. @item smoothright
  15673. @item smoothup
  15674. @item smoothdown
  15675. @item circleopen
  15676. @item circleclose
  15677. @item vertopen
  15678. @item vertclose
  15679. @item horzopen
  15680. @item horzclose
  15681. @item dissolve
  15682. @item pixelize
  15683. @item diagtl
  15684. @item diagtr
  15685. @item diagbl
  15686. @item diagbr
  15687. @item hlslice
  15688. @item hrslice
  15689. @item vuslice
  15690. @item vdslice
  15691. @item hblur
  15692. @item fadegrays
  15693. @item wipetl
  15694. @item wipetr
  15695. @item wipebl
  15696. @item wipebr
  15697. @end table
  15698. Default transition effect is fade.
  15699. @item duration
  15700. Set cross fade duration in seconds.
  15701. Default duration is 1 second.
  15702. @item offset
  15703. Set cross fade start relative to first input stream in seconds.
  15704. Default offset is 0.
  15705. @item expr
  15706. Set expression for custom transition effect.
  15707. The expressions can use the following variables and functions:
  15708. @table @option
  15709. @item X
  15710. @item Y
  15711. The coordinates of the current sample.
  15712. @item W
  15713. @item H
  15714. The width and height of the image.
  15715. @item P
  15716. Progress of transition effect.
  15717. @item PLANE
  15718. Currently processed plane.
  15719. @item A
  15720. Return value of first input at current location and plane.
  15721. @item B
  15722. Return value of second input at current location and plane.
  15723. @item a0(x, y)
  15724. @item a1(x, y)
  15725. @item a2(x, y)
  15726. @item a3(x, y)
  15727. Return the value of the pixel at location (@var{x},@var{y}) of the
  15728. first/second/third/fourth component of first input.
  15729. @item b0(x, y)
  15730. @item b1(x, y)
  15731. @item b2(x, y)
  15732. @item b3(x, y)
  15733. Return the value of the pixel at location (@var{x},@var{y}) of the
  15734. first/second/third/fourth component of second input.
  15735. @end table
  15736. @end table
  15737. @subsection Examples
  15738. @itemize
  15739. @item
  15740. Cross fade from one input video to another input video, with fade transition and duration of transition
  15741. of 2 seconds starting at offset of 5 seconds:
  15742. @example
  15743. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  15744. @end example
  15745. @end itemize
  15746. @section xmedian
  15747. Pick median pixels from several input videos.
  15748. The filter accepts the following options:
  15749. @table @option
  15750. @item inputs
  15751. Set number of inputs.
  15752. Default is 3. Allowed range is from 3 to 255.
  15753. If number of inputs is even number, than result will be mean value between two median values.
  15754. @item planes
  15755. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  15756. @item percentile
  15757. Set median percentile. Default value is @code{0.5}.
  15758. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  15759. minimum values, and @code{1} maximum values.
  15760. @end table
  15761. @section xstack
  15762. Stack video inputs into custom layout.
  15763. All streams must be of same pixel format.
  15764. The filter accepts the following options:
  15765. @table @option
  15766. @item inputs
  15767. Set number of input streams. Default is 2.
  15768. @item layout
  15769. Specify layout of inputs.
  15770. This option requires the desired layout configuration to be explicitly set by the user.
  15771. This sets position of each video input in output. Each input
  15772. is separated by '|'.
  15773. The first number represents the column, and the second number represents the row.
  15774. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  15775. where X is video input from which to take width or height.
  15776. Multiple values can be used when separated by '+'. In such
  15777. case values are summed together.
  15778. Note that if inputs are of different sizes gaps may appear, as not all of
  15779. the output video frame will be filled. Similarly, videos can overlap each
  15780. other if their position doesn't leave enough space for the full frame of
  15781. adjoining videos.
  15782. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  15783. a layout must be set by the user.
  15784. @item shortest
  15785. If set to 1, force the output to terminate when the shortest input
  15786. terminates. Default value is 0.
  15787. @item fill
  15788. If set to valid color, all unused pixels will be filled with that color.
  15789. By default fill is set to none, so it is disabled.
  15790. @end table
  15791. @subsection Examples
  15792. @itemize
  15793. @item
  15794. Display 4 inputs into 2x2 grid.
  15795. Layout:
  15796. @example
  15797. input1(0, 0) | input3(w0, 0)
  15798. input2(0, h0) | input4(w0, h0)
  15799. @end example
  15800. @example
  15801. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  15802. @end example
  15803. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15804. @item
  15805. Display 4 inputs into 1x4 grid.
  15806. Layout:
  15807. @example
  15808. input1(0, 0)
  15809. input2(0, h0)
  15810. input3(0, h0+h1)
  15811. input4(0, h0+h1+h2)
  15812. @end example
  15813. @example
  15814. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  15815. @end example
  15816. Note that if inputs are of different widths, unused space will appear.
  15817. @item
  15818. Display 9 inputs into 3x3 grid.
  15819. Layout:
  15820. @example
  15821. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  15822. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  15823. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  15824. @end example
  15825. @example
  15826. 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
  15827. @end example
  15828. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15829. @item
  15830. Display 16 inputs into 4x4 grid.
  15831. Layout:
  15832. @example
  15833. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  15834. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  15835. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  15836. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  15837. @end example
  15838. @example
  15839. 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|
  15840. 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
  15841. @end example
  15842. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15843. @end itemize
  15844. @anchor{yadif}
  15845. @section yadif
  15846. Deinterlace the input video ("yadif" means "yet another deinterlacing
  15847. filter").
  15848. It accepts the following parameters:
  15849. @table @option
  15850. @item mode
  15851. The interlacing mode to adopt. It accepts one of the following values:
  15852. @table @option
  15853. @item 0, send_frame
  15854. Output one frame for each frame.
  15855. @item 1, send_field
  15856. Output one frame for each field.
  15857. @item 2, send_frame_nospatial
  15858. Like @code{send_frame}, but it skips the spatial interlacing check.
  15859. @item 3, send_field_nospatial
  15860. Like @code{send_field}, but it skips the spatial interlacing check.
  15861. @end table
  15862. The default value is @code{send_frame}.
  15863. @item parity
  15864. The picture field parity assumed for the input interlaced video. It accepts one
  15865. of the following values:
  15866. @table @option
  15867. @item 0, tff
  15868. Assume the top field is first.
  15869. @item 1, bff
  15870. Assume the bottom field is first.
  15871. @item -1, auto
  15872. Enable automatic detection of field parity.
  15873. @end table
  15874. The default value is @code{auto}.
  15875. If the interlacing is unknown or the decoder does not export this information,
  15876. top field first will be assumed.
  15877. @item deint
  15878. Specify which frames to deinterlace. Accepts one of the following
  15879. values:
  15880. @table @option
  15881. @item 0, all
  15882. Deinterlace all frames.
  15883. @item 1, interlaced
  15884. Only deinterlace frames marked as interlaced.
  15885. @end table
  15886. The default value is @code{all}.
  15887. @end table
  15888. @section yadif_cuda
  15889. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  15890. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  15891. and/or nvenc.
  15892. It accepts the following parameters:
  15893. @table @option
  15894. @item mode
  15895. The interlacing mode to adopt. It accepts one of the following values:
  15896. @table @option
  15897. @item 0, send_frame
  15898. Output one frame for each frame.
  15899. @item 1, send_field
  15900. Output one frame for each field.
  15901. @item 2, send_frame_nospatial
  15902. Like @code{send_frame}, but it skips the spatial interlacing check.
  15903. @item 3, send_field_nospatial
  15904. Like @code{send_field}, but it skips the spatial interlacing check.
  15905. @end table
  15906. The default value is @code{send_frame}.
  15907. @item parity
  15908. The picture field parity assumed for the input interlaced video. It accepts one
  15909. of the following values:
  15910. @table @option
  15911. @item 0, tff
  15912. Assume the top field is first.
  15913. @item 1, bff
  15914. Assume the bottom field is first.
  15915. @item -1, auto
  15916. Enable automatic detection of field parity.
  15917. @end table
  15918. The default value is @code{auto}.
  15919. If the interlacing is unknown or the decoder does not export this information,
  15920. top field first will be assumed.
  15921. @item deint
  15922. Specify which frames to deinterlace. Accepts one of the following
  15923. values:
  15924. @table @option
  15925. @item 0, all
  15926. Deinterlace all frames.
  15927. @item 1, interlaced
  15928. Only deinterlace frames marked as interlaced.
  15929. @end table
  15930. The default value is @code{all}.
  15931. @end table
  15932. @section yaepblur
  15933. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  15934. The algorithm is described in
  15935. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  15936. It accepts the following parameters:
  15937. @table @option
  15938. @item radius, r
  15939. Set the window radius. Default value is 3.
  15940. @item planes, p
  15941. Set which planes to filter. Default is only the first plane.
  15942. @item sigma, s
  15943. Set blur strength. Default value is 128.
  15944. @end table
  15945. @subsection Commands
  15946. This filter supports same @ref{commands} as options.
  15947. @section zoompan
  15948. Apply Zoom & Pan effect.
  15949. This filter accepts the following options:
  15950. @table @option
  15951. @item zoom, z
  15952. Set the zoom expression. Range is 1-10. Default is 1.
  15953. @item x
  15954. @item y
  15955. Set the x and y expression. Default is 0.
  15956. @item d
  15957. Set the duration expression in number of frames.
  15958. This sets for how many number of frames effect will last for
  15959. single input image.
  15960. @item s
  15961. Set the output image size, default is 'hd720'.
  15962. @item fps
  15963. Set the output frame rate, default is '25'.
  15964. @end table
  15965. Each expression can contain the following constants:
  15966. @table @option
  15967. @item in_w, iw
  15968. Input width.
  15969. @item in_h, ih
  15970. Input height.
  15971. @item out_w, ow
  15972. Output width.
  15973. @item out_h, oh
  15974. Output height.
  15975. @item in
  15976. Input frame count.
  15977. @item on
  15978. Output frame count.
  15979. @item in_time, it
  15980. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  15981. @item out_time, time, ot
  15982. The output timestamp expressed in seconds.
  15983. @item x
  15984. @item y
  15985. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  15986. for current input frame.
  15987. @item px
  15988. @item py
  15989. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  15990. not yet such frame (first input frame).
  15991. @item zoom
  15992. Last calculated zoom from 'z' expression for current input frame.
  15993. @item pzoom
  15994. Last calculated zoom of last output frame of previous input frame.
  15995. @item duration
  15996. Number of output frames for current input frame. Calculated from 'd' expression
  15997. for each input frame.
  15998. @item pduration
  15999. number of output frames created for previous input frame
  16000. @item a
  16001. Rational number: input width / input height
  16002. @item sar
  16003. sample aspect ratio
  16004. @item dar
  16005. display aspect ratio
  16006. @end table
  16007. @subsection Examples
  16008. @itemize
  16009. @item
  16010. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  16011. @example
  16012. 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
  16013. @end example
  16014. @item
  16015. Zoom in up to 1.5x and pan always at center of picture:
  16016. @example
  16017. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16018. @end example
  16019. @item
  16020. Same as above but without pausing:
  16021. @example
  16022. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16023. @end example
  16024. @item
  16025. Zoom in 2x into center of picture only for the first second of the input video:
  16026. @example
  16027. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16028. @end example
  16029. @end itemize
  16030. @anchor{zscale}
  16031. @section zscale
  16032. Scale (resize) the input video, using the z.lib library:
  16033. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  16034. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  16035. The zscale filter forces the output display aspect ratio to be the same
  16036. as the input, by changing the output sample aspect ratio.
  16037. If the input image format is different from the format requested by
  16038. the next filter, the zscale filter will convert the input to the
  16039. requested format.
  16040. @subsection Options
  16041. The filter accepts the following options.
  16042. @table @option
  16043. @item width, w
  16044. @item height, h
  16045. Set the output video dimension expression. Default value is the input
  16046. dimension.
  16047. If the @var{width} or @var{w} value is 0, the input width is used for
  16048. the output. If the @var{height} or @var{h} value is 0, the input height
  16049. is used for the output.
  16050. If one and only one of the values is -n with n >= 1, the zscale filter
  16051. will use a value that maintains the aspect ratio of the input image,
  16052. calculated from the other specified dimension. After that it will,
  16053. however, make sure that the calculated dimension is divisible by n and
  16054. adjust the value if necessary.
  16055. If both values are -n with n >= 1, the behavior will be identical to
  16056. both values being set to 0 as previously detailed.
  16057. See below for the list of accepted constants for use in the dimension
  16058. expression.
  16059. @item size, s
  16060. Set the video size. For the syntax of this option, check the
  16061. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16062. @item dither, d
  16063. Set the dither type.
  16064. Possible values are:
  16065. @table @var
  16066. @item none
  16067. @item ordered
  16068. @item random
  16069. @item error_diffusion
  16070. @end table
  16071. Default is none.
  16072. @item filter, f
  16073. Set the resize filter type.
  16074. Possible values are:
  16075. @table @var
  16076. @item point
  16077. @item bilinear
  16078. @item bicubic
  16079. @item spline16
  16080. @item spline36
  16081. @item lanczos
  16082. @end table
  16083. Default is bilinear.
  16084. @item range, r
  16085. Set the color range.
  16086. Possible values are:
  16087. @table @var
  16088. @item input
  16089. @item limited
  16090. @item full
  16091. @end table
  16092. Default is same as input.
  16093. @item primaries, p
  16094. Set the color primaries.
  16095. Possible values are:
  16096. @table @var
  16097. @item input
  16098. @item 709
  16099. @item unspecified
  16100. @item 170m
  16101. @item 240m
  16102. @item 2020
  16103. @end table
  16104. Default is same as input.
  16105. @item transfer, t
  16106. Set the transfer characteristics.
  16107. Possible values are:
  16108. @table @var
  16109. @item input
  16110. @item 709
  16111. @item unspecified
  16112. @item 601
  16113. @item linear
  16114. @item 2020_10
  16115. @item 2020_12
  16116. @item smpte2084
  16117. @item iec61966-2-1
  16118. @item arib-std-b67
  16119. @end table
  16120. Default is same as input.
  16121. @item matrix, m
  16122. Set the colorspace matrix.
  16123. Possible value are:
  16124. @table @var
  16125. @item input
  16126. @item 709
  16127. @item unspecified
  16128. @item 470bg
  16129. @item 170m
  16130. @item 2020_ncl
  16131. @item 2020_cl
  16132. @end table
  16133. Default is same as input.
  16134. @item rangein, rin
  16135. Set the input color range.
  16136. Possible values are:
  16137. @table @var
  16138. @item input
  16139. @item limited
  16140. @item full
  16141. @end table
  16142. Default is same as input.
  16143. @item primariesin, pin
  16144. Set the input color primaries.
  16145. Possible values are:
  16146. @table @var
  16147. @item input
  16148. @item 709
  16149. @item unspecified
  16150. @item 170m
  16151. @item 240m
  16152. @item 2020
  16153. @end table
  16154. Default is same as input.
  16155. @item transferin, tin
  16156. Set the input transfer characteristics.
  16157. Possible values are:
  16158. @table @var
  16159. @item input
  16160. @item 709
  16161. @item unspecified
  16162. @item 601
  16163. @item linear
  16164. @item 2020_10
  16165. @item 2020_12
  16166. @end table
  16167. Default is same as input.
  16168. @item matrixin, min
  16169. Set the input colorspace matrix.
  16170. Possible value are:
  16171. @table @var
  16172. @item input
  16173. @item 709
  16174. @item unspecified
  16175. @item 470bg
  16176. @item 170m
  16177. @item 2020_ncl
  16178. @item 2020_cl
  16179. @end table
  16180. @item chromal, c
  16181. Set the output chroma location.
  16182. Possible values are:
  16183. @table @var
  16184. @item input
  16185. @item left
  16186. @item center
  16187. @item topleft
  16188. @item top
  16189. @item bottomleft
  16190. @item bottom
  16191. @end table
  16192. @item chromalin, cin
  16193. Set the input chroma location.
  16194. Possible values are:
  16195. @table @var
  16196. @item input
  16197. @item left
  16198. @item center
  16199. @item topleft
  16200. @item top
  16201. @item bottomleft
  16202. @item bottom
  16203. @end table
  16204. @item npl
  16205. Set the nominal peak luminance.
  16206. @end table
  16207. The values of the @option{w} and @option{h} options are expressions
  16208. containing the following constants:
  16209. @table @var
  16210. @item in_w
  16211. @item in_h
  16212. The input width and height
  16213. @item iw
  16214. @item ih
  16215. These are the same as @var{in_w} and @var{in_h}.
  16216. @item out_w
  16217. @item out_h
  16218. The output (scaled) width and height
  16219. @item ow
  16220. @item oh
  16221. These are the same as @var{out_w} and @var{out_h}
  16222. @item a
  16223. The same as @var{iw} / @var{ih}
  16224. @item sar
  16225. input sample aspect ratio
  16226. @item dar
  16227. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16228. @item hsub
  16229. @item vsub
  16230. horizontal and vertical input chroma subsample values. For example for the
  16231. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16232. @item ohsub
  16233. @item ovsub
  16234. horizontal and vertical output chroma subsample values. For example for the
  16235. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16236. @end table
  16237. @subsection Commands
  16238. This filter supports the following commands:
  16239. @table @option
  16240. @item width, w
  16241. @item height, h
  16242. Set the output video dimension expression.
  16243. The command accepts the same syntax of the corresponding option.
  16244. If the specified expression is not valid, it is kept at its current
  16245. value.
  16246. @end table
  16247. @c man end VIDEO FILTERS
  16248. @chapter OpenCL Video Filters
  16249. @c man begin OPENCL VIDEO FILTERS
  16250. Below is a description of the currently available OpenCL video filters.
  16251. To enable compilation of these filters you need to configure FFmpeg with
  16252. @code{--enable-opencl}.
  16253. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  16254. @table @option
  16255. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  16256. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  16257. given device parameters.
  16258. @item -filter_hw_device @var{name}
  16259. Pass the hardware device called @var{name} to all filters in any filter graph.
  16260. @end table
  16261. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  16262. @itemize
  16263. @item
  16264. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  16265. @example
  16266. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  16267. @end example
  16268. @end itemize
  16269. 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.
  16270. @section avgblur_opencl
  16271. Apply average blur filter.
  16272. The filter accepts the following options:
  16273. @table @option
  16274. @item sizeX
  16275. Set horizontal radius size.
  16276. Range is @code{[1, 1024]} and default value is @code{1}.
  16277. @item planes
  16278. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16279. @item sizeY
  16280. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  16281. @end table
  16282. @subsection Example
  16283. @itemize
  16284. @item
  16285. 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.
  16286. @example
  16287. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  16288. @end example
  16289. @end itemize
  16290. @section boxblur_opencl
  16291. Apply a boxblur algorithm to the input video.
  16292. It accepts the following parameters:
  16293. @table @option
  16294. @item luma_radius, lr
  16295. @item luma_power, lp
  16296. @item chroma_radius, cr
  16297. @item chroma_power, cp
  16298. @item alpha_radius, ar
  16299. @item alpha_power, ap
  16300. @end table
  16301. A description of the accepted options follows.
  16302. @table @option
  16303. @item luma_radius, lr
  16304. @item chroma_radius, cr
  16305. @item alpha_radius, ar
  16306. Set an expression for the box radius in pixels used for blurring the
  16307. corresponding input plane.
  16308. The radius value must be a non-negative number, and must not be
  16309. greater than the value of the expression @code{min(w,h)/2} for the
  16310. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  16311. planes.
  16312. Default value for @option{luma_radius} is "2". If not specified,
  16313. @option{chroma_radius} and @option{alpha_radius} default to the
  16314. corresponding value set for @option{luma_radius}.
  16315. The expressions can contain the following constants:
  16316. @table @option
  16317. @item w
  16318. @item h
  16319. The input width and height in pixels.
  16320. @item cw
  16321. @item ch
  16322. The input chroma image width and height in pixels.
  16323. @item hsub
  16324. @item vsub
  16325. The horizontal and vertical chroma subsample values. For example, for the
  16326. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  16327. @end table
  16328. @item luma_power, lp
  16329. @item chroma_power, cp
  16330. @item alpha_power, ap
  16331. Specify how many times the boxblur filter is applied to the
  16332. corresponding plane.
  16333. Default value for @option{luma_power} is 2. If not specified,
  16334. @option{chroma_power} and @option{alpha_power} default to the
  16335. corresponding value set for @option{luma_power}.
  16336. A value of 0 will disable the effect.
  16337. @end table
  16338. @subsection Examples
  16339. 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.
  16340. @itemize
  16341. @item
  16342. Apply a boxblur filter with the luma, chroma, and alpha radius
  16343. 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.
  16344. @example
  16345. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  16346. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  16347. @end example
  16348. @item
  16349. 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.
  16350. For the luma plane, a 2x2 box radius will be run once.
  16351. For the chroma plane, a 4x4 box radius will be run 5 times.
  16352. For the alpha plane, a 3x3 box radius will be run 7 times.
  16353. @example
  16354. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  16355. @end example
  16356. @end itemize
  16357. @section colorkey_opencl
  16358. RGB colorspace color keying.
  16359. The filter accepts the following options:
  16360. @table @option
  16361. @item color
  16362. The color which will be replaced with transparency.
  16363. @item similarity
  16364. Similarity percentage with the key color.
  16365. 0.01 matches only the exact key color, while 1.0 matches everything.
  16366. @item blend
  16367. Blend percentage.
  16368. 0.0 makes pixels either fully transparent, or not transparent at all.
  16369. Higher values result in semi-transparent pixels, with a higher transparency
  16370. the more similar the pixels color is to the key color.
  16371. @end table
  16372. @subsection Examples
  16373. @itemize
  16374. @item
  16375. Make every semi-green pixel in the input transparent with some slight blending:
  16376. @example
  16377. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  16378. @end example
  16379. @end itemize
  16380. @section convolution_opencl
  16381. Apply convolution of 3x3, 5x5, 7x7 matrix.
  16382. The filter accepts the following options:
  16383. @table @option
  16384. @item 0m
  16385. @item 1m
  16386. @item 2m
  16387. @item 3m
  16388. Set matrix for each plane.
  16389. Matrix is sequence of 9, 25 or 49 signed numbers.
  16390. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  16391. @item 0rdiv
  16392. @item 1rdiv
  16393. @item 2rdiv
  16394. @item 3rdiv
  16395. Set multiplier for calculated value for each plane.
  16396. If unset or 0, it will be sum of all matrix elements.
  16397. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  16398. @item 0bias
  16399. @item 1bias
  16400. @item 2bias
  16401. @item 3bias
  16402. Set bias for each plane. This value is added to the result of the multiplication.
  16403. Useful for making the overall image brighter or darker.
  16404. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  16405. @end table
  16406. @subsection Examples
  16407. @itemize
  16408. @item
  16409. Apply sharpen:
  16410. @example
  16411. -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
  16412. @end example
  16413. @item
  16414. Apply blur:
  16415. @example
  16416. -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
  16417. @end example
  16418. @item
  16419. Apply edge enhance:
  16420. @example
  16421. -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
  16422. @end example
  16423. @item
  16424. Apply edge detect:
  16425. @example
  16426. -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
  16427. @end example
  16428. @item
  16429. Apply laplacian edge detector which includes diagonals:
  16430. @example
  16431. -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
  16432. @end example
  16433. @item
  16434. Apply emboss:
  16435. @example
  16436. -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
  16437. @end example
  16438. @end itemize
  16439. @section erosion_opencl
  16440. Apply erosion effect to the video.
  16441. This filter replaces the pixel by the local(3x3) minimum.
  16442. It accepts the following options:
  16443. @table @option
  16444. @item threshold0
  16445. @item threshold1
  16446. @item threshold2
  16447. @item threshold3
  16448. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16449. If @code{0}, plane will remain unchanged.
  16450. @item coordinates
  16451. Flag which specifies the pixel to refer to.
  16452. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16453. Flags to local 3x3 coordinates region centered on @code{x}:
  16454. 1 2 3
  16455. 4 x 5
  16456. 6 7 8
  16457. @end table
  16458. @subsection Example
  16459. @itemize
  16460. @item
  16461. 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.
  16462. @example
  16463. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16464. @end example
  16465. @end itemize
  16466. @section deshake_opencl
  16467. Feature-point based video stabilization filter.
  16468. The filter accepts the following options:
  16469. @table @option
  16470. @item tripod
  16471. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  16472. @item debug
  16473. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  16474. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  16475. Viewing point matches in the output video is only supported for RGB input.
  16476. Defaults to @code{0}.
  16477. @item adaptive_crop
  16478. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  16479. Defaults to @code{1}.
  16480. @item refine_features
  16481. Whether or not feature points should be refined at a sub-pixel level.
  16482. This can be turned off for a slight performance gain at the cost of precision.
  16483. Defaults to @code{1}.
  16484. @item smooth_strength
  16485. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  16486. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  16487. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  16488. Defaults to @code{0.0}.
  16489. @item smooth_window_multiplier
  16490. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  16491. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  16492. Acceptable values range from @code{0.1} to @code{10.0}.
  16493. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  16494. potentially improving smoothness, but also increase latency and memory usage.
  16495. Defaults to @code{2.0}.
  16496. @end table
  16497. @subsection Examples
  16498. @itemize
  16499. @item
  16500. Stabilize a video with a fixed, medium smoothing strength:
  16501. @example
  16502. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  16503. @end example
  16504. @item
  16505. Stabilize a video with debugging (both in console and in rendered video):
  16506. @example
  16507. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  16508. @end example
  16509. @end itemize
  16510. @section dilation_opencl
  16511. Apply dilation effect to the video.
  16512. This filter replaces the pixel by the local(3x3) maximum.
  16513. It accepts the following options:
  16514. @table @option
  16515. @item threshold0
  16516. @item threshold1
  16517. @item threshold2
  16518. @item threshold3
  16519. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16520. If @code{0}, plane will remain unchanged.
  16521. @item coordinates
  16522. Flag which specifies the pixel to refer to.
  16523. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16524. Flags to local 3x3 coordinates region centered on @code{x}:
  16525. 1 2 3
  16526. 4 x 5
  16527. 6 7 8
  16528. @end table
  16529. @subsection Example
  16530. @itemize
  16531. @item
  16532. 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.
  16533. @example
  16534. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16535. @end example
  16536. @end itemize
  16537. @section nlmeans_opencl
  16538. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  16539. @section overlay_opencl
  16540. Overlay one video on top of another.
  16541. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  16542. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  16543. The filter accepts the following options:
  16544. @table @option
  16545. @item x
  16546. Set the x coordinate of the overlaid video on the main video.
  16547. Default value is @code{0}.
  16548. @item y
  16549. Set the y coordinate of the overlaid video on the main video.
  16550. Default value is @code{0}.
  16551. @end table
  16552. @subsection Examples
  16553. @itemize
  16554. @item
  16555. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  16556. @example
  16557. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16558. @end example
  16559. @item
  16560. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  16561. @example
  16562. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16563. @end example
  16564. @end itemize
  16565. @section pad_opencl
  16566. Add paddings to the input image, and place the original input at the
  16567. provided @var{x}, @var{y} coordinates.
  16568. It accepts the following options:
  16569. @table @option
  16570. @item width, w
  16571. @item height, h
  16572. Specify an expression for the size of the output image with the
  16573. paddings added. If the value for @var{width} or @var{height} is 0, the
  16574. corresponding input size is used for the output.
  16575. The @var{width} expression can reference the value set by the
  16576. @var{height} expression, and vice versa.
  16577. The default value of @var{width} and @var{height} is 0.
  16578. @item x
  16579. @item y
  16580. Specify the offsets to place the input image at within the padded area,
  16581. with respect to the top/left border of the output image.
  16582. The @var{x} expression can reference the value set by the @var{y}
  16583. expression, and vice versa.
  16584. The default value of @var{x} and @var{y} is 0.
  16585. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  16586. so the input image is centered on the padded area.
  16587. @item color
  16588. Specify the color of the padded area. For the syntax of this option,
  16589. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  16590. manual,ffmpeg-utils}.
  16591. @item aspect
  16592. Pad to an aspect instead to a resolution.
  16593. @end table
  16594. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  16595. options are expressions containing the following constants:
  16596. @table @option
  16597. @item in_w
  16598. @item in_h
  16599. The input video width and height.
  16600. @item iw
  16601. @item ih
  16602. These are the same as @var{in_w} and @var{in_h}.
  16603. @item out_w
  16604. @item out_h
  16605. The output width and height (the size of the padded area), as
  16606. specified by the @var{width} and @var{height} expressions.
  16607. @item ow
  16608. @item oh
  16609. These are the same as @var{out_w} and @var{out_h}.
  16610. @item x
  16611. @item y
  16612. The x and y offsets as specified by the @var{x} and @var{y}
  16613. expressions, or NAN if not yet specified.
  16614. @item a
  16615. same as @var{iw} / @var{ih}
  16616. @item sar
  16617. input sample aspect ratio
  16618. @item dar
  16619. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  16620. @end table
  16621. @section prewitt_opencl
  16622. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  16623. The filter accepts the following option:
  16624. @table @option
  16625. @item planes
  16626. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16627. @item scale
  16628. Set value which will be multiplied with filtered result.
  16629. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16630. @item delta
  16631. Set value which will be added to filtered result.
  16632. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16633. @end table
  16634. @subsection Example
  16635. @itemize
  16636. @item
  16637. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  16638. @example
  16639. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16640. @end example
  16641. @end itemize
  16642. @anchor{program_opencl}
  16643. @section program_opencl
  16644. Filter video using an OpenCL program.
  16645. @table @option
  16646. @item source
  16647. OpenCL program source file.
  16648. @item kernel
  16649. Kernel name in program.
  16650. @item inputs
  16651. Number of inputs to the filter. Defaults to 1.
  16652. @item size, s
  16653. Size of output frames. Defaults to the same as the first input.
  16654. @end table
  16655. The @code{program_opencl} filter also supports the @ref{framesync} options.
  16656. The program source file must contain a kernel function with the given name,
  16657. which will be run once for each plane of the output. Each run on a plane
  16658. gets enqueued as a separate 2D global NDRange with one work-item for each
  16659. pixel to be generated. The global ID offset for each work-item is therefore
  16660. the coordinates of a pixel in the destination image.
  16661. The kernel function needs to take the following arguments:
  16662. @itemize
  16663. @item
  16664. Destination image, @var{__write_only image2d_t}.
  16665. This image will become the output; the kernel should write all of it.
  16666. @item
  16667. Frame index, @var{unsigned int}.
  16668. This is a counter starting from zero and increasing by one for each frame.
  16669. @item
  16670. Source images, @var{__read_only image2d_t}.
  16671. These are the most recent images on each input. The kernel may read from
  16672. them to generate the output, but they can't be written to.
  16673. @end itemize
  16674. Example programs:
  16675. @itemize
  16676. @item
  16677. Copy the input to the output (output must be the same size as the input).
  16678. @verbatim
  16679. __kernel void copy(__write_only image2d_t destination,
  16680. unsigned int index,
  16681. __read_only image2d_t source)
  16682. {
  16683. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  16684. int2 location = (int2)(get_global_id(0), get_global_id(1));
  16685. float4 value = read_imagef(source, sampler, location);
  16686. write_imagef(destination, location, value);
  16687. }
  16688. @end verbatim
  16689. @item
  16690. Apply a simple transformation, rotating the input by an amount increasing
  16691. with the index counter. Pixel values are linearly interpolated by the
  16692. sampler, and the output need not have the same dimensions as the input.
  16693. @verbatim
  16694. __kernel void rotate_image(__write_only image2d_t dst,
  16695. unsigned int index,
  16696. __read_only image2d_t src)
  16697. {
  16698. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16699. CLK_FILTER_LINEAR);
  16700. float angle = (float)index / 100.0f;
  16701. float2 dst_dim = convert_float2(get_image_dim(dst));
  16702. float2 src_dim = convert_float2(get_image_dim(src));
  16703. float2 dst_cen = dst_dim / 2.0f;
  16704. float2 src_cen = src_dim / 2.0f;
  16705. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16706. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  16707. float2 src_pos = {
  16708. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  16709. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  16710. };
  16711. src_pos = src_pos * src_dim / dst_dim;
  16712. float2 src_loc = src_pos + src_cen;
  16713. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  16714. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  16715. write_imagef(dst, dst_loc, 0.5f);
  16716. else
  16717. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  16718. }
  16719. @end verbatim
  16720. @item
  16721. Blend two inputs together, with the amount of each input used varying
  16722. with the index counter.
  16723. @verbatim
  16724. __kernel void blend_images(__write_only image2d_t dst,
  16725. unsigned int index,
  16726. __read_only image2d_t src1,
  16727. __read_only image2d_t src2)
  16728. {
  16729. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16730. CLK_FILTER_LINEAR);
  16731. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  16732. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16733. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  16734. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  16735. float4 val1 = read_imagef(src1, sampler, src1_loc);
  16736. float4 val2 = read_imagef(src2, sampler, src2_loc);
  16737. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  16738. }
  16739. @end verbatim
  16740. @end itemize
  16741. @section roberts_opencl
  16742. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  16743. The filter accepts the following option:
  16744. @table @option
  16745. @item planes
  16746. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16747. @item scale
  16748. Set value which will be multiplied with filtered result.
  16749. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16750. @item delta
  16751. Set value which will be added to filtered result.
  16752. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16753. @end table
  16754. @subsection Example
  16755. @itemize
  16756. @item
  16757. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  16758. @example
  16759. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16760. @end example
  16761. @end itemize
  16762. @section sobel_opencl
  16763. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  16764. The filter accepts the following option:
  16765. @table @option
  16766. @item planes
  16767. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16768. @item scale
  16769. Set value which will be multiplied with filtered result.
  16770. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16771. @item delta
  16772. Set value which will be added to filtered result.
  16773. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16774. @end table
  16775. @subsection Example
  16776. @itemize
  16777. @item
  16778. Apply sobel operator with scale set to 2 and delta set to 10
  16779. @example
  16780. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16781. @end example
  16782. @end itemize
  16783. @section tonemap_opencl
  16784. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  16785. It accepts the following parameters:
  16786. @table @option
  16787. @item tonemap
  16788. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  16789. @item param
  16790. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  16791. @item desat
  16792. Apply desaturation for highlights that exceed this level of brightness. The
  16793. higher the parameter, the more color information will be preserved. This
  16794. setting helps prevent unnaturally blown-out colors for super-highlights, by
  16795. (smoothly) turning into white instead. This makes images feel more natural,
  16796. at the cost of reducing information about out-of-range colors.
  16797. The default value is 0.5, and the algorithm here is a little different from
  16798. the cpu version tonemap currently. A setting of 0.0 disables this option.
  16799. @item threshold
  16800. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  16801. is used to detect whether the scene has changed or not. If the distance between
  16802. the current frame average brightness and the current running average exceeds
  16803. a threshold value, we would re-calculate scene average and peak brightness.
  16804. The default value is 0.2.
  16805. @item format
  16806. Specify the output pixel format.
  16807. Currently supported formats are:
  16808. @table @var
  16809. @item p010
  16810. @item nv12
  16811. @end table
  16812. @item range, r
  16813. Set the output color range.
  16814. Possible values are:
  16815. @table @var
  16816. @item tv/mpeg
  16817. @item pc/jpeg
  16818. @end table
  16819. Default is same as input.
  16820. @item primaries, p
  16821. Set the output color primaries.
  16822. Possible values are:
  16823. @table @var
  16824. @item bt709
  16825. @item bt2020
  16826. @end table
  16827. Default is same as input.
  16828. @item transfer, t
  16829. Set the output transfer characteristics.
  16830. Possible values are:
  16831. @table @var
  16832. @item bt709
  16833. @item bt2020
  16834. @end table
  16835. Default is bt709.
  16836. @item matrix, m
  16837. Set the output colorspace matrix.
  16838. Possible value are:
  16839. @table @var
  16840. @item bt709
  16841. @item bt2020
  16842. @end table
  16843. Default is same as input.
  16844. @end table
  16845. @subsection Example
  16846. @itemize
  16847. @item
  16848. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  16849. @example
  16850. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  16851. @end example
  16852. @end itemize
  16853. @section unsharp_opencl
  16854. Sharpen or blur the input video.
  16855. It accepts the following parameters:
  16856. @table @option
  16857. @item luma_msize_x, lx
  16858. Set the luma matrix horizontal size.
  16859. Range is @code{[1, 23]} and default value is @code{5}.
  16860. @item luma_msize_y, ly
  16861. Set the luma matrix vertical size.
  16862. Range is @code{[1, 23]} and default value is @code{5}.
  16863. @item luma_amount, la
  16864. Set the luma effect strength.
  16865. Range is @code{[-10, 10]} and default value is @code{1.0}.
  16866. Negative values will blur the input video, while positive values will
  16867. sharpen it, a value of zero will disable the effect.
  16868. @item chroma_msize_x, cx
  16869. Set the chroma matrix horizontal size.
  16870. Range is @code{[1, 23]} and default value is @code{5}.
  16871. @item chroma_msize_y, cy
  16872. Set the chroma matrix vertical size.
  16873. Range is @code{[1, 23]} and default value is @code{5}.
  16874. @item chroma_amount, ca
  16875. Set the chroma effect strength.
  16876. Range is @code{[-10, 10]} and default value is @code{0.0}.
  16877. Negative values will blur the input video, while positive values will
  16878. sharpen it, a value of zero will disable the effect.
  16879. @end table
  16880. All parameters are optional and default to the equivalent of the
  16881. string '5:5:1.0:5:5:0.0'.
  16882. @subsection Examples
  16883. @itemize
  16884. @item
  16885. Apply strong luma sharpen effect:
  16886. @example
  16887. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  16888. @end example
  16889. @item
  16890. Apply a strong blur of both luma and chroma parameters:
  16891. @example
  16892. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  16893. @end example
  16894. @end itemize
  16895. @section xfade_opencl
  16896. Cross fade two videos with custom transition effect by using OpenCL.
  16897. It accepts the following options:
  16898. @table @option
  16899. @item transition
  16900. Set one of possible transition effects.
  16901. @table @option
  16902. @item custom
  16903. Select custom transition effect, the actual transition description
  16904. will be picked from source and kernel options.
  16905. @item fade
  16906. @item wipeleft
  16907. @item wiperight
  16908. @item wipeup
  16909. @item wipedown
  16910. @item slideleft
  16911. @item slideright
  16912. @item slideup
  16913. @item slidedown
  16914. Default transition is fade.
  16915. @end table
  16916. @item source
  16917. OpenCL program source file for custom transition.
  16918. @item kernel
  16919. Set name of kernel to use for custom transition from program source file.
  16920. @item duration
  16921. Set duration of video transition.
  16922. @item offset
  16923. Set time of start of transition relative to first video.
  16924. @end table
  16925. The program source file must contain a kernel function with the given name,
  16926. which will be run once for each plane of the output. Each run on a plane
  16927. gets enqueued as a separate 2D global NDRange with one work-item for each
  16928. pixel to be generated. The global ID offset for each work-item is therefore
  16929. the coordinates of a pixel in the destination image.
  16930. The kernel function needs to take the following arguments:
  16931. @itemize
  16932. @item
  16933. Destination image, @var{__write_only image2d_t}.
  16934. This image will become the output; the kernel should write all of it.
  16935. @item
  16936. First Source image, @var{__read_only image2d_t}.
  16937. Second Source image, @var{__read_only image2d_t}.
  16938. These are the most recent images on each input. The kernel may read from
  16939. them to generate the output, but they can't be written to.
  16940. @item
  16941. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  16942. @end itemize
  16943. Example programs:
  16944. @itemize
  16945. @item
  16946. Apply dots curtain transition effect:
  16947. @verbatim
  16948. __kernel void blend_images(__write_only image2d_t dst,
  16949. __read_only image2d_t src1,
  16950. __read_only image2d_t src2,
  16951. float progress)
  16952. {
  16953. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16954. CLK_FILTER_LINEAR);
  16955. int2 p = (int2)(get_global_id(0), get_global_id(1));
  16956. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  16957. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  16958. rp = rp / dim;
  16959. float2 dots = (float2)(20.0, 20.0);
  16960. float2 center = (float2)(0,0);
  16961. float2 unused;
  16962. float4 val1 = read_imagef(src1, sampler, p);
  16963. float4 val2 = read_imagef(src2, sampler, p);
  16964. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  16965. write_imagef(dst, p, next ? val1 : val2);
  16966. }
  16967. @end verbatim
  16968. @end itemize
  16969. @c man end OPENCL VIDEO FILTERS
  16970. @chapter VAAPI Video Filters
  16971. @c man begin VAAPI VIDEO FILTERS
  16972. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  16973. To enable compilation of these filters you need to configure FFmpeg with
  16974. @code{--enable-vaapi}.
  16975. 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}
  16976. @section tonemap_vaapi
  16977. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  16978. It maps the dynamic range of HDR10 content to the SDR content.
  16979. It currently only accepts HDR10 as input.
  16980. It accepts the following parameters:
  16981. @table @option
  16982. @item format
  16983. Specify the output pixel format.
  16984. Currently supported formats are:
  16985. @table @var
  16986. @item p010
  16987. @item nv12
  16988. @end table
  16989. Default is nv12.
  16990. @item primaries, p
  16991. Set the output color primaries.
  16992. Default is same as input.
  16993. @item transfer, t
  16994. Set the output transfer characteristics.
  16995. Default is bt709.
  16996. @item matrix, m
  16997. Set the output colorspace matrix.
  16998. Default is same as input.
  16999. @end table
  17000. @subsection Example
  17001. @itemize
  17002. @item
  17003. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  17004. @example
  17005. tonemap_vaapi=format=p010:t=bt2020-10
  17006. @end example
  17007. @end itemize
  17008. @c man end VAAPI VIDEO FILTERS
  17009. @chapter Video Sources
  17010. @c man begin VIDEO SOURCES
  17011. Below is a description of the currently available video sources.
  17012. @section buffer
  17013. Buffer video frames, and make them available to the filter chain.
  17014. This source is mainly intended for a programmatic use, in particular
  17015. through the interface defined in @file{libavfilter/buffersrc.h}.
  17016. It accepts the following parameters:
  17017. @table @option
  17018. @item video_size
  17019. Specify the size (width and height) of the buffered video frames. For the
  17020. syntax of this option, check the
  17021. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17022. @item width
  17023. The input video width.
  17024. @item height
  17025. The input video height.
  17026. @item pix_fmt
  17027. A string representing the pixel format of the buffered video frames.
  17028. It may be a number corresponding to a pixel format, or a pixel format
  17029. name.
  17030. @item time_base
  17031. Specify the timebase assumed by the timestamps of the buffered frames.
  17032. @item frame_rate
  17033. Specify the frame rate expected for the video stream.
  17034. @item pixel_aspect, sar
  17035. The sample (pixel) aspect ratio of the input video.
  17036. @item sws_param
  17037. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  17038. to the filtergraph description to specify swscale flags for automatically
  17039. inserted scalers. See @ref{Filtergraph syntax}.
  17040. @item hw_frames_ctx
  17041. When using a hardware pixel format, this should be a reference to an
  17042. AVHWFramesContext describing input frames.
  17043. @end table
  17044. For example:
  17045. @example
  17046. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  17047. @end example
  17048. will instruct the source to accept video frames with size 320x240 and
  17049. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  17050. square pixels (1:1 sample aspect ratio).
  17051. Since the pixel format with name "yuv410p" corresponds to the number 6
  17052. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  17053. this example corresponds to:
  17054. @example
  17055. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  17056. @end example
  17057. Alternatively, the options can be specified as a flat string, but this
  17058. syntax is deprecated:
  17059. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  17060. @section cellauto
  17061. Create a pattern generated by an elementary cellular automaton.
  17062. The initial state of the cellular automaton can be defined through the
  17063. @option{filename} and @option{pattern} options. If such options are
  17064. not specified an initial state is created randomly.
  17065. At each new frame a new row in the video is filled with the result of
  17066. the cellular automaton next generation. The behavior when the whole
  17067. frame is filled is defined by the @option{scroll} option.
  17068. This source accepts the following options:
  17069. @table @option
  17070. @item filename, f
  17071. Read the initial cellular automaton state, i.e. the starting row, from
  17072. the specified file.
  17073. In the file, each non-whitespace character is considered an alive
  17074. cell, a newline will terminate the row, and further characters in the
  17075. file will be ignored.
  17076. @item pattern, p
  17077. Read the initial cellular automaton state, i.e. the starting row, from
  17078. the specified string.
  17079. Each non-whitespace character in the string is considered an alive
  17080. cell, a newline will terminate the row, and further characters in the
  17081. string will be ignored.
  17082. @item rate, r
  17083. Set the video rate, that is the number of frames generated per second.
  17084. Default is 25.
  17085. @item random_fill_ratio, ratio
  17086. Set the random fill ratio for the initial cellular automaton row. It
  17087. is a floating point number value ranging from 0 to 1, defaults to
  17088. 1/PHI.
  17089. This option is ignored when a file or a pattern is specified.
  17090. @item random_seed, seed
  17091. Set the seed for filling randomly the initial row, must be an integer
  17092. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17093. set to -1, the filter will try to use a good random seed on a best
  17094. effort basis.
  17095. @item rule
  17096. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  17097. Default value is 110.
  17098. @item size, s
  17099. Set the size of the output video. For the syntax of this option, check the
  17100. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17101. If @option{filename} or @option{pattern} is specified, the size is set
  17102. by default to the width of the specified initial state row, and the
  17103. height is set to @var{width} * PHI.
  17104. If @option{size} is set, it must contain the width of the specified
  17105. pattern string, and the specified pattern will be centered in the
  17106. larger row.
  17107. If a filename or a pattern string is not specified, the size value
  17108. defaults to "320x518" (used for a randomly generated initial state).
  17109. @item scroll
  17110. If set to 1, scroll the output upward when all the rows in the output
  17111. have been already filled. If set to 0, the new generated row will be
  17112. written over the top row just after the bottom row is filled.
  17113. Defaults to 1.
  17114. @item start_full, full
  17115. If set to 1, completely fill the output with generated rows before
  17116. outputting the first frame.
  17117. This is the default behavior, for disabling set the value to 0.
  17118. @item stitch
  17119. If set to 1, stitch the left and right row edges together.
  17120. This is the default behavior, for disabling set the value to 0.
  17121. @end table
  17122. @subsection Examples
  17123. @itemize
  17124. @item
  17125. Read the initial state from @file{pattern}, and specify an output of
  17126. size 200x400.
  17127. @example
  17128. cellauto=f=pattern:s=200x400
  17129. @end example
  17130. @item
  17131. Generate a random initial row with a width of 200 cells, with a fill
  17132. ratio of 2/3:
  17133. @example
  17134. cellauto=ratio=2/3:s=200x200
  17135. @end example
  17136. @item
  17137. Create a pattern generated by rule 18 starting by a single alive cell
  17138. centered on an initial row with width 100:
  17139. @example
  17140. cellauto=p=@@:s=100x400:full=0:rule=18
  17141. @end example
  17142. @item
  17143. Specify a more elaborated initial pattern:
  17144. @example
  17145. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  17146. @end example
  17147. @end itemize
  17148. @anchor{coreimagesrc}
  17149. @section coreimagesrc
  17150. Video source generated on GPU using Apple's CoreImage API on OSX.
  17151. This video source is a specialized version of the @ref{coreimage} video filter.
  17152. Use a core image generator at the beginning of the applied filterchain to
  17153. generate the content.
  17154. The coreimagesrc video source accepts the following options:
  17155. @table @option
  17156. @item list_generators
  17157. List all available generators along with all their respective options as well as
  17158. possible minimum and maximum values along with the default values.
  17159. @example
  17160. list_generators=true
  17161. @end example
  17162. @item size, s
  17163. Specify the size of the sourced video. For the syntax of this option, check the
  17164. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17165. The default value is @code{320x240}.
  17166. @item rate, r
  17167. Specify the frame rate of the sourced video, as the number of frames
  17168. generated per second. It has to be a string in the format
  17169. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17170. number or a valid video frame rate abbreviation. The default value is
  17171. "25".
  17172. @item sar
  17173. Set the sample aspect ratio of the sourced video.
  17174. @item duration, d
  17175. Set the duration of the sourced video. See
  17176. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17177. for the accepted syntax.
  17178. If not specified, or the expressed duration is negative, the video is
  17179. supposed to be generated forever.
  17180. @end table
  17181. Additionally, all options of the @ref{coreimage} video filter are accepted.
  17182. A complete filterchain can be used for further processing of the
  17183. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  17184. and examples for details.
  17185. @subsection Examples
  17186. @itemize
  17187. @item
  17188. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  17189. given as complete and escaped command-line for Apple's standard bash shell:
  17190. @example
  17191. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  17192. @end example
  17193. This example is equivalent to the QRCode example of @ref{coreimage} without the
  17194. need for a nullsrc video source.
  17195. @end itemize
  17196. @section gradients
  17197. Generate several gradients.
  17198. @table @option
  17199. @item size, s
  17200. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17201. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17202. @item rate, r
  17203. Set frame rate, expressed as number of frames per second. Default
  17204. value is "25".
  17205. @item c0, c1, c2, c3, c4, c5, c6, c7
  17206. Set 8 colors. Default values for colors is to pick random one.
  17207. @item x0, y0, y0, y1
  17208. Set gradient line source and destination points. If negative or out of range, random ones
  17209. are picked.
  17210. @item nb_colors, n
  17211. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  17212. @item seed
  17213. Set seed for picking gradient line points.
  17214. @item duration, d
  17215. Set the duration of the sourced video. See
  17216. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17217. for the accepted syntax.
  17218. If not specified, or the expressed duration is negative, the video is
  17219. supposed to be generated forever.
  17220. @item speed
  17221. Set speed of gradients rotation.
  17222. @end table
  17223. @section mandelbrot
  17224. Generate a Mandelbrot set fractal, and progressively zoom towards the
  17225. point specified with @var{start_x} and @var{start_y}.
  17226. This source accepts the following options:
  17227. @table @option
  17228. @item end_pts
  17229. Set the terminal pts value. Default value is 400.
  17230. @item end_scale
  17231. Set the terminal scale value.
  17232. Must be a floating point value. Default value is 0.3.
  17233. @item inner
  17234. Set the inner coloring mode, that is the algorithm used to draw the
  17235. Mandelbrot fractal internal region.
  17236. It shall assume one of the following values:
  17237. @table @option
  17238. @item black
  17239. Set black mode.
  17240. @item convergence
  17241. Show time until convergence.
  17242. @item mincol
  17243. Set color based on point closest to the origin of the iterations.
  17244. @item period
  17245. Set period mode.
  17246. @end table
  17247. Default value is @var{mincol}.
  17248. @item bailout
  17249. Set the bailout value. Default value is 10.0.
  17250. @item maxiter
  17251. Set the maximum of iterations performed by the rendering
  17252. algorithm. Default value is 7189.
  17253. @item outer
  17254. Set outer coloring mode.
  17255. It shall assume one of following values:
  17256. @table @option
  17257. @item iteration_count
  17258. Set iteration count mode.
  17259. @item normalized_iteration_count
  17260. set normalized iteration count mode.
  17261. @end table
  17262. Default value is @var{normalized_iteration_count}.
  17263. @item rate, r
  17264. Set frame rate, expressed as number of frames per second. Default
  17265. value is "25".
  17266. @item size, s
  17267. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17268. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17269. @item start_scale
  17270. Set the initial scale value. Default value is 3.0.
  17271. @item start_x
  17272. Set the initial x position. Must be a floating point value between
  17273. -100 and 100. Default value is -0.743643887037158704752191506114774.
  17274. @item start_y
  17275. Set the initial y position. Must be a floating point value between
  17276. -100 and 100. Default value is -0.131825904205311970493132056385139.
  17277. @end table
  17278. @section mptestsrc
  17279. Generate various test patterns, as generated by the MPlayer test filter.
  17280. The size of the generated video is fixed, and is 256x256.
  17281. This source is useful in particular for testing encoding features.
  17282. This source accepts the following options:
  17283. @table @option
  17284. @item rate, r
  17285. Specify the frame rate of the sourced video, as the number of frames
  17286. generated per second. It has to be a string in the format
  17287. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17288. number or a valid video frame rate abbreviation. The default value is
  17289. "25".
  17290. @item duration, d
  17291. Set the duration of the sourced video. See
  17292. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17293. for the accepted syntax.
  17294. If not specified, or the expressed duration is negative, the video is
  17295. supposed to be generated forever.
  17296. @item test, t
  17297. Set the number or the name of the test to perform. Supported tests are:
  17298. @table @option
  17299. @item dc_luma
  17300. @item dc_chroma
  17301. @item freq_luma
  17302. @item freq_chroma
  17303. @item amp_luma
  17304. @item amp_chroma
  17305. @item cbp
  17306. @item mv
  17307. @item ring1
  17308. @item ring2
  17309. @item all
  17310. @item max_frames, m
  17311. Set the maximum number of frames generated for each test, default value is 30.
  17312. @end table
  17313. Default value is "all", which will cycle through the list of all tests.
  17314. @end table
  17315. Some examples:
  17316. @example
  17317. mptestsrc=t=dc_luma
  17318. @end example
  17319. will generate a "dc_luma" test pattern.
  17320. @section frei0r_src
  17321. Provide a frei0r source.
  17322. To enable compilation of this filter you need to install the frei0r
  17323. header and configure FFmpeg with @code{--enable-frei0r}.
  17324. This source accepts the following parameters:
  17325. @table @option
  17326. @item size
  17327. The size of the video to generate. For the syntax of this option, check the
  17328. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17329. @item framerate
  17330. The framerate of the generated video. It may be a string of the form
  17331. @var{num}/@var{den} or a frame rate abbreviation.
  17332. @item filter_name
  17333. The name to the frei0r source to load. For more information regarding frei0r and
  17334. how to set the parameters, read the @ref{frei0r} section in the video filters
  17335. documentation.
  17336. @item filter_params
  17337. A '|'-separated list of parameters to pass to the frei0r source.
  17338. @end table
  17339. For example, to generate a frei0r partik0l source with size 200x200
  17340. and frame rate 10 which is overlaid on the overlay filter main input:
  17341. @example
  17342. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  17343. @end example
  17344. @section life
  17345. Generate a life pattern.
  17346. This source is based on a generalization of John Conway's life game.
  17347. The sourced input represents a life grid, each pixel represents a cell
  17348. which can be in one of two possible states, alive or dead. Every cell
  17349. interacts with its eight neighbours, which are the cells that are
  17350. horizontally, vertically, or diagonally adjacent.
  17351. At each interaction the grid evolves according to the adopted rule,
  17352. which specifies the number of neighbor alive cells which will make a
  17353. cell stay alive or born. The @option{rule} option allows one to specify
  17354. the rule to adopt.
  17355. This source accepts the following options:
  17356. @table @option
  17357. @item filename, f
  17358. Set the file from which to read the initial grid state. In the file,
  17359. each non-whitespace character is considered an alive cell, and newline
  17360. is used to delimit the end of each row.
  17361. If this option is not specified, the initial grid is generated
  17362. randomly.
  17363. @item rate, r
  17364. Set the video rate, that is the number of frames generated per second.
  17365. Default is 25.
  17366. @item random_fill_ratio, ratio
  17367. Set the random fill ratio for the initial random grid. It is a
  17368. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  17369. It is ignored when a file is specified.
  17370. @item random_seed, seed
  17371. Set the seed for filling the initial random grid, must be an integer
  17372. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17373. set to -1, the filter will try to use a good random seed on a best
  17374. effort basis.
  17375. @item rule
  17376. Set the life rule.
  17377. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  17378. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  17379. @var{NS} specifies the number of alive neighbor cells which make a
  17380. live cell stay alive, and @var{NB} the number of alive neighbor cells
  17381. which make a dead cell to become alive (i.e. to "born").
  17382. "s" and "b" can be used in place of "S" and "B", respectively.
  17383. Alternatively a rule can be specified by an 18-bits integer. The 9
  17384. high order bits are used to encode the next cell state if it is alive
  17385. for each number of neighbor alive cells, the low order bits specify
  17386. the rule for "borning" new cells. Higher order bits encode for an
  17387. higher number of neighbor cells.
  17388. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  17389. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  17390. Default value is "S23/B3", which is the original Conway's game of life
  17391. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  17392. cells, and will born a new cell if there are three alive cells around
  17393. a dead cell.
  17394. @item size, s
  17395. Set the size of the output video. For the syntax of this option, check the
  17396. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17397. If @option{filename} is specified, the size is set by default to the
  17398. same size of the input file. If @option{size} is set, it must contain
  17399. the size specified in the input file, and the initial grid defined in
  17400. that file is centered in the larger resulting area.
  17401. If a filename is not specified, the size value defaults to "320x240"
  17402. (used for a randomly generated initial grid).
  17403. @item stitch
  17404. If set to 1, stitch the left and right grid edges together, and the
  17405. top and bottom edges also. Defaults to 1.
  17406. @item mold
  17407. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  17408. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  17409. value from 0 to 255.
  17410. @item life_color
  17411. Set the color of living (or new born) cells.
  17412. @item death_color
  17413. Set the color of dead cells. If @option{mold} is set, this is the first color
  17414. used to represent a dead cell.
  17415. @item mold_color
  17416. Set mold color, for definitely dead and moldy cells.
  17417. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  17418. ffmpeg-utils manual,ffmpeg-utils}.
  17419. @end table
  17420. @subsection Examples
  17421. @itemize
  17422. @item
  17423. Read a grid from @file{pattern}, and center it on a grid of size
  17424. 300x300 pixels:
  17425. @example
  17426. life=f=pattern:s=300x300
  17427. @end example
  17428. @item
  17429. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  17430. @example
  17431. life=ratio=2/3:s=200x200
  17432. @end example
  17433. @item
  17434. Specify a custom rule for evolving a randomly generated grid:
  17435. @example
  17436. life=rule=S14/B34
  17437. @end example
  17438. @item
  17439. Full example with slow death effect (mold) using @command{ffplay}:
  17440. @example
  17441. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  17442. @end example
  17443. @end itemize
  17444. @anchor{allrgb}
  17445. @anchor{allyuv}
  17446. @anchor{color}
  17447. @anchor{haldclutsrc}
  17448. @anchor{nullsrc}
  17449. @anchor{pal75bars}
  17450. @anchor{pal100bars}
  17451. @anchor{rgbtestsrc}
  17452. @anchor{smptebars}
  17453. @anchor{smptehdbars}
  17454. @anchor{testsrc}
  17455. @anchor{testsrc2}
  17456. @anchor{yuvtestsrc}
  17457. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  17458. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  17459. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  17460. The @code{color} source provides an uniformly colored input.
  17461. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  17462. @ref{haldclut} filter.
  17463. The @code{nullsrc} source returns unprocessed video frames. It is
  17464. mainly useful to be employed in analysis / debugging tools, or as the
  17465. source for filters which ignore the input data.
  17466. The @code{pal75bars} source generates a color bars pattern, based on
  17467. EBU PAL recommendations with 75% color levels.
  17468. The @code{pal100bars} source generates a color bars pattern, based on
  17469. EBU PAL recommendations with 100% color levels.
  17470. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  17471. detecting RGB vs BGR issues. You should see a red, green and blue
  17472. stripe from top to bottom.
  17473. The @code{smptebars} source generates a color bars pattern, based on
  17474. the SMPTE Engineering Guideline EG 1-1990.
  17475. The @code{smptehdbars} source generates a color bars pattern, based on
  17476. the SMPTE RP 219-2002.
  17477. The @code{testsrc} source generates a test video pattern, showing a
  17478. color pattern, a scrolling gradient and a timestamp. This is mainly
  17479. intended for testing purposes.
  17480. The @code{testsrc2} source is similar to testsrc, but supports more
  17481. pixel formats instead of just @code{rgb24}. This allows using it as an
  17482. input for other tests without requiring a format conversion.
  17483. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  17484. see a y, cb and cr stripe from top to bottom.
  17485. The sources accept the following parameters:
  17486. @table @option
  17487. @item level
  17488. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  17489. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  17490. pixels to be used as identity matrix for 3D lookup tables. Each component is
  17491. coded on a @code{1/(N*N)} scale.
  17492. @item color, c
  17493. Specify the color of the source, only available in the @code{color}
  17494. source. For the syntax of this option, check the
  17495. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17496. @item size, s
  17497. Specify the size of the sourced video. For the syntax of this option, check the
  17498. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17499. The default value is @code{320x240}.
  17500. This option is not available with the @code{allrgb}, @code{allyuv}, and
  17501. @code{haldclutsrc} filters.
  17502. @item rate, r
  17503. Specify the frame rate of the sourced video, as the number of frames
  17504. generated per second. It has to be a string in the format
  17505. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17506. number or a valid video frame rate abbreviation. The default value is
  17507. "25".
  17508. @item duration, d
  17509. Set the duration of the sourced video. See
  17510. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17511. for the accepted syntax.
  17512. If not specified, or the expressed duration is negative, the video is
  17513. supposed to be generated forever.
  17514. Since the frame rate is used as time base, all frames including the last one
  17515. will have their full duration. If the specified duration is not a multiple
  17516. of the frame duration, it will be rounded up.
  17517. @item sar
  17518. Set the sample aspect ratio of the sourced video.
  17519. @item alpha
  17520. Specify the alpha (opacity) of the background, only available in the
  17521. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  17522. 255 (fully opaque, the default).
  17523. @item decimals, n
  17524. Set the number of decimals to show in the timestamp, only available in the
  17525. @code{testsrc} source.
  17526. The displayed timestamp value will correspond to the original
  17527. timestamp value multiplied by the power of 10 of the specified
  17528. value. Default value is 0.
  17529. @end table
  17530. @subsection Examples
  17531. @itemize
  17532. @item
  17533. Generate a video with a duration of 5.3 seconds, with size
  17534. 176x144 and a frame rate of 10 frames per second:
  17535. @example
  17536. testsrc=duration=5.3:size=qcif:rate=10
  17537. @end example
  17538. @item
  17539. The following graph description will generate a red source
  17540. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  17541. frames per second:
  17542. @example
  17543. color=c=red@@0.2:s=qcif:r=10
  17544. @end example
  17545. @item
  17546. If the input content is to be ignored, @code{nullsrc} can be used. The
  17547. following command generates noise in the luminance plane by employing
  17548. the @code{geq} filter:
  17549. @example
  17550. nullsrc=s=256x256, geq=random(1)*255:128:128
  17551. @end example
  17552. @end itemize
  17553. @subsection Commands
  17554. The @code{color} source supports the following commands:
  17555. @table @option
  17556. @item c, color
  17557. Set the color of the created image. Accepts the same syntax of the
  17558. corresponding @option{color} option.
  17559. @end table
  17560. @section openclsrc
  17561. Generate video using an OpenCL program.
  17562. @table @option
  17563. @item source
  17564. OpenCL program source file.
  17565. @item kernel
  17566. Kernel name in program.
  17567. @item size, s
  17568. Size of frames to generate. This must be set.
  17569. @item format
  17570. Pixel format to use for the generated frames. This must be set.
  17571. @item rate, r
  17572. Number of frames generated every second. Default value is '25'.
  17573. @end table
  17574. For details of how the program loading works, see the @ref{program_opencl}
  17575. filter.
  17576. Example programs:
  17577. @itemize
  17578. @item
  17579. Generate a colour ramp by setting pixel values from the position of the pixel
  17580. in the output image. (Note that this will work with all pixel formats, but
  17581. the generated output will not be the same.)
  17582. @verbatim
  17583. __kernel void ramp(__write_only image2d_t dst,
  17584. unsigned int index)
  17585. {
  17586. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17587. float4 val;
  17588. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  17589. write_imagef(dst, loc, val);
  17590. }
  17591. @end verbatim
  17592. @item
  17593. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  17594. @verbatim
  17595. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  17596. unsigned int index)
  17597. {
  17598. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17599. float4 value = 0.0f;
  17600. int x = loc.x + index;
  17601. int y = loc.y + index;
  17602. while (x > 0 || y > 0) {
  17603. if (x % 3 == 1 && y % 3 == 1) {
  17604. value = 1.0f;
  17605. break;
  17606. }
  17607. x /= 3;
  17608. y /= 3;
  17609. }
  17610. write_imagef(dst, loc, value);
  17611. }
  17612. @end verbatim
  17613. @end itemize
  17614. @section sierpinski
  17615. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  17616. This source accepts the following options:
  17617. @table @option
  17618. @item size, s
  17619. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17620. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17621. @item rate, r
  17622. Set frame rate, expressed as number of frames per second. Default
  17623. value is "25".
  17624. @item seed
  17625. Set seed which is used for random panning.
  17626. @item jump
  17627. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  17628. @item type
  17629. Set fractal type, can be default @code{carpet} or @code{triangle}.
  17630. @end table
  17631. @c man end VIDEO SOURCES
  17632. @chapter Video Sinks
  17633. @c man begin VIDEO SINKS
  17634. Below is a description of the currently available video sinks.
  17635. @section buffersink
  17636. Buffer video frames, and make them available to the end of the filter
  17637. graph.
  17638. This sink is mainly intended for programmatic use, in particular
  17639. through the interface defined in @file{libavfilter/buffersink.h}
  17640. or the options system.
  17641. It accepts a pointer to an AVBufferSinkContext structure, which
  17642. defines the incoming buffers' formats, to be passed as the opaque
  17643. parameter to @code{avfilter_init_filter} for initialization.
  17644. @section nullsink
  17645. Null video sink: do absolutely nothing with the input video. It is
  17646. mainly useful as a template and for use in analysis / debugging
  17647. tools.
  17648. @c man end VIDEO SINKS
  17649. @chapter Multimedia Filters
  17650. @c man begin MULTIMEDIA FILTERS
  17651. Below is a description of the currently available multimedia filters.
  17652. @section abitscope
  17653. Convert input audio to a video output, displaying the audio bit scope.
  17654. The filter accepts the following options:
  17655. @table @option
  17656. @item rate, r
  17657. Set frame rate, expressed as number of frames per second. Default
  17658. value is "25".
  17659. @item size, s
  17660. Specify the video size for the output. For the syntax of this option, check the
  17661. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17662. Default value is @code{1024x256}.
  17663. @item colors
  17664. Specify list of colors separated by space or by '|' which will be used to
  17665. draw channels. Unrecognized or missing colors will be replaced
  17666. by white color.
  17667. @end table
  17668. @section adrawgraph
  17669. Draw a graph using input audio metadata.
  17670. See @ref{drawgraph}
  17671. @section agraphmonitor
  17672. See @ref{graphmonitor}.
  17673. @section ahistogram
  17674. Convert input audio to a video output, displaying the volume histogram.
  17675. The filter accepts the following options:
  17676. @table @option
  17677. @item dmode
  17678. Specify how histogram is calculated.
  17679. It accepts the following values:
  17680. @table @samp
  17681. @item single
  17682. Use single histogram for all channels.
  17683. @item separate
  17684. Use separate histogram for each channel.
  17685. @end table
  17686. Default is @code{single}.
  17687. @item rate, r
  17688. Set frame rate, expressed as number of frames per second. Default
  17689. value is "25".
  17690. @item size, s
  17691. Specify the video size for the output. For the syntax of this option, check the
  17692. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17693. Default value is @code{hd720}.
  17694. @item scale
  17695. Set display scale.
  17696. It accepts the following values:
  17697. @table @samp
  17698. @item log
  17699. logarithmic
  17700. @item sqrt
  17701. square root
  17702. @item cbrt
  17703. cubic root
  17704. @item lin
  17705. linear
  17706. @item rlog
  17707. reverse logarithmic
  17708. @end table
  17709. Default is @code{log}.
  17710. @item ascale
  17711. Set amplitude scale.
  17712. It accepts the following values:
  17713. @table @samp
  17714. @item log
  17715. logarithmic
  17716. @item lin
  17717. linear
  17718. @end table
  17719. Default is @code{log}.
  17720. @item acount
  17721. Set how much frames to accumulate in histogram.
  17722. Default is 1. Setting this to -1 accumulates all frames.
  17723. @item rheight
  17724. Set histogram ratio of window height.
  17725. @item slide
  17726. Set sonogram sliding.
  17727. It accepts the following values:
  17728. @table @samp
  17729. @item replace
  17730. replace old rows with new ones.
  17731. @item scroll
  17732. scroll from top to bottom.
  17733. @end table
  17734. Default is @code{replace}.
  17735. @end table
  17736. @section aphasemeter
  17737. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  17738. representing mean phase of current audio frame. A video output can also be produced and is
  17739. enabled by default. The audio is passed through as first output.
  17740. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  17741. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  17742. and @code{1} means channels are in phase.
  17743. The filter accepts the following options, all related to its video output:
  17744. @table @option
  17745. @item rate, r
  17746. Set the output frame rate. Default value is @code{25}.
  17747. @item size, s
  17748. Set the video size for the output. For the syntax of this option, check the
  17749. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17750. Default value is @code{800x400}.
  17751. @item rc
  17752. @item gc
  17753. @item bc
  17754. Specify the red, green, blue contrast. Default values are @code{2},
  17755. @code{7} and @code{1}.
  17756. Allowed range is @code{[0, 255]}.
  17757. @item mpc
  17758. Set color which will be used for drawing median phase. If color is
  17759. @code{none} which is default, no median phase value will be drawn.
  17760. @item video
  17761. Enable video output. Default is enabled.
  17762. @end table
  17763. @subsection phasing detection
  17764. The filter also detects out of phase and mono sequences in stereo streams.
  17765. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  17766. The filter accepts the following options for this detection:
  17767. @table @option
  17768. @item phasing
  17769. Enable mono and out of phase detection. Default is disabled.
  17770. @item tolerance, t
  17771. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  17772. Allowed range is @code{[0, 1]}.
  17773. @item angle, a
  17774. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  17775. Allowed range is @code{[90, 180]}.
  17776. @item duration, d
  17777. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  17778. @end table
  17779. @subsection Examples
  17780. @itemize
  17781. @item
  17782. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  17783. @example
  17784. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  17785. @end example
  17786. @end itemize
  17787. @section avectorscope
  17788. Convert input audio to a video output, representing the audio vector
  17789. scope.
  17790. The filter is used to measure the difference between channels of stereo
  17791. audio stream. A monaural signal, consisting of identical left and right
  17792. signal, results in straight vertical line. Any stereo separation is visible
  17793. as a deviation from this line, creating a Lissajous figure.
  17794. If the straight (or deviation from it) but horizontal line appears this
  17795. indicates that the left and right channels are out of phase.
  17796. The filter accepts the following options:
  17797. @table @option
  17798. @item mode, m
  17799. Set the vectorscope mode.
  17800. Available values are:
  17801. @table @samp
  17802. @item lissajous
  17803. Lissajous rotated by 45 degrees.
  17804. @item lissajous_xy
  17805. Same as above but not rotated.
  17806. @item polar
  17807. Shape resembling half of circle.
  17808. @end table
  17809. Default value is @samp{lissajous}.
  17810. @item size, s
  17811. Set the video size for the output. For the syntax of this option, check the
  17812. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17813. Default value is @code{400x400}.
  17814. @item rate, r
  17815. Set the output frame rate. Default value is @code{25}.
  17816. @item rc
  17817. @item gc
  17818. @item bc
  17819. @item ac
  17820. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  17821. @code{160}, @code{80} and @code{255}.
  17822. Allowed range is @code{[0, 255]}.
  17823. @item rf
  17824. @item gf
  17825. @item bf
  17826. @item af
  17827. Specify the red, green, blue and alpha fade. Default values are @code{15},
  17828. @code{10}, @code{5} and @code{5}.
  17829. Allowed range is @code{[0, 255]}.
  17830. @item zoom
  17831. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  17832. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  17833. @item draw
  17834. Set the vectorscope drawing mode.
  17835. Available values are:
  17836. @table @samp
  17837. @item dot
  17838. Draw dot for each sample.
  17839. @item line
  17840. Draw line between previous and current sample.
  17841. @end table
  17842. Default value is @samp{dot}.
  17843. @item scale
  17844. Specify amplitude scale of audio samples.
  17845. Available values are:
  17846. @table @samp
  17847. @item lin
  17848. Linear.
  17849. @item sqrt
  17850. Square root.
  17851. @item cbrt
  17852. Cubic root.
  17853. @item log
  17854. Logarithmic.
  17855. @end table
  17856. @item swap
  17857. Swap left channel axis with right channel axis.
  17858. @item mirror
  17859. Mirror axis.
  17860. @table @samp
  17861. @item none
  17862. No mirror.
  17863. @item x
  17864. Mirror only x axis.
  17865. @item y
  17866. Mirror only y axis.
  17867. @item xy
  17868. Mirror both axis.
  17869. @end table
  17870. @end table
  17871. @subsection Examples
  17872. @itemize
  17873. @item
  17874. Complete example using @command{ffplay}:
  17875. @example
  17876. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17877. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  17878. @end example
  17879. @end itemize
  17880. @section bench, abench
  17881. Benchmark part of a filtergraph.
  17882. The filter accepts the following options:
  17883. @table @option
  17884. @item action
  17885. Start or stop a timer.
  17886. Available values are:
  17887. @table @samp
  17888. @item start
  17889. Get the current time, set it as frame metadata (using the key
  17890. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  17891. @item stop
  17892. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  17893. the input frame metadata to get the time difference. Time difference, average,
  17894. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  17895. @code{min}) are then printed. The timestamps are expressed in seconds.
  17896. @end table
  17897. @end table
  17898. @subsection Examples
  17899. @itemize
  17900. @item
  17901. Benchmark @ref{selectivecolor} filter:
  17902. @example
  17903. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  17904. @end example
  17905. @end itemize
  17906. @section concat
  17907. Concatenate audio and video streams, joining them together one after the
  17908. other.
  17909. The filter works on segments of synchronized video and audio streams. All
  17910. segments must have the same number of streams of each type, and that will
  17911. also be the number of streams at output.
  17912. The filter accepts the following options:
  17913. @table @option
  17914. @item n
  17915. Set the number of segments. Default is 2.
  17916. @item v
  17917. Set the number of output video streams, that is also the number of video
  17918. streams in each segment. Default is 1.
  17919. @item a
  17920. Set the number of output audio streams, that is also the number of audio
  17921. streams in each segment. Default is 0.
  17922. @item unsafe
  17923. Activate unsafe mode: do not fail if segments have a different format.
  17924. @end table
  17925. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  17926. @var{a} audio outputs.
  17927. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  17928. segment, in the same order as the outputs, then the inputs for the second
  17929. segment, etc.
  17930. Related streams do not always have exactly the same duration, for various
  17931. reasons including codec frame size or sloppy authoring. For that reason,
  17932. related synchronized streams (e.g. a video and its audio track) should be
  17933. concatenated at once. The concat filter will use the duration of the longest
  17934. stream in each segment (except the last one), and if necessary pad shorter
  17935. audio streams with silence.
  17936. For this filter to work correctly, all segments must start at timestamp 0.
  17937. All corresponding streams must have the same parameters in all segments; the
  17938. filtering system will automatically select a common pixel format for video
  17939. streams, and a common sample format, sample rate and channel layout for
  17940. audio streams, but other settings, such as resolution, must be converted
  17941. explicitly by the user.
  17942. Different frame rates are acceptable but will result in variable frame rate
  17943. at output; be sure to configure the output file to handle it.
  17944. @subsection Examples
  17945. @itemize
  17946. @item
  17947. Concatenate an opening, an episode and an ending, all in bilingual version
  17948. (video in stream 0, audio in streams 1 and 2):
  17949. @example
  17950. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  17951. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  17952. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  17953. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  17954. @end example
  17955. @item
  17956. Concatenate two parts, handling audio and video separately, using the
  17957. (a)movie sources, and adjusting the resolution:
  17958. @example
  17959. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  17960. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  17961. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  17962. @end example
  17963. Note that a desync will happen at the stitch if the audio and video streams
  17964. do not have exactly the same duration in the first file.
  17965. @end itemize
  17966. @subsection Commands
  17967. This filter supports the following commands:
  17968. @table @option
  17969. @item next
  17970. Close the current segment and step to the next one
  17971. @end table
  17972. @anchor{ebur128}
  17973. @section ebur128
  17974. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  17975. level. By default, it logs a message at a frequency of 10Hz with the
  17976. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  17977. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  17978. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  17979. sample format is double-precision floating point. The input stream will be converted to
  17980. this specification, if needed. Users may need to insert aformat and/or aresample filters
  17981. after this filter to obtain the original parameters.
  17982. The filter also has a video output (see the @var{video} option) with a real
  17983. time graph to observe the loudness evolution. The graphic contains the logged
  17984. message mentioned above, so it is not printed anymore when this option is set,
  17985. unless the verbose logging is set. The main graphing area contains the
  17986. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  17987. the momentary loudness (400 milliseconds), but can optionally be configured
  17988. to instead display short-term loudness (see @var{gauge}).
  17989. The green area marks a +/- 1LU target range around the target loudness
  17990. (-23LUFS by default, unless modified through @var{target}).
  17991. More information about the Loudness Recommendation EBU R128 on
  17992. @url{http://tech.ebu.ch/loudness}.
  17993. The filter accepts the following options:
  17994. @table @option
  17995. @item video
  17996. Activate the video output. The audio stream is passed unchanged whether this
  17997. option is set or no. The video stream will be the first output stream if
  17998. activated. Default is @code{0}.
  17999. @item size
  18000. Set the video size. This option is for video only. For the syntax of this
  18001. option, check the
  18002. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18003. Default and minimum resolution is @code{640x480}.
  18004. @item meter
  18005. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  18006. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  18007. other integer value between this range is allowed.
  18008. @item metadata
  18009. Set metadata injection. If set to @code{1}, the audio input will be segmented
  18010. into 100ms output frames, each of them containing various loudness information
  18011. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  18012. Default is @code{0}.
  18013. @item framelog
  18014. Force the frame logging level.
  18015. Available values are:
  18016. @table @samp
  18017. @item info
  18018. information logging level
  18019. @item verbose
  18020. verbose logging level
  18021. @end table
  18022. By default, the logging level is set to @var{info}. If the @option{video} or
  18023. the @option{metadata} options are set, it switches to @var{verbose}.
  18024. @item peak
  18025. Set peak mode(s).
  18026. Available modes can be cumulated (the option is a @code{flag} type). Possible
  18027. values are:
  18028. @table @samp
  18029. @item none
  18030. Disable any peak mode (default).
  18031. @item sample
  18032. Enable sample-peak mode.
  18033. Simple peak mode looking for the higher sample value. It logs a message
  18034. for sample-peak (identified by @code{SPK}).
  18035. @item true
  18036. Enable true-peak mode.
  18037. If enabled, the peak lookup is done on an over-sampled version of the input
  18038. stream for better peak accuracy. It logs a message for true-peak.
  18039. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  18040. This mode requires a build with @code{libswresample}.
  18041. @end table
  18042. @item dualmono
  18043. Treat mono input files as "dual mono". If a mono file is intended for playback
  18044. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  18045. If set to @code{true}, this option will compensate for this effect.
  18046. Multi-channel input files are not affected by this option.
  18047. @item panlaw
  18048. Set a specific pan law to be used for the measurement of dual mono files.
  18049. This parameter is optional, and has a default value of -3.01dB.
  18050. @item target
  18051. Set a specific target level (in LUFS) used as relative zero in the visualization.
  18052. This parameter is optional and has a default value of -23LUFS as specified
  18053. by EBU R128. However, material published online may prefer a level of -16LUFS
  18054. (e.g. for use with podcasts or video platforms).
  18055. @item gauge
  18056. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  18057. @code{shortterm}. By default the momentary value will be used, but in certain
  18058. scenarios it may be more useful to observe the short term value instead (e.g.
  18059. live mixing).
  18060. @item scale
  18061. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  18062. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  18063. video output, not the summary or continuous log output.
  18064. @end table
  18065. @subsection Examples
  18066. @itemize
  18067. @item
  18068. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  18069. @example
  18070. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  18071. @end example
  18072. @item
  18073. Run an analysis with @command{ffmpeg}:
  18074. @example
  18075. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  18076. @end example
  18077. @end itemize
  18078. @section interleave, ainterleave
  18079. Temporally interleave frames from several inputs.
  18080. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  18081. These filters read frames from several inputs and send the oldest
  18082. queued frame to the output.
  18083. Input streams must have well defined, monotonically increasing frame
  18084. timestamp values.
  18085. In order to submit one frame to output, these filters need to enqueue
  18086. at least one frame for each input, so they cannot work in case one
  18087. input is not yet terminated and will not receive incoming frames.
  18088. For example consider the case when one input is a @code{select} filter
  18089. which always drops input frames. The @code{interleave} filter will keep
  18090. reading from that input, but it will never be able to send new frames
  18091. to output until the input sends an end-of-stream signal.
  18092. Also, depending on inputs synchronization, the filters will drop
  18093. frames in case one input receives more frames than the other ones, and
  18094. the queue is already filled.
  18095. These filters accept the following options:
  18096. @table @option
  18097. @item nb_inputs, n
  18098. Set the number of different inputs, it is 2 by default.
  18099. @item duration
  18100. How to determine the end-of-stream.
  18101. @table @option
  18102. @item longest
  18103. The duration of the longest input. (default)
  18104. @item shortest
  18105. The duration of the shortest input.
  18106. @item first
  18107. The duration of the first input.
  18108. @end table
  18109. @end table
  18110. @subsection Examples
  18111. @itemize
  18112. @item
  18113. Interleave frames belonging to different streams using @command{ffmpeg}:
  18114. @example
  18115. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  18116. @end example
  18117. @item
  18118. Add flickering blur effect:
  18119. @example
  18120. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  18121. @end example
  18122. @end itemize
  18123. @section metadata, ametadata
  18124. Manipulate frame metadata.
  18125. This filter accepts the following options:
  18126. @table @option
  18127. @item mode
  18128. Set mode of operation of the filter.
  18129. Can be one of the following:
  18130. @table @samp
  18131. @item select
  18132. If both @code{value} and @code{key} is set, select frames
  18133. which have such metadata. If only @code{key} is set, select
  18134. every frame that has such key in metadata.
  18135. @item add
  18136. Add new metadata @code{key} and @code{value}. If key is already available
  18137. do nothing.
  18138. @item modify
  18139. Modify value of already present key.
  18140. @item delete
  18141. If @code{value} is set, delete only keys that have such value.
  18142. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  18143. the frame.
  18144. @item print
  18145. Print key and its value if metadata was found. If @code{key} is not set print all
  18146. metadata values available in frame.
  18147. @end table
  18148. @item key
  18149. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  18150. @item value
  18151. Set metadata value which will be used. This option is mandatory for
  18152. @code{modify} and @code{add} mode.
  18153. @item function
  18154. Which function to use when comparing metadata value and @code{value}.
  18155. Can be one of following:
  18156. @table @samp
  18157. @item same_str
  18158. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  18159. @item starts_with
  18160. Values are interpreted as strings, returns true if metadata value starts with
  18161. the @code{value} option string.
  18162. @item less
  18163. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  18164. @item equal
  18165. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  18166. @item greater
  18167. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  18168. @item expr
  18169. Values are interpreted as floats, returns true if expression from option @code{expr}
  18170. evaluates to true.
  18171. @item ends_with
  18172. Values are interpreted as strings, returns true if metadata value ends with
  18173. the @code{value} option string.
  18174. @end table
  18175. @item expr
  18176. Set expression which is used when @code{function} is set to @code{expr}.
  18177. The expression is evaluated through the eval API and can contain the following
  18178. constants:
  18179. @table @option
  18180. @item VALUE1
  18181. Float representation of @code{value} from metadata key.
  18182. @item VALUE2
  18183. Float representation of @code{value} as supplied by user in @code{value} option.
  18184. @end table
  18185. @item file
  18186. If specified in @code{print} mode, output is written to the named file. Instead of
  18187. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  18188. for standard output. If @code{file} option is not set, output is written to the log
  18189. with AV_LOG_INFO loglevel.
  18190. @item direct
  18191. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  18192. @end table
  18193. @subsection Examples
  18194. @itemize
  18195. @item
  18196. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  18197. between 0 and 1.
  18198. @example
  18199. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  18200. @end example
  18201. @item
  18202. Print silencedetect output to file @file{metadata.txt}.
  18203. @example
  18204. silencedetect,ametadata=mode=print:file=metadata.txt
  18205. @end example
  18206. @item
  18207. Direct all metadata to a pipe with file descriptor 4.
  18208. @example
  18209. metadata=mode=print:file='pipe\:4'
  18210. @end example
  18211. @end itemize
  18212. @section perms, aperms
  18213. Set read/write permissions for the output frames.
  18214. These filters are mainly aimed at developers to test direct path in the
  18215. following filter in the filtergraph.
  18216. The filters accept the following options:
  18217. @table @option
  18218. @item mode
  18219. Select the permissions mode.
  18220. It accepts the following values:
  18221. @table @samp
  18222. @item none
  18223. Do nothing. This is the default.
  18224. @item ro
  18225. Set all the output frames read-only.
  18226. @item rw
  18227. Set all the output frames directly writable.
  18228. @item toggle
  18229. Make the frame read-only if writable, and writable if read-only.
  18230. @item random
  18231. Set each output frame read-only or writable randomly.
  18232. @end table
  18233. @item seed
  18234. Set the seed for the @var{random} mode, must be an integer included between
  18235. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  18236. @code{-1}, the filter will try to use a good random seed on a best effort
  18237. basis.
  18238. @end table
  18239. Note: in case of auto-inserted filter between the permission filter and the
  18240. following one, the permission might not be received as expected in that
  18241. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  18242. perms/aperms filter can avoid this problem.
  18243. @section realtime, arealtime
  18244. Slow down filtering to match real time approximately.
  18245. These filters will pause the filtering for a variable amount of time to
  18246. match the output rate with the input timestamps.
  18247. They are similar to the @option{re} option to @code{ffmpeg}.
  18248. They accept the following options:
  18249. @table @option
  18250. @item limit
  18251. Time limit for the pauses. Any pause longer than that will be considered
  18252. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  18253. @item speed
  18254. Speed factor for processing. The value must be a float larger than zero.
  18255. Values larger than 1.0 will result in faster than realtime processing,
  18256. smaller will slow processing down. The @var{limit} is automatically adapted
  18257. accordingly. Default is 1.0.
  18258. A processing speed faster than what is possible without these filters cannot
  18259. be achieved.
  18260. @end table
  18261. @anchor{select}
  18262. @section select, aselect
  18263. Select frames to pass in output.
  18264. This filter accepts the following options:
  18265. @table @option
  18266. @item expr, e
  18267. Set expression, which is evaluated for each input frame.
  18268. If the expression is evaluated to zero, the frame is discarded.
  18269. If the evaluation result is negative or NaN, the frame is sent to the
  18270. first output; otherwise it is sent to the output with index
  18271. @code{ceil(val)-1}, assuming that the input index starts from 0.
  18272. For example a value of @code{1.2} corresponds to the output with index
  18273. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  18274. @item outputs, n
  18275. Set the number of outputs. The output to which to send the selected
  18276. frame is based on the result of the evaluation. Default value is 1.
  18277. @end table
  18278. The expression can contain the following constants:
  18279. @table @option
  18280. @item n
  18281. The (sequential) number of the filtered frame, starting from 0.
  18282. @item selected_n
  18283. The (sequential) number of the selected frame, starting from 0.
  18284. @item prev_selected_n
  18285. The sequential number of the last selected frame. It's NAN if undefined.
  18286. @item TB
  18287. The timebase of the input timestamps.
  18288. @item pts
  18289. The PTS (Presentation TimeStamp) of the filtered video frame,
  18290. expressed in @var{TB} units. It's NAN if undefined.
  18291. @item t
  18292. The PTS of the filtered video frame,
  18293. expressed in seconds. It's NAN if undefined.
  18294. @item prev_pts
  18295. The PTS of the previously filtered video frame. It's NAN if undefined.
  18296. @item prev_selected_pts
  18297. The PTS of the last previously filtered video frame. It's NAN if undefined.
  18298. @item prev_selected_t
  18299. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  18300. @item start_pts
  18301. The PTS of the first video frame in the video. It's NAN if undefined.
  18302. @item start_t
  18303. The time of the first video frame in the video. It's NAN if undefined.
  18304. @item pict_type @emph{(video only)}
  18305. The type of the filtered frame. It can assume one of the following
  18306. values:
  18307. @table @option
  18308. @item I
  18309. @item P
  18310. @item B
  18311. @item S
  18312. @item SI
  18313. @item SP
  18314. @item BI
  18315. @end table
  18316. @item interlace_type @emph{(video only)}
  18317. The frame interlace type. It can assume one of the following values:
  18318. @table @option
  18319. @item PROGRESSIVE
  18320. The frame is progressive (not interlaced).
  18321. @item TOPFIRST
  18322. The frame is top-field-first.
  18323. @item BOTTOMFIRST
  18324. The frame is bottom-field-first.
  18325. @end table
  18326. @item consumed_sample_n @emph{(audio only)}
  18327. the number of selected samples before the current frame
  18328. @item samples_n @emph{(audio only)}
  18329. the number of samples in the current frame
  18330. @item sample_rate @emph{(audio only)}
  18331. the input sample rate
  18332. @item key
  18333. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  18334. @item pos
  18335. the position in the file of the filtered frame, -1 if the information
  18336. is not available (e.g. for synthetic video)
  18337. @item scene @emph{(video only)}
  18338. value between 0 and 1 to indicate a new scene; a low value reflects a low
  18339. probability for the current frame to introduce a new scene, while a higher
  18340. value means the current frame is more likely to be one (see the example below)
  18341. @item concatdec_select
  18342. The concat demuxer can select only part of a concat input file by setting an
  18343. inpoint and an outpoint, but the output packets may not be entirely contained
  18344. in the selected interval. By using this variable, it is possible to skip frames
  18345. generated by the concat demuxer which are not exactly contained in the selected
  18346. interval.
  18347. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  18348. and the @var{lavf.concat.duration} packet metadata values which are also
  18349. present in the decoded frames.
  18350. The @var{concatdec_select} variable is -1 if the frame pts is at least
  18351. start_time and either the duration metadata is missing or the frame pts is less
  18352. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  18353. missing.
  18354. That basically means that an input frame is selected if its pts is within the
  18355. interval set by the concat demuxer.
  18356. @end table
  18357. The default value of the select expression is "1".
  18358. @subsection Examples
  18359. @itemize
  18360. @item
  18361. Select all frames in input:
  18362. @example
  18363. select
  18364. @end example
  18365. The example above is the same as:
  18366. @example
  18367. select=1
  18368. @end example
  18369. @item
  18370. Skip all frames:
  18371. @example
  18372. select=0
  18373. @end example
  18374. @item
  18375. Select only I-frames:
  18376. @example
  18377. select='eq(pict_type\,I)'
  18378. @end example
  18379. @item
  18380. Select one frame every 100:
  18381. @example
  18382. select='not(mod(n\,100))'
  18383. @end example
  18384. @item
  18385. Select only frames contained in the 10-20 time interval:
  18386. @example
  18387. select=between(t\,10\,20)
  18388. @end example
  18389. @item
  18390. Select only I-frames contained in the 10-20 time interval:
  18391. @example
  18392. select=between(t\,10\,20)*eq(pict_type\,I)
  18393. @end example
  18394. @item
  18395. Select frames with a minimum distance of 10 seconds:
  18396. @example
  18397. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  18398. @end example
  18399. @item
  18400. Use aselect to select only audio frames with samples number > 100:
  18401. @example
  18402. aselect='gt(samples_n\,100)'
  18403. @end example
  18404. @item
  18405. Create a mosaic of the first scenes:
  18406. @example
  18407. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  18408. @end example
  18409. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  18410. choice.
  18411. @item
  18412. Send even and odd frames to separate outputs, and compose them:
  18413. @example
  18414. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  18415. @end example
  18416. @item
  18417. Select useful frames from an ffconcat file which is using inpoints and
  18418. outpoints but where the source files are not intra frame only.
  18419. @example
  18420. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  18421. @end example
  18422. @end itemize
  18423. @section sendcmd, asendcmd
  18424. Send commands to filters in the filtergraph.
  18425. These filters read commands to be sent to other filters in the
  18426. filtergraph.
  18427. @code{sendcmd} must be inserted between two video filters,
  18428. @code{asendcmd} must be inserted between two audio filters, but apart
  18429. from that they act the same way.
  18430. The specification of commands can be provided in the filter arguments
  18431. with the @var{commands} option, or in a file specified by the
  18432. @var{filename} option.
  18433. These filters accept the following options:
  18434. @table @option
  18435. @item commands, c
  18436. Set the commands to be read and sent to the other filters.
  18437. @item filename, f
  18438. Set the filename of the commands to be read and sent to the other
  18439. filters.
  18440. @end table
  18441. @subsection Commands syntax
  18442. A commands description consists of a sequence of interval
  18443. specifications, comprising a list of commands to be executed when a
  18444. particular event related to that interval occurs. The occurring event
  18445. is typically the current frame time entering or leaving a given time
  18446. interval.
  18447. An interval is specified by the following syntax:
  18448. @example
  18449. @var{START}[-@var{END}] @var{COMMANDS};
  18450. @end example
  18451. The time interval is specified by the @var{START} and @var{END} times.
  18452. @var{END} is optional and defaults to the maximum time.
  18453. The current frame time is considered within the specified interval if
  18454. it is included in the interval [@var{START}, @var{END}), that is when
  18455. the time is greater or equal to @var{START} and is lesser than
  18456. @var{END}.
  18457. @var{COMMANDS} consists of a sequence of one or more command
  18458. specifications, separated by ",", relating to that interval. The
  18459. syntax of a command specification is given by:
  18460. @example
  18461. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  18462. @end example
  18463. @var{FLAGS} is optional and specifies the type of events relating to
  18464. the time interval which enable sending the specified command, and must
  18465. be a non-null sequence of identifier flags separated by "+" or "|" and
  18466. enclosed between "[" and "]".
  18467. The following flags are recognized:
  18468. @table @option
  18469. @item enter
  18470. The command is sent when the current frame timestamp enters the
  18471. specified interval. In other words, the command is sent when the
  18472. previous frame timestamp was not in the given interval, and the
  18473. current is.
  18474. @item leave
  18475. The command is sent when the current frame timestamp leaves the
  18476. specified interval. In other words, the command is sent when the
  18477. previous frame timestamp was in the given interval, and the
  18478. current is not.
  18479. @item expr
  18480. The command @var{ARG} is interpreted as expression and result of
  18481. expression is passed as @var{ARG}.
  18482. The expression is evaluated through the eval API and can contain the following
  18483. constants:
  18484. @table @option
  18485. @item POS
  18486. Original position in the file of the frame, or undefined if undefined
  18487. for the current frame.
  18488. @item PTS
  18489. The presentation timestamp in input.
  18490. @item N
  18491. The count of the input frame for video or audio, starting from 0.
  18492. @item T
  18493. The time in seconds of the current frame.
  18494. @item TS
  18495. The start time in seconds of the current command interval.
  18496. @item TE
  18497. The end time in seconds of the current command interval.
  18498. @item TI
  18499. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  18500. @end table
  18501. @end table
  18502. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  18503. assumed.
  18504. @var{TARGET} specifies the target of the command, usually the name of
  18505. the filter class or a specific filter instance name.
  18506. @var{COMMAND} specifies the name of the command for the target filter.
  18507. @var{ARG} is optional and specifies the optional list of argument for
  18508. the given @var{COMMAND}.
  18509. Between one interval specification and another, whitespaces, or
  18510. sequences of characters starting with @code{#} until the end of line,
  18511. are ignored and can be used to annotate comments.
  18512. A simplified BNF description of the commands specification syntax
  18513. follows:
  18514. @example
  18515. @var{COMMAND_FLAG} ::= "enter" | "leave"
  18516. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  18517. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  18518. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  18519. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  18520. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  18521. @end example
  18522. @subsection Examples
  18523. @itemize
  18524. @item
  18525. Specify audio tempo change at second 4:
  18526. @example
  18527. asendcmd=c='4.0 atempo tempo 1.5',atempo
  18528. @end example
  18529. @item
  18530. Target a specific filter instance:
  18531. @example
  18532. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  18533. @end example
  18534. @item
  18535. Specify a list of drawtext and hue commands in a file.
  18536. @example
  18537. # show text in the interval 5-10
  18538. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  18539. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  18540. # desaturate the image in the interval 15-20
  18541. 15.0-20.0 [enter] hue s 0,
  18542. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  18543. [leave] hue s 1,
  18544. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  18545. # apply an exponential saturation fade-out effect, starting from time 25
  18546. 25 [enter] hue s exp(25-t)
  18547. @end example
  18548. A filtergraph allowing to read and process the above command list
  18549. stored in a file @file{test.cmd}, can be specified with:
  18550. @example
  18551. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  18552. @end example
  18553. @end itemize
  18554. @anchor{setpts}
  18555. @section setpts, asetpts
  18556. Change the PTS (presentation timestamp) of the input frames.
  18557. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  18558. This filter accepts the following options:
  18559. @table @option
  18560. @item expr
  18561. The expression which is evaluated for each frame to construct its timestamp.
  18562. @end table
  18563. The expression is evaluated through the eval API and can contain the following
  18564. constants:
  18565. @table @option
  18566. @item FRAME_RATE, FR
  18567. frame rate, only defined for constant frame-rate video
  18568. @item PTS
  18569. The presentation timestamp in input
  18570. @item N
  18571. The count of the input frame for video or the number of consumed samples,
  18572. not including the current frame for audio, starting from 0.
  18573. @item NB_CONSUMED_SAMPLES
  18574. The number of consumed samples, not including the current frame (only
  18575. audio)
  18576. @item NB_SAMPLES, S
  18577. The number of samples in the current frame (only audio)
  18578. @item SAMPLE_RATE, SR
  18579. The audio sample rate.
  18580. @item STARTPTS
  18581. The PTS of the first frame.
  18582. @item STARTT
  18583. the time in seconds of the first frame
  18584. @item INTERLACED
  18585. State whether the current frame is interlaced.
  18586. @item T
  18587. the time in seconds of the current frame
  18588. @item POS
  18589. original position in the file of the frame, or undefined if undefined
  18590. for the current frame
  18591. @item PREV_INPTS
  18592. The previous input PTS.
  18593. @item PREV_INT
  18594. previous input time in seconds
  18595. @item PREV_OUTPTS
  18596. The previous output PTS.
  18597. @item PREV_OUTT
  18598. previous output time in seconds
  18599. @item RTCTIME
  18600. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  18601. instead.
  18602. @item RTCSTART
  18603. The wallclock (RTC) time at the start of the movie in microseconds.
  18604. @item TB
  18605. The timebase of the input timestamps.
  18606. @end table
  18607. @subsection Examples
  18608. @itemize
  18609. @item
  18610. Start counting PTS from zero
  18611. @example
  18612. setpts=PTS-STARTPTS
  18613. @end example
  18614. @item
  18615. Apply fast motion effect:
  18616. @example
  18617. setpts=0.5*PTS
  18618. @end example
  18619. @item
  18620. Apply slow motion effect:
  18621. @example
  18622. setpts=2.0*PTS
  18623. @end example
  18624. @item
  18625. Set fixed rate of 25 frames per second:
  18626. @example
  18627. setpts=N/(25*TB)
  18628. @end example
  18629. @item
  18630. Set fixed rate 25 fps with some jitter:
  18631. @example
  18632. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  18633. @end example
  18634. @item
  18635. Apply an offset of 10 seconds to the input PTS:
  18636. @example
  18637. setpts=PTS+10/TB
  18638. @end example
  18639. @item
  18640. Generate timestamps from a "live source" and rebase onto the current timebase:
  18641. @example
  18642. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  18643. @end example
  18644. @item
  18645. Generate timestamps by counting samples:
  18646. @example
  18647. asetpts=N/SR/TB
  18648. @end example
  18649. @end itemize
  18650. @section setrange
  18651. Force color range for the output video frame.
  18652. The @code{setrange} filter marks the color range property for the
  18653. output frames. It does not change the input frame, but only sets the
  18654. corresponding property, which affects how the frame is treated by
  18655. following filters.
  18656. The filter accepts the following options:
  18657. @table @option
  18658. @item range
  18659. Available values are:
  18660. @table @samp
  18661. @item auto
  18662. Keep the same color range property.
  18663. @item unspecified, unknown
  18664. Set the color range as unspecified.
  18665. @item limited, tv, mpeg
  18666. Set the color range as limited.
  18667. @item full, pc, jpeg
  18668. Set the color range as full.
  18669. @end table
  18670. @end table
  18671. @section settb, asettb
  18672. Set the timebase to use for the output frames timestamps.
  18673. It is mainly useful for testing timebase configuration.
  18674. It accepts the following parameters:
  18675. @table @option
  18676. @item expr, tb
  18677. The expression which is evaluated into the output timebase.
  18678. @end table
  18679. The value for @option{tb} is an arithmetic expression representing a
  18680. rational. The expression can contain the constants "AVTB" (the default
  18681. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  18682. audio only). Default value is "intb".
  18683. @subsection Examples
  18684. @itemize
  18685. @item
  18686. Set the timebase to 1/25:
  18687. @example
  18688. settb=expr=1/25
  18689. @end example
  18690. @item
  18691. Set the timebase to 1/10:
  18692. @example
  18693. settb=expr=0.1
  18694. @end example
  18695. @item
  18696. Set the timebase to 1001/1000:
  18697. @example
  18698. settb=1+0.001
  18699. @end example
  18700. @item
  18701. Set the timebase to 2*intb:
  18702. @example
  18703. settb=2*intb
  18704. @end example
  18705. @item
  18706. Set the default timebase value:
  18707. @example
  18708. settb=AVTB
  18709. @end example
  18710. @end itemize
  18711. @section showcqt
  18712. Convert input audio to a video output representing frequency spectrum
  18713. logarithmically using Brown-Puckette constant Q transform algorithm with
  18714. direct frequency domain coefficient calculation (but the transform itself
  18715. is not really constant Q, instead the Q factor is actually variable/clamped),
  18716. with musical tone scale, from E0 to D#10.
  18717. The filter accepts the following options:
  18718. @table @option
  18719. @item size, s
  18720. Specify the video size for the output. It must be even. For the syntax of this option,
  18721. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18722. Default value is @code{1920x1080}.
  18723. @item fps, rate, r
  18724. Set the output frame rate. Default value is @code{25}.
  18725. @item bar_h
  18726. Set the bargraph height. It must be even. Default value is @code{-1} which
  18727. computes the bargraph height automatically.
  18728. @item axis_h
  18729. Set the axis height. It must be even. Default value is @code{-1} which computes
  18730. the axis height automatically.
  18731. @item sono_h
  18732. Set the sonogram height. It must be even. Default value is @code{-1} which
  18733. computes the sonogram height automatically.
  18734. @item fullhd
  18735. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  18736. instead. Default value is @code{1}.
  18737. @item sono_v, volume
  18738. Specify the sonogram volume expression. It can contain variables:
  18739. @table @option
  18740. @item bar_v
  18741. the @var{bar_v} evaluated expression
  18742. @item frequency, freq, f
  18743. the frequency where it is evaluated
  18744. @item timeclamp, tc
  18745. the value of @var{timeclamp} option
  18746. @end table
  18747. and functions:
  18748. @table @option
  18749. @item a_weighting(f)
  18750. A-weighting of equal loudness
  18751. @item b_weighting(f)
  18752. B-weighting of equal loudness
  18753. @item c_weighting(f)
  18754. C-weighting of equal loudness.
  18755. @end table
  18756. Default value is @code{16}.
  18757. @item bar_v, volume2
  18758. Specify the bargraph volume expression. It can contain variables:
  18759. @table @option
  18760. @item sono_v
  18761. the @var{sono_v} evaluated expression
  18762. @item frequency, freq, f
  18763. the frequency where it is evaluated
  18764. @item timeclamp, tc
  18765. the value of @var{timeclamp} option
  18766. @end table
  18767. and functions:
  18768. @table @option
  18769. @item a_weighting(f)
  18770. A-weighting of equal loudness
  18771. @item b_weighting(f)
  18772. B-weighting of equal loudness
  18773. @item c_weighting(f)
  18774. C-weighting of equal loudness.
  18775. @end table
  18776. Default value is @code{sono_v}.
  18777. @item sono_g, gamma
  18778. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  18779. higher gamma makes the spectrum having more range. Default value is @code{3}.
  18780. Acceptable range is @code{[1, 7]}.
  18781. @item bar_g, gamma2
  18782. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  18783. @code{[1, 7]}.
  18784. @item bar_t
  18785. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  18786. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  18787. @item timeclamp, tc
  18788. Specify the transform timeclamp. At low frequency, there is trade-off between
  18789. accuracy in time domain and frequency domain. If timeclamp is lower,
  18790. event in time domain is represented more accurately (such as fast bass drum),
  18791. otherwise event in frequency domain is represented more accurately
  18792. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  18793. @item attack
  18794. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  18795. limits future samples by applying asymmetric windowing in time domain, useful
  18796. when low latency is required. Accepted range is @code{[0, 1]}.
  18797. @item basefreq
  18798. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  18799. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  18800. @item endfreq
  18801. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  18802. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  18803. @item coeffclamp
  18804. This option is deprecated and ignored.
  18805. @item tlength
  18806. Specify the transform length in time domain. Use this option to control accuracy
  18807. trade-off between time domain and frequency domain at every frequency sample.
  18808. It can contain variables:
  18809. @table @option
  18810. @item frequency, freq, f
  18811. the frequency where it is evaluated
  18812. @item timeclamp, tc
  18813. the value of @var{timeclamp} option.
  18814. @end table
  18815. Default value is @code{384*tc/(384+tc*f)}.
  18816. @item count
  18817. Specify the transform count for every video frame. Default value is @code{6}.
  18818. Acceptable range is @code{[1, 30]}.
  18819. @item fcount
  18820. Specify the transform count for every single pixel. Default value is @code{0},
  18821. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  18822. @item fontfile
  18823. Specify font file for use with freetype to draw the axis. If not specified,
  18824. use embedded font. Note that drawing with font file or embedded font is not
  18825. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  18826. option instead.
  18827. @item font
  18828. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  18829. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  18830. escaping.
  18831. @item fontcolor
  18832. Specify font color expression. This is arithmetic expression that should return
  18833. integer value 0xRRGGBB. It can contain variables:
  18834. @table @option
  18835. @item frequency, freq, f
  18836. the frequency where it is evaluated
  18837. @item timeclamp, tc
  18838. the value of @var{timeclamp} option
  18839. @end table
  18840. and functions:
  18841. @table @option
  18842. @item midi(f)
  18843. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  18844. @item r(x), g(x), b(x)
  18845. red, green, and blue value of intensity x.
  18846. @end table
  18847. Default value is @code{st(0, (midi(f)-59.5)/12);
  18848. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  18849. r(1-ld(1)) + b(ld(1))}.
  18850. @item axisfile
  18851. Specify image file to draw the axis. This option override @var{fontfile} and
  18852. @var{fontcolor} option.
  18853. @item axis, text
  18854. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  18855. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  18856. Default value is @code{1}.
  18857. @item csp
  18858. Set colorspace. The accepted values are:
  18859. @table @samp
  18860. @item unspecified
  18861. Unspecified (default)
  18862. @item bt709
  18863. BT.709
  18864. @item fcc
  18865. FCC
  18866. @item bt470bg
  18867. BT.470BG or BT.601-6 625
  18868. @item smpte170m
  18869. SMPTE-170M or BT.601-6 525
  18870. @item smpte240m
  18871. SMPTE-240M
  18872. @item bt2020ncl
  18873. BT.2020 with non-constant luminance
  18874. @end table
  18875. @item cscheme
  18876. Set spectrogram color scheme. This is list of floating point values with format
  18877. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  18878. The default is @code{1|0.5|0|0|0.5|1}.
  18879. @end table
  18880. @subsection Examples
  18881. @itemize
  18882. @item
  18883. Playing audio while showing the spectrum:
  18884. @example
  18885. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  18886. @end example
  18887. @item
  18888. Same as above, but with frame rate 30 fps:
  18889. @example
  18890. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  18891. @end example
  18892. @item
  18893. Playing at 1280x720:
  18894. @example
  18895. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  18896. @end example
  18897. @item
  18898. Disable sonogram display:
  18899. @example
  18900. sono_h=0
  18901. @end example
  18902. @item
  18903. A1 and its harmonics: A1, A2, (near)E3, A3:
  18904. @example
  18905. 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),
  18906. asplit[a][out1]; [a] showcqt [out0]'
  18907. @end example
  18908. @item
  18909. Same as above, but with more accuracy in frequency domain:
  18910. @example
  18911. 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),
  18912. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  18913. @end example
  18914. @item
  18915. Custom volume:
  18916. @example
  18917. bar_v=10:sono_v=bar_v*a_weighting(f)
  18918. @end example
  18919. @item
  18920. Custom gamma, now spectrum is linear to the amplitude.
  18921. @example
  18922. bar_g=2:sono_g=2
  18923. @end example
  18924. @item
  18925. Custom tlength equation:
  18926. @example
  18927. 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)))'
  18928. @end example
  18929. @item
  18930. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  18931. @example
  18932. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  18933. @end example
  18934. @item
  18935. Custom font using fontconfig:
  18936. @example
  18937. font='Courier New,Monospace,mono|bold'
  18938. @end example
  18939. @item
  18940. Custom frequency range with custom axis using image file:
  18941. @example
  18942. axisfile=myaxis.png:basefreq=40:endfreq=10000
  18943. @end example
  18944. @end itemize
  18945. @section showfreqs
  18946. Convert input audio to video output representing the audio power spectrum.
  18947. Audio amplitude is on Y-axis while frequency is on X-axis.
  18948. The filter accepts the following options:
  18949. @table @option
  18950. @item size, s
  18951. Specify size of video. For the syntax of this option, check the
  18952. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18953. Default is @code{1024x512}.
  18954. @item mode
  18955. Set display mode.
  18956. This set how each frequency bin will be represented.
  18957. It accepts the following values:
  18958. @table @samp
  18959. @item line
  18960. @item bar
  18961. @item dot
  18962. @end table
  18963. Default is @code{bar}.
  18964. @item ascale
  18965. Set amplitude scale.
  18966. It accepts the following values:
  18967. @table @samp
  18968. @item lin
  18969. Linear scale.
  18970. @item sqrt
  18971. Square root scale.
  18972. @item cbrt
  18973. Cubic root scale.
  18974. @item log
  18975. Logarithmic scale.
  18976. @end table
  18977. Default is @code{log}.
  18978. @item fscale
  18979. Set frequency scale.
  18980. It accepts the following values:
  18981. @table @samp
  18982. @item lin
  18983. Linear scale.
  18984. @item log
  18985. Logarithmic scale.
  18986. @item rlog
  18987. Reverse logarithmic scale.
  18988. @end table
  18989. Default is @code{lin}.
  18990. @item win_size
  18991. Set window size. Allowed range is from 16 to 65536.
  18992. Default is @code{2048}
  18993. @item win_func
  18994. Set windowing function.
  18995. It accepts the following values:
  18996. @table @samp
  18997. @item rect
  18998. @item bartlett
  18999. @item hanning
  19000. @item hamming
  19001. @item blackman
  19002. @item welch
  19003. @item flattop
  19004. @item bharris
  19005. @item bnuttall
  19006. @item bhann
  19007. @item sine
  19008. @item nuttall
  19009. @item lanczos
  19010. @item gauss
  19011. @item tukey
  19012. @item dolph
  19013. @item cauchy
  19014. @item parzen
  19015. @item poisson
  19016. @item bohman
  19017. @end table
  19018. Default is @code{hanning}.
  19019. @item overlap
  19020. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19021. which means optimal overlap for selected window function will be picked.
  19022. @item averaging
  19023. Set time averaging. Setting this to 0 will display current maximal peaks.
  19024. Default is @code{1}, which means time averaging is disabled.
  19025. @item colors
  19026. Specify list of colors separated by space or by '|' which will be used to
  19027. draw channel frequencies. Unrecognized or missing colors will be replaced
  19028. by white color.
  19029. @item cmode
  19030. Set channel display mode.
  19031. It accepts the following values:
  19032. @table @samp
  19033. @item combined
  19034. @item separate
  19035. @end table
  19036. Default is @code{combined}.
  19037. @item minamp
  19038. Set minimum amplitude used in @code{log} amplitude scaler.
  19039. @end table
  19040. @section showspatial
  19041. Convert stereo input audio to a video output, representing the spatial relationship
  19042. between two channels.
  19043. The filter accepts the following options:
  19044. @table @option
  19045. @item size, s
  19046. Specify the video size for the output. For the syntax of this option, check the
  19047. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19048. Default value is @code{512x512}.
  19049. @item win_size
  19050. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  19051. @item win_func
  19052. Set window function.
  19053. It accepts the following values:
  19054. @table @samp
  19055. @item rect
  19056. @item bartlett
  19057. @item hann
  19058. @item hanning
  19059. @item hamming
  19060. @item blackman
  19061. @item welch
  19062. @item flattop
  19063. @item bharris
  19064. @item bnuttall
  19065. @item bhann
  19066. @item sine
  19067. @item nuttall
  19068. @item lanczos
  19069. @item gauss
  19070. @item tukey
  19071. @item dolph
  19072. @item cauchy
  19073. @item parzen
  19074. @item poisson
  19075. @item bohman
  19076. @end table
  19077. Default value is @code{hann}.
  19078. @item overlap
  19079. Set ratio of overlap window. Default value is @code{0.5}.
  19080. When value is @code{1} overlap is set to recommended size for specific
  19081. window function currently used.
  19082. @end table
  19083. @anchor{showspectrum}
  19084. @section showspectrum
  19085. Convert input audio to a video output, representing the audio frequency
  19086. spectrum.
  19087. The filter accepts the following options:
  19088. @table @option
  19089. @item size, s
  19090. Specify the video size for the output. For the syntax of this option, check the
  19091. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19092. Default value is @code{640x512}.
  19093. @item slide
  19094. Specify how the spectrum should slide along the window.
  19095. It accepts the following values:
  19096. @table @samp
  19097. @item replace
  19098. the samples start again on the left when they reach the right
  19099. @item scroll
  19100. the samples scroll from right to left
  19101. @item fullframe
  19102. frames are only produced when the samples reach the right
  19103. @item rscroll
  19104. the samples scroll from left to right
  19105. @end table
  19106. Default value is @code{replace}.
  19107. @item mode
  19108. Specify display mode.
  19109. It accepts the following values:
  19110. @table @samp
  19111. @item combined
  19112. all channels are displayed in the same row
  19113. @item separate
  19114. all channels are displayed in separate rows
  19115. @end table
  19116. Default value is @samp{combined}.
  19117. @item color
  19118. Specify display color mode.
  19119. It accepts the following values:
  19120. @table @samp
  19121. @item channel
  19122. each channel is displayed in a separate color
  19123. @item intensity
  19124. each channel is displayed using the same color scheme
  19125. @item rainbow
  19126. each channel is displayed using the rainbow color scheme
  19127. @item moreland
  19128. each channel is displayed using the moreland color scheme
  19129. @item nebulae
  19130. each channel is displayed using the nebulae color scheme
  19131. @item fire
  19132. each channel is displayed using the fire color scheme
  19133. @item fiery
  19134. each channel is displayed using the fiery color scheme
  19135. @item fruit
  19136. each channel is displayed using the fruit color scheme
  19137. @item cool
  19138. each channel is displayed using the cool color scheme
  19139. @item magma
  19140. each channel is displayed using the magma color scheme
  19141. @item green
  19142. each channel is displayed using the green color scheme
  19143. @item viridis
  19144. each channel is displayed using the viridis color scheme
  19145. @item plasma
  19146. each channel is displayed using the plasma color scheme
  19147. @item cividis
  19148. each channel is displayed using the cividis color scheme
  19149. @item terrain
  19150. each channel is displayed using the terrain color scheme
  19151. @end table
  19152. Default value is @samp{channel}.
  19153. @item scale
  19154. Specify scale used for calculating intensity color values.
  19155. It accepts the following values:
  19156. @table @samp
  19157. @item lin
  19158. linear
  19159. @item sqrt
  19160. square root, default
  19161. @item cbrt
  19162. cubic root
  19163. @item log
  19164. logarithmic
  19165. @item 4thrt
  19166. 4th root
  19167. @item 5thrt
  19168. 5th root
  19169. @end table
  19170. Default value is @samp{sqrt}.
  19171. @item fscale
  19172. Specify frequency scale.
  19173. It accepts the following values:
  19174. @table @samp
  19175. @item lin
  19176. linear
  19177. @item log
  19178. logarithmic
  19179. @end table
  19180. Default value is @samp{lin}.
  19181. @item saturation
  19182. Set saturation modifier for displayed colors. Negative values provide
  19183. alternative color scheme. @code{0} is no saturation at all.
  19184. Saturation must be in [-10.0, 10.0] range.
  19185. Default value is @code{1}.
  19186. @item win_func
  19187. Set window function.
  19188. It accepts the following values:
  19189. @table @samp
  19190. @item rect
  19191. @item bartlett
  19192. @item hann
  19193. @item hanning
  19194. @item hamming
  19195. @item blackman
  19196. @item welch
  19197. @item flattop
  19198. @item bharris
  19199. @item bnuttall
  19200. @item bhann
  19201. @item sine
  19202. @item nuttall
  19203. @item lanczos
  19204. @item gauss
  19205. @item tukey
  19206. @item dolph
  19207. @item cauchy
  19208. @item parzen
  19209. @item poisson
  19210. @item bohman
  19211. @end table
  19212. Default value is @code{hann}.
  19213. @item orientation
  19214. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19215. @code{horizontal}. Default is @code{vertical}.
  19216. @item overlap
  19217. Set ratio of overlap window. Default value is @code{0}.
  19218. When value is @code{1} overlap is set to recommended size for specific
  19219. window function currently used.
  19220. @item gain
  19221. Set scale gain for calculating intensity color values.
  19222. Default value is @code{1}.
  19223. @item data
  19224. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  19225. @item rotation
  19226. Set color rotation, must be in [-1.0, 1.0] range.
  19227. Default value is @code{0}.
  19228. @item start
  19229. Set start frequency from which to display spectrogram. Default is @code{0}.
  19230. @item stop
  19231. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19232. @item fps
  19233. Set upper frame rate limit. Default is @code{auto}, unlimited.
  19234. @item legend
  19235. Draw time and frequency axes and legends. Default is disabled.
  19236. @end table
  19237. The usage is very similar to the showwaves filter; see the examples in that
  19238. section.
  19239. @subsection Examples
  19240. @itemize
  19241. @item
  19242. Large window with logarithmic color scaling:
  19243. @example
  19244. showspectrum=s=1280x480:scale=log
  19245. @end example
  19246. @item
  19247. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  19248. @example
  19249. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  19250. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  19251. @end example
  19252. @end itemize
  19253. @section showspectrumpic
  19254. Convert input audio to a single video frame, representing the audio frequency
  19255. spectrum.
  19256. The filter accepts the following options:
  19257. @table @option
  19258. @item size, s
  19259. Specify the video size for the output. For the syntax of this option, check the
  19260. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19261. Default value is @code{4096x2048}.
  19262. @item mode
  19263. Specify display mode.
  19264. It accepts the following values:
  19265. @table @samp
  19266. @item combined
  19267. all channels are displayed in the same row
  19268. @item separate
  19269. all channels are displayed in separate rows
  19270. @end table
  19271. Default value is @samp{combined}.
  19272. @item color
  19273. Specify display color mode.
  19274. It accepts the following values:
  19275. @table @samp
  19276. @item channel
  19277. each channel is displayed in a separate color
  19278. @item intensity
  19279. each channel is displayed using the same color scheme
  19280. @item rainbow
  19281. each channel is displayed using the rainbow color scheme
  19282. @item moreland
  19283. each channel is displayed using the moreland color scheme
  19284. @item nebulae
  19285. each channel is displayed using the nebulae color scheme
  19286. @item fire
  19287. each channel is displayed using the fire color scheme
  19288. @item fiery
  19289. each channel is displayed using the fiery color scheme
  19290. @item fruit
  19291. each channel is displayed using the fruit color scheme
  19292. @item cool
  19293. each channel is displayed using the cool color scheme
  19294. @item magma
  19295. each channel is displayed using the magma color scheme
  19296. @item green
  19297. each channel is displayed using the green color scheme
  19298. @item viridis
  19299. each channel is displayed using the viridis color scheme
  19300. @item plasma
  19301. each channel is displayed using the plasma color scheme
  19302. @item cividis
  19303. each channel is displayed using the cividis color scheme
  19304. @item terrain
  19305. each channel is displayed using the terrain color scheme
  19306. @end table
  19307. Default value is @samp{intensity}.
  19308. @item scale
  19309. Specify scale used for calculating intensity color values.
  19310. It accepts the following values:
  19311. @table @samp
  19312. @item lin
  19313. linear
  19314. @item sqrt
  19315. square root, default
  19316. @item cbrt
  19317. cubic root
  19318. @item log
  19319. logarithmic
  19320. @item 4thrt
  19321. 4th root
  19322. @item 5thrt
  19323. 5th root
  19324. @end table
  19325. Default value is @samp{log}.
  19326. @item fscale
  19327. Specify frequency scale.
  19328. It accepts the following values:
  19329. @table @samp
  19330. @item lin
  19331. linear
  19332. @item log
  19333. logarithmic
  19334. @end table
  19335. Default value is @samp{lin}.
  19336. @item saturation
  19337. Set saturation modifier for displayed colors. Negative values provide
  19338. alternative color scheme. @code{0} is no saturation at all.
  19339. Saturation must be in [-10.0, 10.0] range.
  19340. Default value is @code{1}.
  19341. @item win_func
  19342. Set window function.
  19343. It accepts the following values:
  19344. @table @samp
  19345. @item rect
  19346. @item bartlett
  19347. @item hann
  19348. @item hanning
  19349. @item hamming
  19350. @item blackman
  19351. @item welch
  19352. @item flattop
  19353. @item bharris
  19354. @item bnuttall
  19355. @item bhann
  19356. @item sine
  19357. @item nuttall
  19358. @item lanczos
  19359. @item gauss
  19360. @item tukey
  19361. @item dolph
  19362. @item cauchy
  19363. @item parzen
  19364. @item poisson
  19365. @item bohman
  19366. @end table
  19367. Default value is @code{hann}.
  19368. @item orientation
  19369. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19370. @code{horizontal}. Default is @code{vertical}.
  19371. @item gain
  19372. Set scale gain for calculating intensity color values.
  19373. Default value is @code{1}.
  19374. @item legend
  19375. Draw time and frequency axes and legends. Default is enabled.
  19376. @item rotation
  19377. Set color rotation, must be in [-1.0, 1.0] range.
  19378. Default value is @code{0}.
  19379. @item start
  19380. Set start frequency from which to display spectrogram. Default is @code{0}.
  19381. @item stop
  19382. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19383. @end table
  19384. @subsection Examples
  19385. @itemize
  19386. @item
  19387. Extract an audio spectrogram of a whole audio track
  19388. in a 1024x1024 picture using @command{ffmpeg}:
  19389. @example
  19390. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  19391. @end example
  19392. @end itemize
  19393. @section showvolume
  19394. Convert input audio volume to a video output.
  19395. The filter accepts the following options:
  19396. @table @option
  19397. @item rate, r
  19398. Set video rate.
  19399. @item b
  19400. Set border width, allowed range is [0, 5]. Default is 1.
  19401. @item w
  19402. Set channel width, allowed range is [80, 8192]. Default is 400.
  19403. @item h
  19404. Set channel height, allowed range is [1, 900]. Default is 20.
  19405. @item f
  19406. Set fade, allowed range is [0, 1]. Default is 0.95.
  19407. @item c
  19408. Set volume color expression.
  19409. The expression can use the following variables:
  19410. @table @option
  19411. @item VOLUME
  19412. Current max volume of channel in dB.
  19413. @item PEAK
  19414. Current peak.
  19415. @item CHANNEL
  19416. Current channel number, starting from 0.
  19417. @end table
  19418. @item t
  19419. If set, displays channel names. Default is enabled.
  19420. @item v
  19421. If set, displays volume values. Default is enabled.
  19422. @item o
  19423. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  19424. default is @code{h}.
  19425. @item s
  19426. Set step size, allowed range is [0, 5]. Default is 0, which means
  19427. step is disabled.
  19428. @item p
  19429. Set background opacity, allowed range is [0, 1]. Default is 0.
  19430. @item m
  19431. Set metering mode, can be peak: @code{p} or rms: @code{r},
  19432. default is @code{p}.
  19433. @item ds
  19434. Set display scale, can be linear: @code{lin} or log: @code{log},
  19435. default is @code{lin}.
  19436. @item dm
  19437. In second.
  19438. If set to > 0., display a line for the max level
  19439. in the previous seconds.
  19440. default is disabled: @code{0.}
  19441. @item dmc
  19442. The color of the max line. Use when @code{dm} option is set to > 0.
  19443. default is: @code{orange}
  19444. @end table
  19445. @section showwaves
  19446. Convert input audio to a video output, representing the samples waves.
  19447. The filter accepts the following options:
  19448. @table @option
  19449. @item size, s
  19450. Specify the video size for the output. For the syntax of this option, check the
  19451. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19452. Default value is @code{600x240}.
  19453. @item mode
  19454. Set display mode.
  19455. Available values are:
  19456. @table @samp
  19457. @item point
  19458. Draw a point for each sample.
  19459. @item line
  19460. Draw a vertical line for each sample.
  19461. @item p2p
  19462. Draw a point for each sample and a line between them.
  19463. @item cline
  19464. Draw a centered vertical line for each sample.
  19465. @end table
  19466. Default value is @code{point}.
  19467. @item n
  19468. Set the number of samples which are printed on the same column. A
  19469. larger value will decrease the frame rate. Must be a positive
  19470. integer. This option can be set only if the value for @var{rate}
  19471. is not explicitly specified.
  19472. @item rate, r
  19473. Set the (approximate) output frame rate. This is done by setting the
  19474. option @var{n}. Default value is "25".
  19475. @item split_channels
  19476. Set if channels should be drawn separately or overlap. Default value is 0.
  19477. @item colors
  19478. Set colors separated by '|' which are going to be used for drawing of each channel.
  19479. @item scale
  19480. Set amplitude scale.
  19481. Available values are:
  19482. @table @samp
  19483. @item lin
  19484. Linear.
  19485. @item log
  19486. Logarithmic.
  19487. @item sqrt
  19488. Square root.
  19489. @item cbrt
  19490. Cubic root.
  19491. @end table
  19492. Default is linear.
  19493. @item draw
  19494. Set the draw mode. This is mostly useful to set for high @var{n}.
  19495. Available values are:
  19496. @table @samp
  19497. @item scale
  19498. Scale pixel values for each drawn sample.
  19499. @item full
  19500. Draw every sample directly.
  19501. @end table
  19502. Default value is @code{scale}.
  19503. @end table
  19504. @subsection Examples
  19505. @itemize
  19506. @item
  19507. Output the input file audio and the corresponding video representation
  19508. at the same time:
  19509. @example
  19510. amovie=a.mp3,asplit[out0],showwaves[out1]
  19511. @end example
  19512. @item
  19513. Create a synthetic signal and show it with showwaves, forcing a
  19514. frame rate of 30 frames per second:
  19515. @example
  19516. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  19517. @end example
  19518. @end itemize
  19519. @section showwavespic
  19520. Convert input audio to a single video frame, representing the samples waves.
  19521. The filter accepts the following options:
  19522. @table @option
  19523. @item size, s
  19524. Specify the video size for the output. For the syntax of this option, check the
  19525. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19526. Default value is @code{600x240}.
  19527. @item split_channels
  19528. Set if channels should be drawn separately or overlap. Default value is 0.
  19529. @item colors
  19530. Set colors separated by '|' which are going to be used for drawing of each channel.
  19531. @item scale
  19532. Set amplitude scale.
  19533. Available values are:
  19534. @table @samp
  19535. @item lin
  19536. Linear.
  19537. @item log
  19538. Logarithmic.
  19539. @item sqrt
  19540. Square root.
  19541. @item cbrt
  19542. Cubic root.
  19543. @end table
  19544. Default is linear.
  19545. @item draw
  19546. Set the draw mode.
  19547. Available values are:
  19548. @table @samp
  19549. @item scale
  19550. Scale pixel values for each drawn sample.
  19551. @item full
  19552. Draw every sample directly.
  19553. @end table
  19554. Default value is @code{scale}.
  19555. @item filter
  19556. Set the filter mode.
  19557. Available values are:
  19558. @table @samp
  19559. @item average
  19560. Use average samples values for each drawn sample.
  19561. @item peak
  19562. Use peak samples values for each drawn sample.
  19563. @end table
  19564. Default value is @code{average}.
  19565. @end table
  19566. @subsection Examples
  19567. @itemize
  19568. @item
  19569. Extract a channel split representation of the wave form of a whole audio track
  19570. in a 1024x800 picture using @command{ffmpeg}:
  19571. @example
  19572. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  19573. @end example
  19574. @end itemize
  19575. @section sidedata, asidedata
  19576. Delete frame side data, or select frames based on it.
  19577. This filter accepts the following options:
  19578. @table @option
  19579. @item mode
  19580. Set mode of operation of the filter.
  19581. Can be one of the following:
  19582. @table @samp
  19583. @item select
  19584. Select every frame with side data of @code{type}.
  19585. @item delete
  19586. Delete side data of @code{type}. If @code{type} is not set, delete all side
  19587. data in the frame.
  19588. @end table
  19589. @item type
  19590. Set side data type used with all modes. Must be set for @code{select} mode. For
  19591. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  19592. in @file{libavutil/frame.h}. For example, to choose
  19593. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  19594. @end table
  19595. @section spectrumsynth
  19596. Synthesize audio from 2 input video spectrums, first input stream represents
  19597. magnitude across time and second represents phase across time.
  19598. The filter will transform from frequency domain as displayed in videos back
  19599. to time domain as presented in audio output.
  19600. This filter is primarily created for reversing processed @ref{showspectrum}
  19601. filter outputs, but can synthesize sound from other spectrograms too.
  19602. But in such case results are going to be poor if the phase data is not
  19603. available, because in such cases phase data need to be recreated, usually
  19604. it's just recreated from random noise.
  19605. For best results use gray only output (@code{channel} color mode in
  19606. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  19607. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  19608. @code{data} option. Inputs videos should generally use @code{fullframe}
  19609. slide mode as that saves resources needed for decoding video.
  19610. The filter accepts the following options:
  19611. @table @option
  19612. @item sample_rate
  19613. Specify sample rate of output audio, the sample rate of audio from which
  19614. spectrum was generated may differ.
  19615. @item channels
  19616. Set number of channels represented in input video spectrums.
  19617. @item scale
  19618. Set scale which was used when generating magnitude input spectrum.
  19619. Can be @code{lin} or @code{log}. Default is @code{log}.
  19620. @item slide
  19621. Set slide which was used when generating inputs spectrums.
  19622. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  19623. Default is @code{fullframe}.
  19624. @item win_func
  19625. Set window function used for resynthesis.
  19626. @item overlap
  19627. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19628. which means optimal overlap for selected window function will be picked.
  19629. @item orientation
  19630. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  19631. Default is @code{vertical}.
  19632. @end table
  19633. @subsection Examples
  19634. @itemize
  19635. @item
  19636. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  19637. then resynthesize videos back to audio with spectrumsynth:
  19638. @example
  19639. 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
  19640. 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
  19641. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  19642. @end example
  19643. @end itemize
  19644. @section split, asplit
  19645. Split input into several identical outputs.
  19646. @code{asplit} works with audio input, @code{split} with video.
  19647. The filter accepts a single parameter which specifies the number of outputs. If
  19648. unspecified, it defaults to 2.
  19649. @subsection Examples
  19650. @itemize
  19651. @item
  19652. Create two separate outputs from the same input:
  19653. @example
  19654. [in] split [out0][out1]
  19655. @end example
  19656. @item
  19657. To create 3 or more outputs, you need to specify the number of
  19658. outputs, like in:
  19659. @example
  19660. [in] asplit=3 [out0][out1][out2]
  19661. @end example
  19662. @item
  19663. Create two separate outputs from the same input, one cropped and
  19664. one padded:
  19665. @example
  19666. [in] split [splitout1][splitout2];
  19667. [splitout1] crop=100:100:0:0 [cropout];
  19668. [splitout2] pad=200:200:100:100 [padout];
  19669. @end example
  19670. @item
  19671. Create 5 copies of the input audio with @command{ffmpeg}:
  19672. @example
  19673. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  19674. @end example
  19675. @end itemize
  19676. @section zmq, azmq
  19677. Receive commands sent through a libzmq client, and forward them to
  19678. filters in the filtergraph.
  19679. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  19680. must be inserted between two video filters, @code{azmq} between two
  19681. audio filters. Both are capable to send messages to any filter type.
  19682. To enable these filters you need to install the libzmq library and
  19683. headers and configure FFmpeg with @code{--enable-libzmq}.
  19684. For more information about libzmq see:
  19685. @url{http://www.zeromq.org/}
  19686. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  19687. receives messages sent through a network interface defined by the
  19688. @option{bind_address} (or the abbreviation "@option{b}") option.
  19689. Default value of this option is @file{tcp://localhost:5555}. You may
  19690. want to alter this value to your needs, but do not forget to escape any
  19691. ':' signs (see @ref{filtergraph escaping}).
  19692. The received message must be in the form:
  19693. @example
  19694. @var{TARGET} @var{COMMAND} [@var{ARG}]
  19695. @end example
  19696. @var{TARGET} specifies the target of the command, usually the name of
  19697. the filter class or a specific filter instance name. The default
  19698. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  19699. but you can override this by using the @samp{filter_name@@id} syntax
  19700. (see @ref{Filtergraph syntax}).
  19701. @var{COMMAND} specifies the name of the command for the target filter.
  19702. @var{ARG} is optional and specifies the optional argument list for the
  19703. given @var{COMMAND}.
  19704. Upon reception, the message is processed and the corresponding command
  19705. is injected into the filtergraph. Depending on the result, the filter
  19706. will send a reply to the client, adopting the format:
  19707. @example
  19708. @var{ERROR_CODE} @var{ERROR_REASON}
  19709. @var{MESSAGE}
  19710. @end example
  19711. @var{MESSAGE} is optional.
  19712. @subsection Examples
  19713. Look at @file{tools/zmqsend} for an example of a zmq client which can
  19714. be used to send commands processed by these filters.
  19715. Consider the following filtergraph generated by @command{ffplay}.
  19716. In this example the last overlay filter has an instance name. All other
  19717. filters will have default instance names.
  19718. @example
  19719. ffplay -dumpgraph 1 -f lavfi "
  19720. color=s=100x100:c=red [l];
  19721. color=s=100x100:c=blue [r];
  19722. nullsrc=s=200x100, zmq [bg];
  19723. [bg][l] overlay [bg+l];
  19724. [bg+l][r] overlay@@my=x=100 "
  19725. @end example
  19726. To change the color of the left side of the video, the following
  19727. command can be used:
  19728. @example
  19729. echo Parsed_color_0 c yellow | tools/zmqsend
  19730. @end example
  19731. To change the right side:
  19732. @example
  19733. echo Parsed_color_1 c pink | tools/zmqsend
  19734. @end example
  19735. To change the position of the right side:
  19736. @example
  19737. echo overlay@@my x 150 | tools/zmqsend
  19738. @end example
  19739. @c man end MULTIMEDIA FILTERS
  19740. @chapter Multimedia Sources
  19741. @c man begin MULTIMEDIA SOURCES
  19742. Below is a description of the currently available multimedia sources.
  19743. @section amovie
  19744. This is the same as @ref{movie} source, except it selects an audio
  19745. stream by default.
  19746. @anchor{movie}
  19747. @section movie
  19748. Read audio and/or video stream(s) from a movie container.
  19749. It accepts the following parameters:
  19750. @table @option
  19751. @item filename
  19752. The name of the resource to read (not necessarily a file; it can also be a
  19753. device or a stream accessed through some protocol).
  19754. @item format_name, f
  19755. Specifies the format assumed for the movie to read, and can be either
  19756. the name of a container or an input device. If not specified, the
  19757. format is guessed from @var{movie_name} or by probing.
  19758. @item seek_point, sp
  19759. Specifies the seek point in seconds. The frames will be output
  19760. starting from this seek point. The parameter is evaluated with
  19761. @code{av_strtod}, so the numerical value may be suffixed by an IS
  19762. postfix. The default value is "0".
  19763. @item streams, s
  19764. Specifies the streams to read. Several streams can be specified,
  19765. separated by "+". The source will then have as many outputs, in the
  19766. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  19767. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  19768. respectively the default (best suited) video and audio stream. Default
  19769. is "dv", or "da" if the filter is called as "amovie".
  19770. @item stream_index, si
  19771. Specifies the index of the video stream to read. If the value is -1,
  19772. the most suitable video stream will be automatically selected. The default
  19773. value is "-1". Deprecated. If the filter is called "amovie", it will select
  19774. audio instead of video.
  19775. @item loop
  19776. Specifies how many times to read the stream in sequence.
  19777. If the value is 0, the stream will be looped infinitely.
  19778. Default value is "1".
  19779. Note that when the movie is looped the source timestamps are not
  19780. changed, so it will generate non monotonically increasing timestamps.
  19781. @item discontinuity
  19782. Specifies the time difference between frames above which the point is
  19783. considered a timestamp discontinuity which is removed by adjusting the later
  19784. timestamps.
  19785. @end table
  19786. It allows overlaying a second video on top of the main input of
  19787. a filtergraph, as shown in this graph:
  19788. @example
  19789. input -----------> deltapts0 --> overlay --> output
  19790. ^
  19791. |
  19792. movie --> scale--> deltapts1 -------+
  19793. @end example
  19794. @subsection Examples
  19795. @itemize
  19796. @item
  19797. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  19798. on top of the input labelled "in":
  19799. @example
  19800. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19801. [in] setpts=PTS-STARTPTS [main];
  19802. [main][over] overlay=16:16 [out]
  19803. @end example
  19804. @item
  19805. Read from a video4linux2 device, and overlay it on top of the input
  19806. labelled "in":
  19807. @example
  19808. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19809. [in] setpts=PTS-STARTPTS [main];
  19810. [main][over] overlay=16:16 [out]
  19811. @end example
  19812. @item
  19813. Read the first video stream and the audio stream with id 0x81 from
  19814. dvd.vob; the video is connected to the pad named "video" and the audio is
  19815. connected to the pad named "audio":
  19816. @example
  19817. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  19818. @end example
  19819. @end itemize
  19820. @subsection Commands
  19821. Both movie and amovie support the following commands:
  19822. @table @option
  19823. @item seek
  19824. Perform seek using "av_seek_frame".
  19825. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  19826. @itemize
  19827. @item
  19828. @var{stream_index}: If stream_index is -1, a default
  19829. stream is selected, and @var{timestamp} is automatically converted
  19830. from AV_TIME_BASE units to the stream specific time_base.
  19831. @item
  19832. @var{timestamp}: Timestamp in AVStream.time_base units
  19833. or, if no stream is specified, in AV_TIME_BASE units.
  19834. @item
  19835. @var{flags}: Flags which select direction and seeking mode.
  19836. @end itemize
  19837. @item get_duration
  19838. Get movie duration in AV_TIME_BASE units.
  19839. @end table
  19840. @c man end MULTIMEDIA SOURCES