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.

24188 lines
642KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{commands}
  252. @chapter Changing options at runtime with a command
  253. Some options can be changed during the operation of the filter using
  254. a command. These options are marked 'T' on the output of
  255. @command{ffmpeg} @option{-h filter=<name of filter>}.
  256. The name of the command is the name of the option and the argument is
  257. the new value.
  258. @anchor{framesync}
  259. @chapter Options for filters with several inputs (framesync)
  260. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  261. Some filters with several inputs support a common set of options.
  262. These options can only be set by name, not with the short notation.
  263. @table @option
  264. @item eof_action
  265. The action to take when EOF is encountered on the secondary input; it accepts
  266. one of the following values:
  267. @table @option
  268. @item repeat
  269. Repeat the last frame (the default).
  270. @item endall
  271. End both streams.
  272. @item pass
  273. Pass the main input through.
  274. @end table
  275. @item shortest
  276. If set to 1, force the output to terminate when the shortest input
  277. terminates. Default value is 0.
  278. @item repeatlast
  279. If set to 1, force the filter to extend the last frame of secondary streams
  280. until the end of the primary stream. A value of 0 disables this behavior.
  281. Default value is 1.
  282. @end table
  283. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  284. @chapter Audio Filters
  285. @c man begin AUDIO FILTERS
  286. When you configure your FFmpeg build, you can disable any of the
  287. existing filters using @code{--disable-filters}.
  288. The configure output will show the audio filters included in your
  289. build.
  290. Below is a description of the currently available audio filters.
  291. @section acompressor
  292. A compressor is mainly used to reduce the dynamic range of a signal.
  293. Especially modern music is mostly compressed at a high ratio to
  294. improve the overall loudness. It's done to get the highest attention
  295. of a listener, "fatten" the sound and bring more "power" to the track.
  296. If a signal is compressed too much it may sound dull or "dead"
  297. afterwards or it may start to "pump" (which could be a powerful effect
  298. but can also destroy a track completely).
  299. The right compression is the key to reach a professional sound and is
  300. the high art of mixing and mastering. Because of its complex settings
  301. it may take a long time to get the right feeling for this kind of effect.
  302. Compression is done by detecting the volume above a chosen level
  303. @code{threshold} and dividing it by the factor set with @code{ratio}.
  304. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  305. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  306. the signal would cause distortion of the waveform the reduction can be
  307. levelled over the time. This is done by setting "Attack" and "Release".
  308. @code{attack} determines how long the signal has to rise above the threshold
  309. before any reduction will occur and @code{release} sets the time the signal
  310. has to fall below the threshold to reduce the reduction again. Shorter signals
  311. than the chosen attack time will be left untouched.
  312. The overall reduction of the signal can be made up afterwards with the
  313. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  314. raising the makeup to this level results in a signal twice as loud than the
  315. source. To gain a softer entry in the compression the @code{knee} flattens the
  316. hard edge at the threshold in the range of the chosen decibels.
  317. The filter accepts the following options:
  318. @table @option
  319. @item level_in
  320. Set input gain. Default is 1. Range is between 0.015625 and 64.
  321. @item mode
  322. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  323. Default is @code{downward}.
  324. @item threshold
  325. If a signal of stream rises above this level it will affect the gain
  326. reduction.
  327. By default it is 0.125. Range is between 0.00097563 and 1.
  328. @item ratio
  329. Set a ratio by which the signal is reduced. 1:2 means that if the level
  330. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  331. Default is 2. Range is between 1 and 20.
  332. @item attack
  333. Amount of milliseconds the signal has to rise above the threshold before gain
  334. reduction starts. Default is 20. Range is between 0.01 and 2000.
  335. @item release
  336. Amount of milliseconds the signal has to fall below the threshold before
  337. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  338. @item makeup
  339. Set the amount by how much signal will be amplified after processing.
  340. Default is 1. Range is from 1 to 64.
  341. @item knee
  342. Curve the sharp knee around the threshold to enter gain reduction more softly.
  343. Default is 2.82843. Range is between 1 and 8.
  344. @item link
  345. Choose if the @code{average} level between all channels of input stream
  346. or the louder(@code{maximum}) channel of input stream affects the
  347. reduction. Default is @code{average}.
  348. @item detection
  349. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  350. of @code{rms}. Default is @code{rms} which is mostly smoother.
  351. @item mix
  352. How much to use compressed signal in output. Default is 1.
  353. Range is between 0 and 1.
  354. @end table
  355. @section acontrast
  356. Simple audio dynamic range compression/expansion filter.
  357. The filter accepts the following options:
  358. @table @option
  359. @item contrast
  360. Set contrast. Default is 33. Allowed range is between 0 and 100.
  361. @end table
  362. @section acopy
  363. Copy the input audio source unchanged to the output. This is mainly useful for
  364. testing purposes.
  365. @section acrossfade
  366. Apply cross fade from one input audio stream to another input audio stream.
  367. The cross fade is applied for specified duration near the end of first stream.
  368. The filter accepts the following options:
  369. @table @option
  370. @item nb_samples, ns
  371. Specify the number of samples for which the cross fade effect has to last.
  372. At the end of the cross fade effect the first input audio will be completely
  373. silent. Default is 44100.
  374. @item duration, d
  375. Specify the duration of the cross fade effect. See
  376. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  377. for the accepted syntax.
  378. By default the duration is determined by @var{nb_samples}.
  379. If set this option is used instead of @var{nb_samples}.
  380. @item overlap, o
  381. Should first stream end overlap with second stream start. Default is enabled.
  382. @item curve1
  383. Set curve for cross fade transition for first stream.
  384. @item curve2
  385. Set curve for cross fade transition for second stream.
  386. For description of available curve types see @ref{afade} filter description.
  387. @end table
  388. @subsection Examples
  389. @itemize
  390. @item
  391. Cross fade from one input to another:
  392. @example
  393. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  394. @end example
  395. @item
  396. Cross fade from one input to another but without overlapping:
  397. @example
  398. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  399. @end example
  400. @end itemize
  401. @section acrossover
  402. Split audio stream into several bands.
  403. This filter splits audio stream into two or more frequency ranges.
  404. Summing all streams back will give flat output.
  405. The filter accepts the following options:
  406. @table @option
  407. @item split
  408. Set split frequencies. Those must be positive and increasing.
  409. @item order
  410. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  411. Default is @var{4th}.
  412. @end table
  413. @section acrusher
  414. Reduce audio bit resolution.
  415. This filter is bit crusher with enhanced functionality. A bit crusher
  416. is used to audibly reduce number of bits an audio signal is sampled
  417. with. This doesn't change the bit depth at all, it just produces the
  418. effect. Material reduced in bit depth sounds more harsh and "digital".
  419. This filter is able to even round to continuous values instead of discrete
  420. bit depths.
  421. Additionally it has a D/C offset which results in different crushing of
  422. the lower and the upper half of the signal.
  423. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  424. Another feature of this filter is the logarithmic mode.
  425. This setting switches from linear distances between bits to logarithmic ones.
  426. The result is a much more "natural" sounding crusher which doesn't gate low
  427. signals for example. The human ear has a logarithmic perception,
  428. so this kind of crushing is much more pleasant.
  429. Logarithmic crushing is also able to get anti-aliased.
  430. The filter accepts the following options:
  431. @table @option
  432. @item level_in
  433. Set level in.
  434. @item level_out
  435. Set level out.
  436. @item bits
  437. Set bit reduction.
  438. @item mix
  439. Set mixing amount.
  440. @item mode
  441. Can be linear: @code{lin} or logarithmic: @code{log}.
  442. @item dc
  443. Set DC.
  444. @item aa
  445. Set anti-aliasing.
  446. @item samples
  447. Set sample reduction.
  448. @item lfo
  449. Enable LFO. By default disabled.
  450. @item lforange
  451. Set LFO range.
  452. @item lforate
  453. Set LFO rate.
  454. @end table
  455. @section acue
  456. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  457. filter.
  458. @section adeclick
  459. Remove impulsive noise from input audio.
  460. Samples detected as impulsive noise are replaced by interpolated samples using
  461. autoregressive modelling.
  462. @table @option
  463. @item w
  464. Set window size, in milliseconds. Allowed range is from @code{10} to
  465. @code{100}. Default value is @code{55} milliseconds.
  466. This sets size of window which will be processed at once.
  467. @item o
  468. Set window overlap, in percentage of window size. Allowed range is from
  469. @code{50} to @code{95}. Default value is @code{75} percent.
  470. Setting this to a very high value increases impulsive noise removal but makes
  471. whole process much slower.
  472. @item a
  473. Set autoregression order, in percentage of window size. Allowed range is from
  474. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  475. controls quality of interpolated samples using neighbour good samples.
  476. @item t
  477. Set threshold value. Allowed range is from @code{1} to @code{100}.
  478. Default value is @code{2}.
  479. This controls the strength of impulsive noise which is going to be removed.
  480. The lower value, the more samples will be detected as impulsive noise.
  481. @item b
  482. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  483. @code{10}. Default value is @code{2}.
  484. If any two samples detected as noise are spaced less than this value then any
  485. sample between those two samples will be also detected as noise.
  486. @item m
  487. Set overlap method.
  488. It accepts the following values:
  489. @table @option
  490. @item a
  491. Select overlap-add method. Even not interpolated samples are slightly
  492. changed with this method.
  493. @item s
  494. Select overlap-save method. Not interpolated samples remain unchanged.
  495. @end table
  496. Default value is @code{a}.
  497. @end table
  498. @section adeclip
  499. Remove clipped samples from input audio.
  500. Samples detected as clipped are replaced by interpolated samples using
  501. autoregressive modelling.
  502. @table @option
  503. @item w
  504. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  505. Default value is @code{55} milliseconds.
  506. This sets size of window which will be processed at once.
  507. @item o
  508. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  509. to @code{95}. Default value is @code{75} percent.
  510. @item a
  511. Set autoregression order, in percentage of window size. Allowed range is from
  512. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  513. quality of interpolated samples using neighbour good samples.
  514. @item t
  515. Set threshold value. Allowed range is from @code{1} to @code{100}.
  516. Default value is @code{10}. Higher values make clip detection less aggressive.
  517. @item n
  518. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  519. Default value is @code{1000}. Higher values make clip detection less aggressive.
  520. @item m
  521. Set overlap method.
  522. It accepts the following values:
  523. @table @option
  524. @item a
  525. Select overlap-add method. Even not interpolated samples are slightly changed
  526. with this method.
  527. @item s
  528. Select overlap-save method. Not interpolated samples remain unchanged.
  529. @end table
  530. Default value is @code{a}.
  531. @end table
  532. @section adelay
  533. Delay one or more audio channels.
  534. Samples in delayed channel are filled with silence.
  535. The filter accepts the following option:
  536. @table @option
  537. @item delays
  538. Set list of delays in milliseconds for each channel separated by '|'.
  539. Unused delays will be silently ignored. If number of given delays is
  540. smaller than number of channels all remaining channels will not be delayed.
  541. If you want to delay exact number of samples, append 'S' to number.
  542. If you want instead to delay in seconds, append 's' to number.
  543. @item all
  544. Use last set delay for all remaining channels. By default is disabled.
  545. This option if enabled changes how option @code{delays} is interpreted.
  546. @end table
  547. @subsection Examples
  548. @itemize
  549. @item
  550. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  551. the second channel (and any other channels that may be present) unchanged.
  552. @example
  553. adelay=1500|0|500
  554. @end example
  555. @item
  556. Delay second channel by 500 samples, the third channel by 700 samples and leave
  557. the first channel (and any other channels that may be present) unchanged.
  558. @example
  559. adelay=0|500S|700S
  560. @end example
  561. @item
  562. Delay all channels by same number of samples:
  563. @example
  564. adelay=delays=64S:all=1
  565. @end example
  566. @end itemize
  567. @section aderivative, aintegral
  568. Compute derivative/integral of audio stream.
  569. Applying both filters one after another produces original audio.
  570. @section aecho
  571. Apply echoing to the input audio.
  572. Echoes are reflected sound and can occur naturally amongst mountains
  573. (and sometimes large buildings) when talking or shouting; digital echo
  574. effects emulate this behaviour and are often used to help fill out the
  575. sound of a single instrument or vocal. The time difference between the
  576. original signal and the reflection is the @code{delay}, and the
  577. loudness of the reflected signal is the @code{decay}.
  578. Multiple echoes can have different delays and decays.
  579. A description of the accepted parameters follows.
  580. @table @option
  581. @item in_gain
  582. Set input gain of reflected signal. Default is @code{0.6}.
  583. @item out_gain
  584. Set output gain of reflected signal. Default is @code{0.3}.
  585. @item delays
  586. Set list of time intervals in milliseconds between original signal and reflections
  587. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  588. Default is @code{1000}.
  589. @item decays
  590. Set list of loudness of reflected signals separated by '|'.
  591. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  592. Default is @code{0.5}.
  593. @end table
  594. @subsection Examples
  595. @itemize
  596. @item
  597. Make it sound as if there are twice as many instruments as are actually playing:
  598. @example
  599. aecho=0.8:0.88:60:0.4
  600. @end example
  601. @item
  602. If delay is very short, then it sounds like a (metallic) robot playing music:
  603. @example
  604. aecho=0.8:0.88:6:0.4
  605. @end example
  606. @item
  607. A longer delay will sound like an open air concert in the mountains:
  608. @example
  609. aecho=0.8:0.9:1000:0.3
  610. @end example
  611. @item
  612. Same as above but with one more mountain:
  613. @example
  614. aecho=0.8:0.9:1000|1800:0.3|0.25
  615. @end example
  616. @end itemize
  617. @section aemphasis
  618. Audio emphasis filter creates or restores material directly taken from LPs or
  619. emphased CDs with different filter curves. E.g. to store music on vinyl the
  620. signal has to be altered by a filter first to even out the disadvantages of
  621. this recording medium.
  622. Once the material is played back the inverse filter has to be applied to
  623. restore the distortion of the frequency response.
  624. The filter accepts the following options:
  625. @table @option
  626. @item level_in
  627. Set input gain.
  628. @item level_out
  629. Set output gain.
  630. @item mode
  631. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  632. use @code{production} mode. Default is @code{reproduction} mode.
  633. @item type
  634. Set filter type. Selects medium. Can be one of the following:
  635. @table @option
  636. @item col
  637. select Columbia.
  638. @item emi
  639. select EMI.
  640. @item bsi
  641. select BSI (78RPM).
  642. @item riaa
  643. select RIAA.
  644. @item cd
  645. select Compact Disc (CD).
  646. @item 50fm
  647. select 50µs (FM).
  648. @item 75fm
  649. select 75µs (FM).
  650. @item 50kf
  651. select 50µs (FM-KF).
  652. @item 75kf
  653. select 75µs (FM-KF).
  654. @end table
  655. @end table
  656. @section aeval
  657. Modify an audio signal according to the specified expressions.
  658. This filter accepts one or more expressions (one for each channel),
  659. which are evaluated and used to modify a corresponding audio signal.
  660. It accepts the following parameters:
  661. @table @option
  662. @item exprs
  663. Set the '|'-separated expressions list for each separate channel. If
  664. the number of input channels is greater than the number of
  665. expressions, the last specified expression is used for the remaining
  666. output channels.
  667. @item channel_layout, c
  668. Set output channel layout. If not specified, the channel layout is
  669. specified by the number of expressions. If set to @samp{same}, it will
  670. use by default the same input channel layout.
  671. @end table
  672. Each expression in @var{exprs} can contain the following constants and functions:
  673. @table @option
  674. @item ch
  675. channel number of the current expression
  676. @item n
  677. number of the evaluated sample, starting from 0
  678. @item s
  679. sample rate
  680. @item t
  681. time of the evaluated sample expressed in seconds
  682. @item nb_in_channels
  683. @item nb_out_channels
  684. input and output number of channels
  685. @item val(CH)
  686. the value of input channel with number @var{CH}
  687. @end table
  688. Note: this filter is slow. For faster processing you should use a
  689. dedicated filter.
  690. @subsection Examples
  691. @itemize
  692. @item
  693. Half volume:
  694. @example
  695. aeval=val(ch)/2:c=same
  696. @end example
  697. @item
  698. Invert phase of the second channel:
  699. @example
  700. aeval=val(0)|-val(1)
  701. @end example
  702. @end itemize
  703. @anchor{afade}
  704. @section afade
  705. Apply fade-in/out effect to input audio.
  706. A description of the accepted parameters follows.
  707. @table @option
  708. @item type, t
  709. Specify the effect type, can be either @code{in} for fade-in, or
  710. @code{out} for a fade-out effect. Default is @code{in}.
  711. @item start_sample, ss
  712. Specify the number of the start sample for starting to apply the fade
  713. effect. Default is 0.
  714. @item nb_samples, ns
  715. Specify the number of samples for which the fade effect has to last. At
  716. the end of the fade-in effect the output audio will have the same
  717. volume as the input audio, at the end of the fade-out transition
  718. the output audio will be silence. Default is 44100.
  719. @item start_time, st
  720. Specify the start time of the fade effect. Default is 0.
  721. The value must be specified as a time duration; see
  722. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  723. for the accepted syntax.
  724. If set this option is used instead of @var{start_sample}.
  725. @item duration, d
  726. Specify the duration of the fade effect. See
  727. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  728. for the accepted syntax.
  729. At the end of the fade-in effect the output audio will have the same
  730. volume as the input audio, at the end of the fade-out transition
  731. the output audio will be silence.
  732. By default the duration is determined by @var{nb_samples}.
  733. If set this option is used instead of @var{nb_samples}.
  734. @item curve
  735. Set curve for fade transition.
  736. It accepts the following values:
  737. @table @option
  738. @item tri
  739. select triangular, linear slope (default)
  740. @item qsin
  741. select quarter of sine wave
  742. @item hsin
  743. select half of sine wave
  744. @item esin
  745. select exponential sine wave
  746. @item log
  747. select logarithmic
  748. @item ipar
  749. select inverted parabola
  750. @item qua
  751. select quadratic
  752. @item cub
  753. select cubic
  754. @item squ
  755. select square root
  756. @item cbr
  757. select cubic root
  758. @item par
  759. select parabola
  760. @item exp
  761. select exponential
  762. @item iqsin
  763. select inverted quarter of sine wave
  764. @item ihsin
  765. select inverted half of sine wave
  766. @item dese
  767. select double-exponential seat
  768. @item desi
  769. select double-exponential sigmoid
  770. @item losi
  771. select logistic sigmoid
  772. @item nofade
  773. no fade applied
  774. @end table
  775. @end table
  776. @subsection Examples
  777. @itemize
  778. @item
  779. Fade in first 15 seconds of audio:
  780. @example
  781. afade=t=in:ss=0:d=15
  782. @end example
  783. @item
  784. Fade out last 25 seconds of a 900 seconds audio:
  785. @example
  786. afade=t=out:st=875:d=25
  787. @end example
  788. @end itemize
  789. @section afftdn
  790. Denoise audio samples with FFT.
  791. A description of the accepted parameters follows.
  792. @table @option
  793. @item nr
  794. Set the noise reduction in dB, allowed range is 0.01 to 97.
  795. Default value is 12 dB.
  796. @item nf
  797. Set the noise floor in dB, allowed range is -80 to -20.
  798. Default value is -50 dB.
  799. @item nt
  800. Set the noise type.
  801. It accepts the following values:
  802. @table @option
  803. @item w
  804. Select white noise.
  805. @item v
  806. Select vinyl noise.
  807. @item s
  808. Select shellac noise.
  809. @item c
  810. Select custom noise, defined in @code{bn} option.
  811. Default value is white noise.
  812. @end table
  813. @item bn
  814. Set custom band noise for every one of 15 bands.
  815. Bands are separated by ' ' or '|'.
  816. @item rf
  817. Set the residual floor in dB, allowed range is -80 to -20.
  818. Default value is -38 dB.
  819. @item tn
  820. Enable noise tracking. By default is disabled.
  821. With this enabled, noise floor is automatically adjusted.
  822. @item tr
  823. Enable residual tracking. By default is disabled.
  824. @item om
  825. Set the output mode.
  826. It accepts the following values:
  827. @table @option
  828. @item i
  829. Pass input unchanged.
  830. @item o
  831. Pass noise filtered out.
  832. @item n
  833. Pass only noise.
  834. Default value is @var{o}.
  835. @end table
  836. @end table
  837. @subsection Commands
  838. This filter supports the following commands:
  839. @table @option
  840. @item sample_noise, sn
  841. Start or stop measuring noise profile.
  842. Syntax for the command is : "start" or "stop" string.
  843. After measuring noise profile is stopped it will be
  844. automatically applied in filtering.
  845. @item noise_reduction, nr
  846. Change noise reduction. Argument is single float number.
  847. Syntax for the command is : "@var{noise_reduction}"
  848. @item noise_floor, nf
  849. Change noise floor. Argument is single float number.
  850. Syntax for the command is : "@var{noise_floor}"
  851. @item output_mode, om
  852. Change output mode operation.
  853. Syntax for the command is : "i", "o" or "n" string.
  854. @end table
  855. @section afftfilt
  856. Apply arbitrary expressions to samples in frequency domain.
  857. @table @option
  858. @item real
  859. Set frequency domain real expression for each separate channel separated
  860. by '|'. Default is "re".
  861. If the number of input channels is greater than the number of
  862. expressions, the last specified expression is used for the remaining
  863. output channels.
  864. @item imag
  865. Set frequency domain imaginary expression for each separate channel
  866. separated by '|'. Default is "im".
  867. Each expression in @var{real} and @var{imag} can contain the following
  868. constants and functions:
  869. @table @option
  870. @item sr
  871. sample rate
  872. @item b
  873. current frequency bin number
  874. @item nb
  875. number of available bins
  876. @item ch
  877. channel number of the current expression
  878. @item chs
  879. number of channels
  880. @item pts
  881. current frame pts
  882. @item re
  883. current real part of frequency bin of current channel
  884. @item im
  885. current imaginary part of frequency bin of current channel
  886. @item real(b, ch)
  887. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  888. @item imag(b, ch)
  889. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  890. @end table
  891. @item win_size
  892. Set window size. Allowed range is from 16 to 131072.
  893. Default is @code{4096}
  894. @item win_func
  895. Set window function. Default is @code{hann}.
  896. @item overlap
  897. Set window overlap. If set to 1, the recommended overlap for selected
  898. window function will be picked. Default is @code{0.75}.
  899. @end table
  900. @subsection Examples
  901. @itemize
  902. @item
  903. Leave almost only low frequencies in audio:
  904. @example
  905. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  906. @end example
  907. @item
  908. Apply robotize effect:
  909. @example
  910. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  911. @end example
  912. @item
  913. Apply whisper effect:
  914. @example
  915. afftfilt="real='hypot(re,im)*cos((random(0)*2-1)*2*3.14)':imag='hypot(re,im)*sin((random(1)*2-1)*2*3.14)':win_size=128:overlap=0.8"
  916. @end example
  917. @end itemize
  918. @anchor{afir}
  919. @section afir
  920. Apply an arbitrary Frequency Impulse Response filter.
  921. This filter is designed for applying long FIR filters,
  922. up to 60 seconds long.
  923. It can be used as component for digital crossover filters,
  924. room equalization, cross talk cancellation, wavefield synthesis,
  925. auralization, ambiophonics, ambisonics and spatialization.
  926. This filter uses the second stream as FIR coefficients.
  927. If the second stream holds a single channel, it will be used
  928. for all input channels in the first stream, otherwise
  929. the number of channels in the second stream must be same as
  930. the number of channels in the first stream.
  931. It accepts the following parameters:
  932. @table @option
  933. @item dry
  934. Set dry gain. This sets input gain.
  935. @item wet
  936. Set wet gain. This sets final output gain.
  937. @item length
  938. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  939. @item gtype
  940. Enable applying gain measured from power of IR.
  941. Set which approach to use for auto gain measurement.
  942. @table @option
  943. @item none
  944. Do not apply any gain.
  945. @item peak
  946. select peak gain, very conservative approach. This is default value.
  947. @item dc
  948. select DC gain, limited application.
  949. @item gn
  950. select gain to noise approach, this is most popular one.
  951. @end table
  952. @item irgain
  953. Set gain to be applied to IR coefficients before filtering.
  954. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  955. @item irfmt
  956. Set format of IR stream. Can be @code{mono} or @code{input}.
  957. Default is @code{input}.
  958. @item maxir
  959. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  960. Allowed range is 0.1 to 60 seconds.
  961. @item response
  962. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  963. By default it is disabled.
  964. @item channel
  965. Set for which IR channel to display frequency response. By default is first channel
  966. displayed. This option is used only when @var{response} is enabled.
  967. @item size
  968. Set video stream size. This option is used only when @var{response} is enabled.
  969. @item rate
  970. Set video stream frame rate. This option is used only when @var{response} is enabled.
  971. @item minp
  972. Set minimal partition size used for convolution. Default is @var{8192}.
  973. Allowed range is from @var{8} to @var{32768}.
  974. Lower values decreases latency at cost of higher CPU usage.
  975. @item maxp
  976. Set maximal partition size used for convolution. Default is @var{8192}.
  977. Allowed range is from @var{8} to @var{32768}.
  978. Lower values may increase CPU usage.
  979. @end table
  980. @subsection Examples
  981. @itemize
  982. @item
  983. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  984. @example
  985. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  986. @end example
  987. @end itemize
  988. @anchor{aformat}
  989. @section aformat
  990. Set output format constraints for the input audio. The framework will
  991. negotiate the most appropriate format to minimize conversions.
  992. It accepts the following parameters:
  993. @table @option
  994. @item sample_fmts
  995. A '|'-separated list of requested sample formats.
  996. @item sample_rates
  997. A '|'-separated list of requested sample rates.
  998. @item channel_layouts
  999. A '|'-separated list of requested channel layouts.
  1000. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1001. for the required syntax.
  1002. @end table
  1003. If a parameter is omitted, all values are allowed.
  1004. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1005. @example
  1006. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1007. @end example
  1008. @section agate
  1009. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1010. processing reduces disturbing noise between useful signals.
  1011. Gating is done by detecting the volume below a chosen level @var{threshold}
  1012. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1013. floor is set via @var{range}. Because an exact manipulation of the signal
  1014. would cause distortion of the waveform the reduction can be levelled over
  1015. time. This is done by setting @var{attack} and @var{release}.
  1016. @var{attack} determines how long the signal has to fall below the threshold
  1017. before any reduction will occur and @var{release} sets the time the signal
  1018. has to rise above the threshold to reduce the reduction again.
  1019. Shorter signals than the chosen attack time will be left untouched.
  1020. @table @option
  1021. @item level_in
  1022. Set input level before filtering.
  1023. Default is 1. Allowed range is from 0.015625 to 64.
  1024. @item mode
  1025. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1026. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1027. will be amplified, expanding dynamic range in upward direction.
  1028. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1029. @item range
  1030. Set the level of gain reduction when the signal is below the threshold.
  1031. Default is 0.06125. Allowed range is from 0 to 1.
  1032. Setting this to 0 disables reduction and then filter behaves like expander.
  1033. @item threshold
  1034. If a signal rises above this level the gain reduction is released.
  1035. Default is 0.125. Allowed range is from 0 to 1.
  1036. @item ratio
  1037. Set a ratio by which the signal is reduced.
  1038. Default is 2. Allowed range is from 1 to 9000.
  1039. @item attack
  1040. Amount of milliseconds the signal has to rise above the threshold before gain
  1041. reduction stops.
  1042. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1043. @item release
  1044. Amount of milliseconds the signal has to fall below the threshold before the
  1045. reduction is increased again. Default is 250 milliseconds.
  1046. Allowed range is from 0.01 to 9000.
  1047. @item makeup
  1048. Set amount of amplification of signal after processing.
  1049. Default is 1. Allowed range is from 1 to 64.
  1050. @item knee
  1051. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1052. Default is 2.828427125. Allowed range is from 1 to 8.
  1053. @item detection
  1054. Choose if exact signal should be taken for detection or an RMS like one.
  1055. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1056. @item link
  1057. Choose if the average level between all channels or the louder channel affects
  1058. the reduction.
  1059. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1060. @end table
  1061. @section aiir
  1062. Apply an arbitrary Infinite Impulse Response filter.
  1063. It accepts the following parameters:
  1064. @table @option
  1065. @item z
  1066. Set numerator/zeros coefficients.
  1067. @item p
  1068. Set denominator/poles coefficients.
  1069. @item k
  1070. Set channels gains.
  1071. @item dry_gain
  1072. Set input gain.
  1073. @item wet_gain
  1074. Set output gain.
  1075. @item f
  1076. Set coefficients format.
  1077. @table @samp
  1078. @item tf
  1079. transfer function
  1080. @item zp
  1081. Z-plane zeros/poles, cartesian (default)
  1082. @item pr
  1083. Z-plane zeros/poles, polar radians
  1084. @item pd
  1085. Z-plane zeros/poles, polar degrees
  1086. @end table
  1087. @item r
  1088. Set kind of processing.
  1089. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1090. @item e
  1091. Set filtering precision.
  1092. @table @samp
  1093. @item dbl
  1094. double-precision floating-point (default)
  1095. @item flt
  1096. single-precision floating-point
  1097. @item i32
  1098. 32-bit integers
  1099. @item i16
  1100. 16-bit integers
  1101. @end table
  1102. @item mix
  1103. How much to use filtered signal in output. Default is 1.
  1104. Range is between 0 and 1.
  1105. @item response
  1106. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1107. By default it is disabled.
  1108. @item channel
  1109. Set for which IR channel to display frequency response. By default is first channel
  1110. displayed. This option is used only when @var{response} is enabled.
  1111. @item size
  1112. Set video stream size. This option is used only when @var{response} is enabled.
  1113. @end table
  1114. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1115. order.
  1116. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1117. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1118. imaginary unit.
  1119. Different coefficients and gains can be provided for every channel, in such case
  1120. use '|' to separate coefficients or gains. Last provided coefficients will be
  1121. used for all remaining channels.
  1122. @subsection Examples
  1123. @itemize
  1124. @item
  1125. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1126. @example
  1127. aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
  1128. @end example
  1129. @item
  1130. Same as above but in @code{zp} format:
  1131. @example
  1132. aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
  1133. @end example
  1134. @end itemize
  1135. @section alimiter
  1136. The limiter prevents an input signal from rising over a desired threshold.
  1137. This limiter uses lookahead technology to prevent your signal from distorting.
  1138. It means that there is a small delay after the signal is processed. Keep in mind
  1139. that the delay it produces is the attack time you set.
  1140. The filter accepts the following options:
  1141. @table @option
  1142. @item level_in
  1143. Set input gain. Default is 1.
  1144. @item level_out
  1145. Set output gain. Default is 1.
  1146. @item limit
  1147. Don't let signals above this level pass the limiter. Default is 1.
  1148. @item attack
  1149. The limiter will reach its attenuation level in this amount of time in
  1150. milliseconds. Default is 5 milliseconds.
  1151. @item release
  1152. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1153. Default is 50 milliseconds.
  1154. @item asc
  1155. When gain reduction is always needed ASC takes care of releasing to an
  1156. average reduction level rather than reaching a reduction of 0 in the release
  1157. time.
  1158. @item asc_level
  1159. Select how much the release time is affected by ASC, 0 means nearly no changes
  1160. in release time while 1 produces higher release times.
  1161. @item level
  1162. Auto level output signal. Default is enabled.
  1163. This normalizes audio back to 0dB if enabled.
  1164. @end table
  1165. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1166. with @ref{aresample} before applying this filter.
  1167. @section allpass
  1168. Apply a two-pole all-pass filter with central frequency (in Hz)
  1169. @var{frequency}, and filter-width @var{width}.
  1170. An all-pass filter changes the audio's frequency to phase relationship
  1171. without changing its frequency to amplitude relationship.
  1172. The filter accepts the following options:
  1173. @table @option
  1174. @item frequency, f
  1175. Set frequency in Hz.
  1176. @item width_type, t
  1177. Set method to specify band-width of filter.
  1178. @table @option
  1179. @item h
  1180. Hz
  1181. @item q
  1182. Q-Factor
  1183. @item o
  1184. octave
  1185. @item s
  1186. slope
  1187. @item k
  1188. kHz
  1189. @end table
  1190. @item width, w
  1191. Specify the band-width of a filter in width_type units.
  1192. @item mix, m
  1193. How much to use filtered signal in output. Default is 1.
  1194. Range is between 0 and 1.
  1195. @item channels, c
  1196. Specify which channels to filter, by default all available are filtered.
  1197. @end table
  1198. @subsection Commands
  1199. This filter supports the following commands:
  1200. @table @option
  1201. @item frequency, f
  1202. Change allpass frequency.
  1203. Syntax for the command is : "@var{frequency}"
  1204. @item width_type, t
  1205. Change allpass width_type.
  1206. Syntax for the command is : "@var{width_type}"
  1207. @item width, w
  1208. Change allpass width.
  1209. Syntax for the command is : "@var{width}"
  1210. @item mix, m
  1211. Change allpass mix.
  1212. Syntax for the command is : "@var{mix}"
  1213. @end table
  1214. @section aloop
  1215. Loop audio samples.
  1216. The filter accepts the following options:
  1217. @table @option
  1218. @item loop
  1219. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1220. Default is 0.
  1221. @item size
  1222. Set maximal number of samples. Default is 0.
  1223. @item start
  1224. Set first sample of loop. Default is 0.
  1225. @end table
  1226. @anchor{amerge}
  1227. @section amerge
  1228. Merge two or more audio streams into a single multi-channel stream.
  1229. The filter accepts the following options:
  1230. @table @option
  1231. @item inputs
  1232. Set the number of inputs. Default is 2.
  1233. @end table
  1234. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1235. the channel layout of the output will be set accordingly and the channels
  1236. will be reordered as necessary. If the channel layouts of the inputs are not
  1237. disjoint, the output will have all the channels of the first input then all
  1238. the channels of the second input, in that order, and the channel layout of
  1239. the output will be the default value corresponding to the total number of
  1240. channels.
  1241. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1242. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1243. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1244. first input, b1 is the first channel of the second input).
  1245. On the other hand, if both input are in stereo, the output channels will be
  1246. in the default order: a1, a2, b1, b2, and the channel layout will be
  1247. arbitrarily set to 4.0, which may or may not be the expected value.
  1248. All inputs must have the same sample rate, and format.
  1249. If inputs do not have the same duration, the output will stop with the
  1250. shortest.
  1251. @subsection Examples
  1252. @itemize
  1253. @item
  1254. Merge two mono files into a stereo stream:
  1255. @example
  1256. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1257. @end example
  1258. @item
  1259. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1260. @example
  1261. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  1262. @end example
  1263. @end itemize
  1264. @section amix
  1265. Mixes multiple audio inputs into a single output.
  1266. Note that this filter only supports float samples (the @var{amerge}
  1267. and @var{pan} audio filters support many formats). If the @var{amix}
  1268. input has integer samples then @ref{aresample} will be automatically
  1269. inserted to perform the conversion to float samples.
  1270. For example
  1271. @example
  1272. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1273. @end example
  1274. will mix 3 input audio streams to a single output with the same duration as the
  1275. first input and a dropout transition time of 3 seconds.
  1276. It accepts the following parameters:
  1277. @table @option
  1278. @item inputs
  1279. The number of inputs. If unspecified, it defaults to 2.
  1280. @item duration
  1281. How to determine the end-of-stream.
  1282. @table @option
  1283. @item longest
  1284. The duration of the longest input. (default)
  1285. @item shortest
  1286. The duration of the shortest input.
  1287. @item first
  1288. The duration of the first input.
  1289. @end table
  1290. @item dropout_transition
  1291. The transition time, in seconds, for volume renormalization when an input
  1292. stream ends. The default value is 2 seconds.
  1293. @item weights
  1294. Specify weight of each input audio stream as sequence.
  1295. Each weight is separated by space. By default all inputs have same weight.
  1296. @end table
  1297. @section amultiply
  1298. Multiply first audio stream with second audio stream and store result
  1299. in output audio stream. Multiplication is done by multiplying each
  1300. sample from first stream with sample at same position from second stream.
  1301. With this element-wise multiplication one can create amplitude fades and
  1302. amplitude modulations.
  1303. @section anequalizer
  1304. High-order parametric multiband equalizer for each channel.
  1305. It accepts the following parameters:
  1306. @table @option
  1307. @item params
  1308. This option string is in format:
  1309. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1310. Each equalizer band is separated by '|'.
  1311. @table @option
  1312. @item chn
  1313. Set channel number to which equalization will be applied.
  1314. If input doesn't have that channel the entry is ignored.
  1315. @item f
  1316. Set central frequency for band.
  1317. If input doesn't have that frequency the entry is ignored.
  1318. @item w
  1319. Set band width in hertz.
  1320. @item g
  1321. Set band gain in dB.
  1322. @item t
  1323. Set filter type for band, optional, can be:
  1324. @table @samp
  1325. @item 0
  1326. Butterworth, this is default.
  1327. @item 1
  1328. Chebyshev type 1.
  1329. @item 2
  1330. Chebyshev type 2.
  1331. @end table
  1332. @end table
  1333. @item curves
  1334. With this option activated frequency response of anequalizer is displayed
  1335. in video stream.
  1336. @item size
  1337. Set video stream size. Only useful if curves option is activated.
  1338. @item mgain
  1339. Set max gain that will be displayed. Only useful if curves option is activated.
  1340. Setting this to a reasonable value makes it possible to display gain which is derived from
  1341. neighbour bands which are too close to each other and thus produce higher gain
  1342. when both are activated.
  1343. @item fscale
  1344. Set frequency scale used to draw frequency response in video output.
  1345. Can be linear or logarithmic. Default is logarithmic.
  1346. @item colors
  1347. Set color for each channel curve which is going to be displayed in video stream.
  1348. This is list of color names separated by space or by '|'.
  1349. Unrecognised or missing colors will be replaced by white color.
  1350. @end table
  1351. @subsection Examples
  1352. @itemize
  1353. @item
  1354. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1355. for first 2 channels using Chebyshev type 1 filter:
  1356. @example
  1357. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1358. @end example
  1359. @end itemize
  1360. @subsection Commands
  1361. This filter supports the following commands:
  1362. @table @option
  1363. @item change
  1364. Alter existing filter parameters.
  1365. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1366. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1367. error is returned.
  1368. @var{freq} set new frequency parameter.
  1369. @var{width} set new width parameter in herz.
  1370. @var{gain} set new gain parameter in dB.
  1371. Full filter invocation with asendcmd may look like this:
  1372. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1373. @end table
  1374. @section anlmdn
  1375. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1376. Each sample is adjusted by looking for other samples with similar contexts. This
  1377. context similarity is defined by comparing their surrounding patches of size
  1378. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1379. The filter accepts the following options:
  1380. @table @option
  1381. @item s
  1382. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1383. @item p
  1384. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1385. Default value is 2 milliseconds.
  1386. @item r
  1387. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1388. Default value is 6 milliseconds.
  1389. @item o
  1390. Set the output mode.
  1391. It accepts the following values:
  1392. @table @option
  1393. @item i
  1394. Pass input unchanged.
  1395. @item o
  1396. Pass noise filtered out.
  1397. @item n
  1398. Pass only noise.
  1399. Default value is @var{o}.
  1400. @end table
  1401. @item m
  1402. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1403. @end table
  1404. @subsection Commands
  1405. This filter supports the following commands:
  1406. @table @option
  1407. @item s
  1408. Change denoise strength. Argument is single float number.
  1409. Syntax for the command is : "@var{s}"
  1410. @item o
  1411. Change output mode.
  1412. Syntax for the command is : "i", "o" or "n" string.
  1413. @end table
  1414. @section anlms
  1415. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1416. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1417. relate to producing the least mean square of the error signal (difference between the desired,
  1418. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1419. A description of the accepted options follows.
  1420. @table @option
  1421. @item order
  1422. Set filter order.
  1423. @item mu
  1424. Set filter mu.
  1425. @item eps
  1426. Set the filter eps.
  1427. @item leakage
  1428. Set the filter leakage.
  1429. @item out_mode
  1430. It accepts the following values:
  1431. @table @option
  1432. @item i
  1433. Pass the 1st input.
  1434. @item d
  1435. Pass the 2nd input.
  1436. @item o
  1437. Pass filtered samples.
  1438. @item n
  1439. Pass difference between desired and filtered samples.
  1440. Default value is @var{o}.
  1441. @end table
  1442. @end table
  1443. @subsection Examples
  1444. @itemize
  1445. @item
  1446. One of many usages of this filter is noise reduction, input audio is filtered
  1447. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1448. @example
  1449. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1450. @end example
  1451. @end itemize
  1452. @subsection Commands
  1453. This filter supports the same commands as options, excluding option @code{order}.
  1454. @section anull
  1455. Pass the audio source unchanged to the output.
  1456. @section apad
  1457. Pad the end of an audio stream with silence.
  1458. This can be used together with @command{ffmpeg} @option{-shortest} to
  1459. extend audio streams to the same length as the video stream.
  1460. A description of the accepted options follows.
  1461. @table @option
  1462. @item packet_size
  1463. Set silence packet size. Default value is 4096.
  1464. @item pad_len
  1465. Set the number of samples of silence to add to the end. After the
  1466. value is reached, the stream is terminated. This option is mutually
  1467. exclusive with @option{whole_len}.
  1468. @item whole_len
  1469. Set the minimum total number of samples in the output audio stream. If
  1470. the value is longer than the input audio length, silence is added to
  1471. the end, until the value is reached. This option is mutually exclusive
  1472. with @option{pad_len}.
  1473. @item pad_dur
  1474. Specify the duration of samples of silence to add. See
  1475. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1476. for the accepted syntax. Used only if set to non-zero value.
  1477. @item whole_dur
  1478. Specify the minimum total duration in the output audio stream. See
  1479. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1480. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1481. the input audio length, silence is added to the end, until the value is reached.
  1482. This option is mutually exclusive with @option{pad_dur}
  1483. @end table
  1484. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1485. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1486. the input stream indefinitely.
  1487. @subsection Examples
  1488. @itemize
  1489. @item
  1490. Add 1024 samples of silence to the end of the input:
  1491. @example
  1492. apad=pad_len=1024
  1493. @end example
  1494. @item
  1495. Make sure the audio output will contain at least 10000 samples, pad
  1496. the input with silence if required:
  1497. @example
  1498. apad=whole_len=10000
  1499. @end example
  1500. @item
  1501. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1502. video stream will always result the shortest and will be converted
  1503. until the end in the output file when using the @option{shortest}
  1504. option:
  1505. @example
  1506. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1507. @end example
  1508. @end itemize
  1509. @section aphaser
  1510. Add a phasing effect to the input audio.
  1511. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1512. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1513. A description of the accepted parameters follows.
  1514. @table @option
  1515. @item in_gain
  1516. Set input gain. Default is 0.4.
  1517. @item out_gain
  1518. Set output gain. Default is 0.74
  1519. @item delay
  1520. Set delay in milliseconds. Default is 3.0.
  1521. @item decay
  1522. Set decay. Default is 0.4.
  1523. @item speed
  1524. Set modulation speed in Hz. Default is 0.5.
  1525. @item type
  1526. Set modulation type. Default is triangular.
  1527. It accepts the following values:
  1528. @table @samp
  1529. @item triangular, t
  1530. @item sinusoidal, s
  1531. @end table
  1532. @end table
  1533. @section apulsator
  1534. Audio pulsator is something between an autopanner and a tremolo.
  1535. But it can produce funny stereo effects as well. Pulsator changes the volume
  1536. of the left and right channel based on a LFO (low frequency oscillator) with
  1537. different waveforms and shifted phases.
  1538. This filter have the ability to define an offset between left and right
  1539. channel. An offset of 0 means that both LFO shapes match each other.
  1540. The left and right channel are altered equally - a conventional tremolo.
  1541. An offset of 50% means that the shape of the right channel is exactly shifted
  1542. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1543. an autopanner. At 1 both curves match again. Every setting in between moves the
  1544. phase shift gapless between all stages and produces some "bypassing" sounds with
  1545. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1546. the 0.5) the faster the signal passes from the left to the right speaker.
  1547. The filter accepts the following options:
  1548. @table @option
  1549. @item level_in
  1550. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1551. @item level_out
  1552. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1553. @item mode
  1554. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1555. sawup or sawdown. Default is sine.
  1556. @item amount
  1557. Set modulation. Define how much of original signal is affected by the LFO.
  1558. @item offset_l
  1559. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1560. @item offset_r
  1561. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1562. @item width
  1563. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1564. @item timing
  1565. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1566. @item bpm
  1567. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1568. is set to bpm.
  1569. @item ms
  1570. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1571. is set to ms.
  1572. @item hz
  1573. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1574. if timing is set to hz.
  1575. @end table
  1576. @anchor{aresample}
  1577. @section aresample
  1578. Resample the input audio to the specified parameters, using the
  1579. libswresample library. If none are specified then the filter will
  1580. automatically convert between its input and output.
  1581. This filter is also able to stretch/squeeze the audio data to make it match
  1582. the timestamps or to inject silence / cut out audio to make it match the
  1583. timestamps, do a combination of both or do neither.
  1584. The filter accepts the syntax
  1585. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1586. expresses a sample rate and @var{resampler_options} is a list of
  1587. @var{key}=@var{value} pairs, separated by ":". See the
  1588. @ref{Resampler Options,,"Resampler Options" section in the
  1589. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1590. for the complete list of supported options.
  1591. @subsection Examples
  1592. @itemize
  1593. @item
  1594. Resample the input audio to 44100Hz:
  1595. @example
  1596. aresample=44100
  1597. @end example
  1598. @item
  1599. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1600. samples per second compensation:
  1601. @example
  1602. aresample=async=1000
  1603. @end example
  1604. @end itemize
  1605. @section areverse
  1606. Reverse an audio clip.
  1607. Warning: This filter requires memory to buffer the entire clip, so trimming
  1608. is suggested.
  1609. @subsection Examples
  1610. @itemize
  1611. @item
  1612. Take the first 5 seconds of a clip, and reverse it.
  1613. @example
  1614. atrim=end=5,areverse
  1615. @end example
  1616. @end itemize
  1617. @section arnndn
  1618. Reduce noise from speech using Recurrent Neural Networks.
  1619. This filter accepts the following options:
  1620. @table @option
  1621. @item model, m
  1622. Set train model file to load. This option is always required.
  1623. @end table
  1624. @section asetnsamples
  1625. Set the number of samples per each output audio frame.
  1626. The last output packet may contain a different number of samples, as
  1627. the filter will flush all the remaining samples when the input audio
  1628. signals its end.
  1629. The filter accepts the following options:
  1630. @table @option
  1631. @item nb_out_samples, n
  1632. Set the number of frames per each output audio frame. The number is
  1633. intended as the number of samples @emph{per each channel}.
  1634. Default value is 1024.
  1635. @item pad, p
  1636. If set to 1, the filter will pad the last audio frame with zeroes, so
  1637. that the last frame will contain the same number of samples as the
  1638. previous ones. Default value is 1.
  1639. @end table
  1640. For example, to set the number of per-frame samples to 1234 and
  1641. disable padding for the last frame, use:
  1642. @example
  1643. asetnsamples=n=1234:p=0
  1644. @end example
  1645. @section asetrate
  1646. Set the sample rate without altering the PCM data.
  1647. This will result in a change of speed and pitch.
  1648. The filter accepts the following options:
  1649. @table @option
  1650. @item sample_rate, r
  1651. Set the output sample rate. Default is 44100 Hz.
  1652. @end table
  1653. @section ashowinfo
  1654. Show a line containing various information for each input audio frame.
  1655. The input audio is not modified.
  1656. The shown line contains a sequence of key/value pairs of the form
  1657. @var{key}:@var{value}.
  1658. The following values are shown in the output:
  1659. @table @option
  1660. @item n
  1661. The (sequential) number of the input frame, starting from 0.
  1662. @item pts
  1663. The presentation timestamp of the input frame, in time base units; the time base
  1664. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1665. @item pts_time
  1666. The presentation timestamp of the input frame in seconds.
  1667. @item pos
  1668. position of the frame in the input stream, -1 if this information in
  1669. unavailable and/or meaningless (for example in case of synthetic audio)
  1670. @item fmt
  1671. The sample format.
  1672. @item chlayout
  1673. The channel layout.
  1674. @item rate
  1675. The sample rate for the audio frame.
  1676. @item nb_samples
  1677. The number of samples (per channel) in the frame.
  1678. @item checksum
  1679. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1680. audio, the data is treated as if all the planes were concatenated.
  1681. @item plane_checksums
  1682. A list of Adler-32 checksums for each data plane.
  1683. @end table
  1684. @section asoftclip
  1685. Apply audio soft clipping.
  1686. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1687. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1688. This filter accepts the following options:
  1689. @table @option
  1690. @item type
  1691. Set type of soft-clipping.
  1692. It accepts the following values:
  1693. @table @option
  1694. @item tanh
  1695. @item atan
  1696. @item cubic
  1697. @item exp
  1698. @item alg
  1699. @item quintic
  1700. @item sin
  1701. @end table
  1702. @item param
  1703. Set additional parameter which controls sigmoid function.
  1704. @end table
  1705. @section asr
  1706. Automatic Speech Recognition
  1707. This filter uses PocketSphinx for speech recognition. To enable
  1708. compilation of this filter, you need to configure FFmpeg with
  1709. @code{--enable-pocketsphinx}.
  1710. It accepts the following options:
  1711. @table @option
  1712. @item rate
  1713. Set sampling rate of input audio. Defaults is @code{16000}.
  1714. This need to match speech models, otherwise one will get poor results.
  1715. @item hmm
  1716. Set dictionary containing acoustic model files.
  1717. @item dict
  1718. Set pronunciation dictionary.
  1719. @item lm
  1720. Set language model file.
  1721. @item lmctl
  1722. Set language model set.
  1723. @item lmname
  1724. Set which language model to use.
  1725. @item logfn
  1726. Set output for log messages.
  1727. @end table
  1728. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1729. @anchor{astats}
  1730. @section astats
  1731. Display time domain statistical information about the audio channels.
  1732. Statistics are calculated and displayed for each audio channel and,
  1733. where applicable, an overall figure is also given.
  1734. It accepts the following option:
  1735. @table @option
  1736. @item length
  1737. Short window length in seconds, used for peak and trough RMS measurement.
  1738. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1739. @item metadata
  1740. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1741. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1742. disabled.
  1743. Available keys for each channel are:
  1744. DC_offset
  1745. Min_level
  1746. Max_level
  1747. Min_difference
  1748. Max_difference
  1749. Mean_difference
  1750. RMS_difference
  1751. Peak_level
  1752. RMS_peak
  1753. RMS_trough
  1754. Crest_factor
  1755. Flat_factor
  1756. Peak_count
  1757. Bit_depth
  1758. Dynamic_range
  1759. Zero_crossings
  1760. Zero_crossings_rate
  1761. Number_of_NaNs
  1762. Number_of_Infs
  1763. Number_of_denormals
  1764. and for Overall:
  1765. DC_offset
  1766. Min_level
  1767. Max_level
  1768. Min_difference
  1769. Max_difference
  1770. Mean_difference
  1771. RMS_difference
  1772. Peak_level
  1773. RMS_level
  1774. RMS_peak
  1775. RMS_trough
  1776. Flat_factor
  1777. Peak_count
  1778. Bit_depth
  1779. Number_of_samples
  1780. Number_of_NaNs
  1781. Number_of_Infs
  1782. Number_of_denormals
  1783. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1784. this @code{lavfi.astats.Overall.Peak_count}.
  1785. For description what each key means read below.
  1786. @item reset
  1787. Set number of frame after which stats are going to be recalculated.
  1788. Default is disabled.
  1789. @item measure_perchannel
  1790. Select the entries which need to be measured per channel. The metadata keys can
  1791. be used as flags, default is @option{all} which measures everything.
  1792. @option{none} disables all per channel measurement.
  1793. @item measure_overall
  1794. Select the entries which need to be measured overall. The metadata keys can
  1795. be used as flags, default is @option{all} which measures everything.
  1796. @option{none} disables all overall measurement.
  1797. @end table
  1798. A description of each shown parameter follows:
  1799. @table @option
  1800. @item DC offset
  1801. Mean amplitude displacement from zero.
  1802. @item Min level
  1803. Minimal sample level.
  1804. @item Max level
  1805. Maximal sample level.
  1806. @item Min difference
  1807. Minimal difference between two consecutive samples.
  1808. @item Max difference
  1809. Maximal difference between two consecutive samples.
  1810. @item Mean difference
  1811. Mean difference between two consecutive samples.
  1812. The average of each difference between two consecutive samples.
  1813. @item RMS difference
  1814. Root Mean Square difference between two consecutive samples.
  1815. @item Peak level dB
  1816. @item RMS level dB
  1817. Standard peak and RMS level measured in dBFS.
  1818. @item RMS peak dB
  1819. @item RMS trough dB
  1820. Peak and trough values for RMS level measured over a short window.
  1821. @item Crest factor
  1822. Standard ratio of peak to RMS level (note: not in dB).
  1823. @item Flat factor
  1824. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1825. (i.e. either @var{Min level} or @var{Max level}).
  1826. @item Peak count
  1827. Number of occasions (not the number of samples) that the signal attained either
  1828. @var{Min level} or @var{Max level}.
  1829. @item Bit depth
  1830. Overall bit depth of audio. Number of bits used for each sample.
  1831. @item Dynamic range
  1832. Measured dynamic range of audio in dB.
  1833. @item Zero crossings
  1834. Number of points where the waveform crosses the zero level axis.
  1835. @item Zero crossings rate
  1836. Rate of Zero crossings and number of audio samples.
  1837. @end table
  1838. @section atempo
  1839. Adjust audio tempo.
  1840. The filter accepts exactly one parameter, the audio tempo. If not
  1841. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1842. be in the [0.5, 100.0] range.
  1843. Note that tempo greater than 2 will skip some samples rather than
  1844. blend them in. If for any reason this is a concern it is always
  1845. possible to daisy-chain several instances of atempo to achieve the
  1846. desired product tempo.
  1847. @subsection Examples
  1848. @itemize
  1849. @item
  1850. Slow down audio to 80% tempo:
  1851. @example
  1852. atempo=0.8
  1853. @end example
  1854. @item
  1855. To speed up audio to 300% tempo:
  1856. @example
  1857. atempo=3
  1858. @end example
  1859. @item
  1860. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1861. @example
  1862. atempo=sqrt(3),atempo=sqrt(3)
  1863. @end example
  1864. @end itemize
  1865. @subsection Commands
  1866. This filter supports the following commands:
  1867. @table @option
  1868. @item tempo
  1869. Change filter tempo scale factor.
  1870. Syntax for the command is : "@var{tempo}"
  1871. @end table
  1872. @section atrim
  1873. Trim the input so that the output contains one continuous subpart of the input.
  1874. It accepts the following parameters:
  1875. @table @option
  1876. @item start
  1877. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1878. sample with the timestamp @var{start} will be the first sample in the output.
  1879. @item end
  1880. Specify time of the first audio sample that will be dropped, i.e. the
  1881. audio sample immediately preceding the one with the timestamp @var{end} will be
  1882. the last sample in the output.
  1883. @item start_pts
  1884. Same as @var{start}, except this option sets the start timestamp in samples
  1885. instead of seconds.
  1886. @item end_pts
  1887. Same as @var{end}, except this option sets the end timestamp in samples instead
  1888. of seconds.
  1889. @item duration
  1890. The maximum duration of the output in seconds.
  1891. @item start_sample
  1892. The number of the first sample that should be output.
  1893. @item end_sample
  1894. The number of the first sample that should be dropped.
  1895. @end table
  1896. @option{start}, @option{end}, and @option{duration} are expressed as time
  1897. duration specifications; see
  1898. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1899. Note that the first two sets of the start/end options and the @option{duration}
  1900. option look at the frame timestamp, while the _sample options simply count the
  1901. samples that pass through the filter. So start/end_pts and start/end_sample will
  1902. give different results when the timestamps are wrong, inexact or do not start at
  1903. zero. Also note that this filter does not modify the timestamps. If you wish
  1904. to have the output timestamps start at zero, insert the asetpts filter after the
  1905. atrim filter.
  1906. If multiple start or end options are set, this filter tries to be greedy and
  1907. keep all samples that match at least one of the specified constraints. To keep
  1908. only the part that matches all the constraints at once, chain multiple atrim
  1909. filters.
  1910. The defaults are such that all the input is kept. So it is possible to set e.g.
  1911. just the end values to keep everything before the specified time.
  1912. Examples:
  1913. @itemize
  1914. @item
  1915. Drop everything except the second minute of input:
  1916. @example
  1917. ffmpeg -i INPUT -af atrim=60:120
  1918. @end example
  1919. @item
  1920. Keep only the first 1000 samples:
  1921. @example
  1922. ffmpeg -i INPUT -af atrim=end_sample=1000
  1923. @end example
  1924. @end itemize
  1925. @section bandpass
  1926. Apply a two-pole Butterworth band-pass filter with central
  1927. frequency @var{frequency}, and (3dB-point) band-width width.
  1928. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1929. instead of the default: constant 0dB peak gain.
  1930. The filter roll off at 6dB per octave (20dB per decade).
  1931. The filter accepts the following options:
  1932. @table @option
  1933. @item frequency, f
  1934. Set the filter's central frequency. Default is @code{3000}.
  1935. @item csg
  1936. Constant skirt gain if set to 1. Defaults to 0.
  1937. @item width_type, t
  1938. Set method to specify band-width of filter.
  1939. @table @option
  1940. @item h
  1941. Hz
  1942. @item q
  1943. Q-Factor
  1944. @item o
  1945. octave
  1946. @item s
  1947. slope
  1948. @item k
  1949. kHz
  1950. @end table
  1951. @item width, w
  1952. Specify the band-width of a filter in width_type units.
  1953. @item mix, m
  1954. How much to use filtered signal in output. Default is 1.
  1955. Range is between 0 and 1.
  1956. @item channels, c
  1957. Specify which channels to filter, by default all available are filtered.
  1958. @end table
  1959. @subsection Commands
  1960. This filter supports the following commands:
  1961. @table @option
  1962. @item frequency, f
  1963. Change bandpass frequency.
  1964. Syntax for the command is : "@var{frequency}"
  1965. @item width_type, t
  1966. Change bandpass width_type.
  1967. Syntax for the command is : "@var{width_type}"
  1968. @item width, w
  1969. Change bandpass width.
  1970. Syntax for the command is : "@var{width}"
  1971. @item mix, m
  1972. Change bandpass mix.
  1973. Syntax for the command is : "@var{mix}"
  1974. @end table
  1975. @section bandreject
  1976. Apply a two-pole Butterworth band-reject filter with central
  1977. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1978. The filter roll off at 6dB per octave (20dB per decade).
  1979. The filter accepts the following options:
  1980. @table @option
  1981. @item frequency, f
  1982. Set the filter's central frequency. Default is @code{3000}.
  1983. @item width_type, t
  1984. Set method to specify band-width of filter.
  1985. @table @option
  1986. @item h
  1987. Hz
  1988. @item q
  1989. Q-Factor
  1990. @item o
  1991. octave
  1992. @item s
  1993. slope
  1994. @item k
  1995. kHz
  1996. @end table
  1997. @item width, w
  1998. Specify the band-width of a filter in width_type units.
  1999. @item mix, m
  2000. How much to use filtered signal in output. Default is 1.
  2001. Range is between 0 and 1.
  2002. @item channels, c
  2003. Specify which channels to filter, by default all available are filtered.
  2004. @end table
  2005. @subsection Commands
  2006. This filter supports the following commands:
  2007. @table @option
  2008. @item frequency, f
  2009. Change bandreject frequency.
  2010. Syntax for the command is : "@var{frequency}"
  2011. @item width_type, t
  2012. Change bandreject width_type.
  2013. Syntax for the command is : "@var{width_type}"
  2014. @item width, w
  2015. Change bandreject width.
  2016. Syntax for the command is : "@var{width}"
  2017. @item mix, m
  2018. Change bandreject mix.
  2019. Syntax for the command is : "@var{mix}"
  2020. @end table
  2021. @section bass, lowshelf
  2022. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2023. shelving filter with a response similar to that of a standard
  2024. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2025. The filter accepts the following options:
  2026. @table @option
  2027. @item gain, g
  2028. Give the gain at 0 Hz. Its useful range is about -20
  2029. (for a large cut) to +20 (for a large boost).
  2030. Beware of clipping when using a positive gain.
  2031. @item frequency, f
  2032. Set the filter's central frequency and so can be used
  2033. to extend or reduce the frequency range to be boosted or cut.
  2034. The default value is @code{100} Hz.
  2035. @item width_type, t
  2036. Set method to specify band-width of filter.
  2037. @table @option
  2038. @item h
  2039. Hz
  2040. @item q
  2041. Q-Factor
  2042. @item o
  2043. octave
  2044. @item s
  2045. slope
  2046. @item k
  2047. kHz
  2048. @end table
  2049. @item width, w
  2050. Determine how steep is the filter's shelf transition.
  2051. @item mix, m
  2052. How much to use filtered signal in output. Default is 1.
  2053. Range is between 0 and 1.
  2054. @item channels, c
  2055. Specify which channels to filter, by default all available are filtered.
  2056. @end table
  2057. @subsection Commands
  2058. This filter supports the following commands:
  2059. @table @option
  2060. @item frequency, f
  2061. Change bass frequency.
  2062. Syntax for the command is : "@var{frequency}"
  2063. @item width_type, t
  2064. Change bass width_type.
  2065. Syntax for the command is : "@var{width_type}"
  2066. @item width, w
  2067. Change bass width.
  2068. Syntax for the command is : "@var{width}"
  2069. @item gain, g
  2070. Change bass gain.
  2071. Syntax for the command is : "@var{gain}"
  2072. @item mix, m
  2073. Change bass mix.
  2074. Syntax for the command is : "@var{mix}"
  2075. @end table
  2076. @section biquad
  2077. Apply a biquad IIR filter with the given coefficients.
  2078. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2079. are the numerator and denominator coefficients respectively.
  2080. and @var{channels}, @var{c} specify which channels to filter, by default all
  2081. available are filtered.
  2082. @subsection Commands
  2083. This filter supports the following commands:
  2084. @table @option
  2085. @item a0
  2086. @item a1
  2087. @item a2
  2088. @item b0
  2089. @item b1
  2090. @item b2
  2091. Change biquad parameter.
  2092. Syntax for the command is : "@var{value}"
  2093. @item mix, m
  2094. How much to use filtered signal in output. Default is 1.
  2095. Range is between 0 and 1.
  2096. @end table
  2097. @section bs2b
  2098. Bauer stereo to binaural transformation, which improves headphone listening of
  2099. stereo audio records.
  2100. To enable compilation of this filter you need to configure FFmpeg with
  2101. @code{--enable-libbs2b}.
  2102. It accepts the following parameters:
  2103. @table @option
  2104. @item profile
  2105. Pre-defined crossfeed level.
  2106. @table @option
  2107. @item default
  2108. Default level (fcut=700, feed=50).
  2109. @item cmoy
  2110. Chu Moy circuit (fcut=700, feed=60).
  2111. @item jmeier
  2112. Jan Meier circuit (fcut=650, feed=95).
  2113. @end table
  2114. @item fcut
  2115. Cut frequency (in Hz).
  2116. @item feed
  2117. Feed level (in Hz).
  2118. @end table
  2119. @section channelmap
  2120. Remap input channels to new locations.
  2121. It accepts the following parameters:
  2122. @table @option
  2123. @item map
  2124. Map channels from input to output. The argument is a '|'-separated list of
  2125. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2126. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2127. channel (e.g. FL for front left) or its index in the input channel layout.
  2128. @var{out_channel} is the name of the output channel or its index in the output
  2129. channel layout. If @var{out_channel} is not given then it is implicitly an
  2130. index, starting with zero and increasing by one for each mapping.
  2131. @item channel_layout
  2132. The channel layout of the output stream.
  2133. @end table
  2134. If no mapping is present, the filter will implicitly map input channels to
  2135. output channels, preserving indices.
  2136. @subsection Examples
  2137. @itemize
  2138. @item
  2139. For example, assuming a 5.1+downmix input MOV file,
  2140. @example
  2141. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2142. @end example
  2143. will create an output WAV file tagged as stereo from the downmix channels of
  2144. the input.
  2145. @item
  2146. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2147. @example
  2148. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2149. @end example
  2150. @end itemize
  2151. @section channelsplit
  2152. Split each channel from an input audio stream into a separate output stream.
  2153. It accepts the following parameters:
  2154. @table @option
  2155. @item channel_layout
  2156. The channel layout of the input stream. The default is "stereo".
  2157. @item channels
  2158. A channel layout describing the channels to be extracted as separate output streams
  2159. or "all" to extract each input channel as a separate stream. The default is "all".
  2160. Choosing channels not present in channel layout in the input will result in an error.
  2161. @end table
  2162. @subsection Examples
  2163. @itemize
  2164. @item
  2165. For example, assuming a stereo input MP3 file,
  2166. @example
  2167. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2168. @end example
  2169. will create an output Matroska file with two audio streams, one containing only
  2170. the left channel and the other the right channel.
  2171. @item
  2172. Split a 5.1 WAV file into per-channel files:
  2173. @example
  2174. ffmpeg -i in.wav -filter_complex
  2175. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2176. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2177. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2178. side_right.wav
  2179. @end example
  2180. @item
  2181. Extract only LFE from a 5.1 WAV file:
  2182. @example
  2183. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2184. -map '[LFE]' lfe.wav
  2185. @end example
  2186. @end itemize
  2187. @section chorus
  2188. Add a chorus effect to the audio.
  2189. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2190. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2191. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2192. The modulation depth defines the range the modulated delay is played before or after
  2193. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2194. sound tuned around the original one, like in a chorus where some vocals are slightly
  2195. off key.
  2196. It accepts the following parameters:
  2197. @table @option
  2198. @item in_gain
  2199. Set input gain. Default is 0.4.
  2200. @item out_gain
  2201. Set output gain. Default is 0.4.
  2202. @item delays
  2203. Set delays. A typical delay is around 40ms to 60ms.
  2204. @item decays
  2205. Set decays.
  2206. @item speeds
  2207. Set speeds.
  2208. @item depths
  2209. Set depths.
  2210. @end table
  2211. @subsection Examples
  2212. @itemize
  2213. @item
  2214. A single delay:
  2215. @example
  2216. chorus=0.7:0.9:55:0.4:0.25:2
  2217. @end example
  2218. @item
  2219. Two delays:
  2220. @example
  2221. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2222. @end example
  2223. @item
  2224. Fuller sounding chorus with three delays:
  2225. @example
  2226. chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3
  2227. @end example
  2228. @end itemize
  2229. @section compand
  2230. Compress or expand the audio's dynamic range.
  2231. It accepts the following parameters:
  2232. @table @option
  2233. @item attacks
  2234. @item decays
  2235. A list of times in seconds for each channel over which the instantaneous level
  2236. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2237. increase of volume and @var{decays} refers to decrease of volume. For most
  2238. situations, the attack time (response to the audio getting louder) should be
  2239. shorter than the decay time, because the human ear is more sensitive to sudden
  2240. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2241. a typical value for decay is 0.8 seconds.
  2242. If specified number of attacks & decays is lower than number of channels, the last
  2243. set attack/decay will be used for all remaining channels.
  2244. @item points
  2245. A list of points for the transfer function, specified in dB relative to the
  2246. maximum possible signal amplitude. Each key points list must be defined using
  2247. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2248. @code{x0/y0 x1/y1 x2/y2 ....}
  2249. The input values must be in strictly increasing order but the transfer function
  2250. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2251. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2252. function are @code{-70/-70|-60/-20|1/0}.
  2253. @item soft-knee
  2254. Set the curve radius in dB for all joints. It defaults to 0.01.
  2255. @item gain
  2256. Set the additional gain in dB to be applied at all points on the transfer
  2257. function. This allows for easy adjustment of the overall gain.
  2258. It defaults to 0.
  2259. @item volume
  2260. Set an initial volume, in dB, to be assumed for each channel when filtering
  2261. starts. This permits the user to supply a nominal level initially, so that, for
  2262. example, a very large gain is not applied to initial signal levels before the
  2263. companding has begun to operate. A typical value for audio which is initially
  2264. quiet is -90 dB. It defaults to 0.
  2265. @item delay
  2266. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2267. delayed before being fed to the volume adjuster. Specifying a delay
  2268. approximately equal to the attack/decay times allows the filter to effectively
  2269. operate in predictive rather than reactive mode. It defaults to 0.
  2270. @end table
  2271. @subsection Examples
  2272. @itemize
  2273. @item
  2274. Make music with both quiet and loud passages suitable for listening to in a
  2275. noisy environment:
  2276. @example
  2277. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2278. @end example
  2279. Another example for audio with whisper and explosion parts:
  2280. @example
  2281. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2282. @end example
  2283. @item
  2284. A noise gate for when the noise is at a lower level than the signal:
  2285. @example
  2286. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2287. @end example
  2288. @item
  2289. Here is another noise gate, this time for when the noise is at a higher level
  2290. than the signal (making it, in some ways, similar to squelch):
  2291. @example
  2292. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2293. @end example
  2294. @item
  2295. 2:1 compression starting at -6dB:
  2296. @example
  2297. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2298. @end example
  2299. @item
  2300. 2:1 compression starting at -9dB:
  2301. @example
  2302. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2303. @end example
  2304. @item
  2305. 2:1 compression starting at -12dB:
  2306. @example
  2307. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2308. @end example
  2309. @item
  2310. 2:1 compression starting at -18dB:
  2311. @example
  2312. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2313. @end example
  2314. @item
  2315. 3:1 compression starting at -15dB:
  2316. @example
  2317. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2318. @end example
  2319. @item
  2320. Compressor/Gate:
  2321. @example
  2322. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2323. @end example
  2324. @item
  2325. Expander:
  2326. @example
  2327. compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3
  2328. @end example
  2329. @item
  2330. Hard limiter at -6dB:
  2331. @example
  2332. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2333. @end example
  2334. @item
  2335. Hard limiter at -12dB:
  2336. @example
  2337. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2338. @end example
  2339. @item
  2340. Hard noise gate at -35 dB:
  2341. @example
  2342. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2343. @end example
  2344. @item
  2345. Soft limiter:
  2346. @example
  2347. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2348. @end example
  2349. @end itemize
  2350. @section compensationdelay
  2351. Compensation Delay Line is a metric based delay to compensate differing
  2352. positions of microphones or speakers.
  2353. For example, you have recorded guitar with two microphones placed in
  2354. different locations. Because the front of sound wave has fixed speed in
  2355. normal conditions, the phasing of microphones can vary and depends on
  2356. their location and interposition. The best sound mix can be achieved when
  2357. these microphones are in phase (synchronized). Note that a distance of
  2358. ~30 cm between microphones makes one microphone capture the signal in
  2359. antiphase to the other microphone. That makes the final mix sound moody.
  2360. This filter helps to solve phasing problems by adding different delays
  2361. to each microphone track and make them synchronized.
  2362. The best result can be reached when you take one track as base and
  2363. synchronize other tracks one by one with it.
  2364. Remember that synchronization/delay tolerance depends on sample rate, too.
  2365. Higher sample rates will give more tolerance.
  2366. The filter accepts the following parameters:
  2367. @table @option
  2368. @item mm
  2369. Set millimeters distance. This is compensation distance for fine tuning.
  2370. Default is 0.
  2371. @item cm
  2372. Set cm distance. This is compensation distance for tightening distance setup.
  2373. Default is 0.
  2374. @item m
  2375. Set meters distance. This is compensation distance for hard distance setup.
  2376. Default is 0.
  2377. @item dry
  2378. Set dry amount. Amount of unprocessed (dry) signal.
  2379. Default is 0.
  2380. @item wet
  2381. Set wet amount. Amount of processed (wet) signal.
  2382. Default is 1.
  2383. @item temp
  2384. Set temperature in degrees Celsius. This is the temperature of the environment.
  2385. Default is 20.
  2386. @end table
  2387. @section crossfeed
  2388. Apply headphone crossfeed filter.
  2389. Crossfeed is the process of blending the left and right channels of stereo
  2390. audio recording.
  2391. It is mainly used to reduce extreme stereo separation of low frequencies.
  2392. The intent is to produce more speaker like sound to the listener.
  2393. The filter accepts the following options:
  2394. @table @option
  2395. @item strength
  2396. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2397. This sets gain of low shelf filter for side part of stereo image.
  2398. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2399. @item range
  2400. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2401. This sets cut off frequency of low shelf filter. Default is cut off near
  2402. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2403. @item level_in
  2404. Set input gain. Default is 0.9.
  2405. @item level_out
  2406. Set output gain. Default is 1.
  2407. @end table
  2408. @section crystalizer
  2409. Simple algorithm to expand audio dynamic range.
  2410. The filter accepts the following options:
  2411. @table @option
  2412. @item i
  2413. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2414. (unchanged sound) to 10.0 (maximum effect).
  2415. @item c
  2416. Enable clipping. By default is enabled.
  2417. @end table
  2418. @section dcshift
  2419. Apply a DC shift to the audio.
  2420. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2421. in the recording chain) from the audio. The effect of a DC offset is reduced
  2422. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2423. a signal has a DC offset.
  2424. @table @option
  2425. @item shift
  2426. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2427. the audio.
  2428. @item limitergain
  2429. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2430. used to prevent clipping.
  2431. @end table
  2432. @section deesser
  2433. Apply de-essing to the audio samples.
  2434. @table @option
  2435. @item i
  2436. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2437. Default is 0.
  2438. @item m
  2439. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2440. Default is 0.5.
  2441. @item f
  2442. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2443. Default is 0.5.
  2444. @item s
  2445. Set the output mode.
  2446. It accepts the following values:
  2447. @table @option
  2448. @item i
  2449. Pass input unchanged.
  2450. @item o
  2451. Pass ess filtered out.
  2452. @item e
  2453. Pass only ess.
  2454. Default value is @var{o}.
  2455. @end table
  2456. @end table
  2457. @section drmeter
  2458. Measure audio dynamic range.
  2459. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2460. is found in transition material. And anything less that 8 have very poor dynamics
  2461. and is very compressed.
  2462. The filter accepts the following options:
  2463. @table @option
  2464. @item length
  2465. Set window length in seconds used to split audio into segments of equal length.
  2466. Default is 3 seconds.
  2467. @end table
  2468. @section dynaudnorm
  2469. Dynamic Audio Normalizer.
  2470. This filter applies a certain amount of gain to the input audio in order
  2471. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2472. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2473. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2474. This allows for applying extra gain to the "quiet" sections of the audio
  2475. while avoiding distortions or clipping the "loud" sections. In other words:
  2476. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2477. sections, in the sense that the volume of each section is brought to the
  2478. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2479. this goal *without* applying "dynamic range compressing". It will retain 100%
  2480. of the dynamic range *within* each section of the audio file.
  2481. @table @option
  2482. @item framelen, f
  2483. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2484. Default is 500 milliseconds.
  2485. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2486. referred to as frames. This is required, because a peak magnitude has no
  2487. meaning for just a single sample value. Instead, we need to determine the
  2488. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2489. normalizer would simply use the peak magnitude of the complete file, the
  2490. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2491. frame. The length of a frame is specified in milliseconds. By default, the
  2492. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2493. been found to give good results with most files.
  2494. Note that the exact frame length, in number of samples, will be determined
  2495. automatically, based on the sampling rate of the individual input audio file.
  2496. @item gausssize, g
  2497. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2498. number. Default is 31.
  2499. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2500. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2501. is specified in frames, centered around the current frame. For the sake of
  2502. simplicity, this must be an odd number. Consequently, the default value of 31
  2503. takes into account the current frame, as well as the 15 preceding frames and
  2504. the 15 subsequent frames. Using a larger window results in a stronger
  2505. smoothing effect and thus in less gain variation, i.e. slower gain
  2506. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2507. effect and thus in more gain variation, i.e. faster gain adaptation.
  2508. In other words, the more you increase this value, the more the Dynamic Audio
  2509. Normalizer will behave like a "traditional" normalization filter. On the
  2510. contrary, the more you decrease this value, the more the Dynamic Audio
  2511. Normalizer will behave like a dynamic range compressor.
  2512. @item peak, p
  2513. Set the target peak value. This specifies the highest permissible magnitude
  2514. level for the normalized audio input. This filter will try to approach the
  2515. target peak magnitude as closely as possible, but at the same time it also
  2516. makes sure that the normalized signal will never exceed the peak magnitude.
  2517. A frame's maximum local gain factor is imposed directly by the target peak
  2518. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2519. It is not recommended to go above this value.
  2520. @item maxgain, m
  2521. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2522. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2523. factor for each input frame, i.e. the maximum gain factor that does not
  2524. result in clipping or distortion. The maximum gain factor is determined by
  2525. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2526. additionally bounds the frame's maximum gain factor by a predetermined
  2527. (global) maximum gain factor. This is done in order to avoid excessive gain
  2528. factors in "silent" or almost silent frames. By default, the maximum gain
  2529. factor is 10.0, For most inputs the default value should be sufficient and
  2530. it usually is not recommended to increase this value. Though, for input
  2531. with an extremely low overall volume level, it may be necessary to allow even
  2532. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2533. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2534. Instead, a "sigmoid" threshold function will be applied. This way, the
  2535. gain factors will smoothly approach the threshold value, but never exceed that
  2536. value.
  2537. @item targetrms, r
  2538. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2539. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2540. This means that the maximum local gain factor for each frame is defined
  2541. (only) by the frame's highest magnitude sample. This way, the samples can
  2542. be amplified as much as possible without exceeding the maximum signal
  2543. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2544. Normalizer can also take into account the frame's root mean square,
  2545. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2546. determine the power of a time-varying signal. It is therefore considered
  2547. that the RMS is a better approximation of the "perceived loudness" than
  2548. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2549. frames to a constant RMS value, a uniform "perceived loudness" can be
  2550. established. If a target RMS value has been specified, a frame's local gain
  2551. factor is defined as the factor that would result in exactly that RMS value.
  2552. Note, however, that the maximum local gain factor is still restricted by the
  2553. frame's highest magnitude sample, in order to prevent clipping.
  2554. @item coupling, n
  2555. Enable channels coupling. By default is enabled.
  2556. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2557. amount. This means the same gain factor will be applied to all channels, i.e.
  2558. the maximum possible gain factor is determined by the "loudest" channel.
  2559. However, in some recordings, it may happen that the volume of the different
  2560. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2561. In this case, this option can be used to disable the channel coupling. This way,
  2562. the gain factor will be determined independently for each channel, depending
  2563. only on the individual channel's highest magnitude sample. This allows for
  2564. harmonizing the volume of the different channels.
  2565. @item correctdc, c
  2566. Enable DC bias correction. By default is disabled.
  2567. An audio signal (in the time domain) is a sequence of sample values.
  2568. In the Dynamic Audio Normalizer these sample values are represented in the
  2569. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2570. audio signal, or "waveform", should be centered around the zero point.
  2571. That means if we calculate the mean value of all samples in a file, or in a
  2572. single frame, then the result should be 0.0 or at least very close to that
  2573. value. If, however, there is a significant deviation of the mean value from
  2574. 0.0, in either positive or negative direction, this is referred to as a
  2575. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2576. Audio Normalizer provides optional DC bias correction.
  2577. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2578. the mean value, or "DC correction" offset, of each input frame and subtract
  2579. that value from all of the frame's sample values which ensures those samples
  2580. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2581. boundaries, the DC correction offset values will be interpolated smoothly
  2582. between neighbouring frames.
  2583. @item altboundary, b
  2584. Enable alternative boundary mode. By default is disabled.
  2585. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2586. around each frame. This includes the preceding frames as well as the
  2587. subsequent frames. However, for the "boundary" frames, located at the very
  2588. beginning and at the very end of the audio file, not all neighbouring
  2589. frames are available. In particular, for the first few frames in the audio
  2590. file, the preceding frames are not known. And, similarly, for the last few
  2591. frames in the audio file, the subsequent frames are not known. Thus, the
  2592. question arises which gain factors should be assumed for the missing frames
  2593. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2594. to deal with this situation. The default boundary mode assumes a gain factor
  2595. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2596. "fade out" at the beginning and at the end of the input, respectively.
  2597. @item compress, s
  2598. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2599. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2600. compression. This means that signal peaks will not be pruned and thus the
  2601. full dynamic range will be retained within each local neighbourhood. However,
  2602. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2603. normalization algorithm with a more "traditional" compression.
  2604. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2605. (thresholding) function. If (and only if) the compression feature is enabled,
  2606. all input frames will be processed by a soft knee thresholding function prior
  2607. to the actual normalization process. Put simply, the thresholding function is
  2608. going to prune all samples whose magnitude exceeds a certain threshold value.
  2609. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2610. value. Instead, the threshold value will be adjusted for each individual
  2611. frame.
  2612. In general, smaller parameters result in stronger compression, and vice versa.
  2613. Values below 3.0 are not recommended, because audible distortion may appear.
  2614. @end table
  2615. @section earwax
  2616. Make audio easier to listen to on headphones.
  2617. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2618. so that when listened to on headphones the stereo image is moved from
  2619. inside your head (standard for headphones) to outside and in front of
  2620. the listener (standard for speakers).
  2621. Ported from SoX.
  2622. @section equalizer
  2623. Apply a two-pole peaking equalisation (EQ) filter. With this
  2624. filter, the signal-level at and around a selected frequency can
  2625. be increased or decreased, whilst (unlike bandpass and bandreject
  2626. filters) that at all other frequencies is unchanged.
  2627. In order to produce complex equalisation curves, this filter can
  2628. be given several times, each with a different central frequency.
  2629. The filter accepts the following options:
  2630. @table @option
  2631. @item frequency, f
  2632. Set the filter's central frequency in Hz.
  2633. @item width_type, t
  2634. Set method to specify band-width of filter.
  2635. @table @option
  2636. @item h
  2637. Hz
  2638. @item q
  2639. Q-Factor
  2640. @item o
  2641. octave
  2642. @item s
  2643. slope
  2644. @item k
  2645. kHz
  2646. @end table
  2647. @item width, w
  2648. Specify the band-width of a filter in width_type units.
  2649. @item gain, g
  2650. Set the required gain or attenuation in dB.
  2651. Beware of clipping when using a positive gain.
  2652. @item mix, m
  2653. How much to use filtered signal in output. Default is 1.
  2654. Range is between 0 and 1.
  2655. @item channels, c
  2656. Specify which channels to filter, by default all available are filtered.
  2657. @end table
  2658. @subsection Examples
  2659. @itemize
  2660. @item
  2661. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2662. @example
  2663. equalizer=f=1000:t=h:width=200:g=-10
  2664. @end example
  2665. @item
  2666. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2667. @example
  2668. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2669. @end example
  2670. @end itemize
  2671. @subsection Commands
  2672. This filter supports the following commands:
  2673. @table @option
  2674. @item frequency, f
  2675. Change equalizer frequency.
  2676. Syntax for the command is : "@var{frequency}"
  2677. @item width_type, t
  2678. Change equalizer width_type.
  2679. Syntax for the command is : "@var{width_type}"
  2680. @item width, w
  2681. Change equalizer width.
  2682. Syntax for the command is : "@var{width}"
  2683. @item gain, g
  2684. Change equalizer gain.
  2685. Syntax for the command is : "@var{gain}"
  2686. @item mix, m
  2687. Change equalizer mix.
  2688. Syntax for the command is : "@var{mix}"
  2689. @end table
  2690. @section extrastereo
  2691. Linearly increases the difference between left and right channels which
  2692. adds some sort of "live" effect to playback.
  2693. The filter accepts the following options:
  2694. @table @option
  2695. @item m
  2696. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2697. (average of both channels), with 1.0 sound will be unchanged, with
  2698. -1.0 left and right channels will be swapped.
  2699. @item c
  2700. Enable clipping. By default is enabled.
  2701. @end table
  2702. @section firequalizer
  2703. Apply FIR Equalization using arbitrary frequency response.
  2704. The filter accepts the following option:
  2705. @table @option
  2706. @item gain
  2707. Set gain curve equation (in dB). The expression can contain variables:
  2708. @table @option
  2709. @item f
  2710. the evaluated frequency
  2711. @item sr
  2712. sample rate
  2713. @item ch
  2714. channel number, set to 0 when multichannels evaluation is disabled
  2715. @item chid
  2716. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2717. multichannels evaluation is disabled
  2718. @item chs
  2719. number of channels
  2720. @item chlayout
  2721. channel_layout, see libavutil/channel_layout.h
  2722. @end table
  2723. and functions:
  2724. @table @option
  2725. @item gain_interpolate(f)
  2726. interpolate gain on frequency f based on gain_entry
  2727. @item cubic_interpolate(f)
  2728. same as gain_interpolate, but smoother
  2729. @end table
  2730. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2731. @item gain_entry
  2732. Set gain entry for gain_interpolate function. The expression can
  2733. contain functions:
  2734. @table @option
  2735. @item entry(f, g)
  2736. store gain entry at frequency f with value g
  2737. @end table
  2738. This option is also available as command.
  2739. @item delay
  2740. Set filter delay in seconds. Higher value means more accurate.
  2741. Default is @code{0.01}.
  2742. @item accuracy
  2743. Set filter accuracy in Hz. Lower value means more accurate.
  2744. Default is @code{5}.
  2745. @item wfunc
  2746. Set window function. Acceptable values are:
  2747. @table @option
  2748. @item rectangular
  2749. rectangular window, useful when gain curve is already smooth
  2750. @item hann
  2751. hann window (default)
  2752. @item hamming
  2753. hamming window
  2754. @item blackman
  2755. blackman window
  2756. @item nuttall3
  2757. 3-terms continuous 1st derivative nuttall window
  2758. @item mnuttall3
  2759. minimum 3-terms discontinuous nuttall window
  2760. @item nuttall
  2761. 4-terms continuous 1st derivative nuttall window
  2762. @item bnuttall
  2763. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2764. @item bharris
  2765. blackman-harris window
  2766. @item tukey
  2767. tukey window
  2768. @end table
  2769. @item fixed
  2770. If enabled, use fixed number of audio samples. This improves speed when
  2771. filtering with large delay. Default is disabled.
  2772. @item multi
  2773. Enable multichannels evaluation on gain. Default is disabled.
  2774. @item zero_phase
  2775. Enable zero phase mode by subtracting timestamp to compensate delay.
  2776. Default is disabled.
  2777. @item scale
  2778. Set scale used by gain. Acceptable values are:
  2779. @table @option
  2780. @item linlin
  2781. linear frequency, linear gain
  2782. @item linlog
  2783. linear frequency, logarithmic (in dB) gain (default)
  2784. @item loglin
  2785. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2786. @item loglog
  2787. logarithmic frequency, logarithmic gain
  2788. @end table
  2789. @item dumpfile
  2790. Set file for dumping, suitable for gnuplot.
  2791. @item dumpscale
  2792. Set scale for dumpfile. Acceptable values are same with scale option.
  2793. Default is linlog.
  2794. @item fft2
  2795. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2796. Default is disabled.
  2797. @item min_phase
  2798. Enable minimum phase impulse response. Default is disabled.
  2799. @end table
  2800. @subsection Examples
  2801. @itemize
  2802. @item
  2803. lowpass at 1000 Hz:
  2804. @example
  2805. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2806. @end example
  2807. @item
  2808. lowpass at 1000 Hz with gain_entry:
  2809. @example
  2810. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2811. @end example
  2812. @item
  2813. custom equalization:
  2814. @example
  2815. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2816. @end example
  2817. @item
  2818. higher delay with zero phase to compensate delay:
  2819. @example
  2820. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2821. @end example
  2822. @item
  2823. lowpass on left channel, highpass on right channel:
  2824. @example
  2825. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2826. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2827. @end example
  2828. @end itemize
  2829. @section flanger
  2830. Apply a flanging effect to the audio.
  2831. The filter accepts the following options:
  2832. @table @option
  2833. @item delay
  2834. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2835. @item depth
  2836. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2837. @item regen
  2838. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2839. Default value is 0.
  2840. @item width
  2841. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2842. Default value is 71.
  2843. @item speed
  2844. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2845. @item shape
  2846. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2847. Default value is @var{sinusoidal}.
  2848. @item phase
  2849. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2850. Default value is 25.
  2851. @item interp
  2852. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2853. Default is @var{linear}.
  2854. @end table
  2855. @section haas
  2856. Apply Haas effect to audio.
  2857. Note that this makes most sense to apply on mono signals.
  2858. With this filter applied to mono signals it give some directionality and
  2859. stretches its stereo image.
  2860. The filter accepts the following options:
  2861. @table @option
  2862. @item level_in
  2863. Set input level. By default is @var{1}, or 0dB
  2864. @item level_out
  2865. Set output level. By default is @var{1}, or 0dB.
  2866. @item side_gain
  2867. Set gain applied to side part of signal. By default is @var{1}.
  2868. @item middle_source
  2869. Set kind of middle source. Can be one of the following:
  2870. @table @samp
  2871. @item left
  2872. Pick left channel.
  2873. @item right
  2874. Pick right channel.
  2875. @item mid
  2876. Pick middle part signal of stereo image.
  2877. @item side
  2878. Pick side part signal of stereo image.
  2879. @end table
  2880. @item middle_phase
  2881. Change middle phase. By default is disabled.
  2882. @item left_delay
  2883. Set left channel delay. By default is @var{2.05} milliseconds.
  2884. @item left_balance
  2885. Set left channel balance. By default is @var{-1}.
  2886. @item left_gain
  2887. Set left channel gain. By default is @var{1}.
  2888. @item left_phase
  2889. Change left phase. By default is disabled.
  2890. @item right_delay
  2891. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2892. @item right_balance
  2893. Set right channel balance. By default is @var{1}.
  2894. @item right_gain
  2895. Set right channel gain. By default is @var{1}.
  2896. @item right_phase
  2897. Change right phase. By default is enabled.
  2898. @end table
  2899. @section hdcd
  2900. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2901. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2902. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2903. of HDCD, and detects the Transient Filter flag.
  2904. @example
  2905. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2906. @end example
  2907. When using the filter with wav, note the default encoding for wav is 16-bit,
  2908. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2909. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2910. @example
  2911. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2912. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2913. @end example
  2914. The filter accepts the following options:
  2915. @table @option
  2916. @item disable_autoconvert
  2917. Disable any automatic format conversion or resampling in the filter graph.
  2918. @item process_stereo
  2919. Process the stereo channels together. If target_gain does not match between
  2920. channels, consider it invalid and use the last valid target_gain.
  2921. @item cdt_ms
  2922. Set the code detect timer period in ms.
  2923. @item force_pe
  2924. Always extend peaks above -3dBFS even if PE isn't signaled.
  2925. @item analyze_mode
  2926. Replace audio with a solid tone and adjust the amplitude to signal some
  2927. specific aspect of the decoding process. The output file can be loaded in
  2928. an audio editor alongside the original to aid analysis.
  2929. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2930. Modes are:
  2931. @table @samp
  2932. @item 0, off
  2933. Disabled
  2934. @item 1, lle
  2935. Gain adjustment level at each sample
  2936. @item 2, pe
  2937. Samples where peak extend occurs
  2938. @item 3, cdt
  2939. Samples where the code detect timer is active
  2940. @item 4, tgm
  2941. Samples where the target gain does not match between channels
  2942. @end table
  2943. @end table
  2944. @section headphone
  2945. Apply head-related transfer functions (HRTFs) to create virtual
  2946. loudspeakers around the user for binaural listening via headphones.
  2947. The HRIRs are provided via additional streams, for each channel
  2948. one stereo input stream is needed.
  2949. The filter accepts the following options:
  2950. @table @option
  2951. @item map
  2952. Set mapping of input streams for convolution.
  2953. The argument is a '|'-separated list of channel names in order as they
  2954. are given as additional stream inputs for filter.
  2955. This also specify number of input streams. Number of input streams
  2956. must be not less than number of channels in first stream plus one.
  2957. @item gain
  2958. Set gain applied to audio. Value is in dB. Default is 0.
  2959. @item type
  2960. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2961. processing audio in time domain which is slow.
  2962. @var{freq} is processing audio in frequency domain which is fast.
  2963. Default is @var{freq}.
  2964. @item lfe
  2965. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2966. @item size
  2967. Set size of frame in number of samples which will be processed at once.
  2968. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2969. @item hrir
  2970. Set format of hrir stream.
  2971. Default value is @var{stereo}. Alternative value is @var{multich}.
  2972. If value is set to @var{stereo}, number of additional streams should
  2973. be greater or equal to number of input channels in first input stream.
  2974. Also each additional stream should have stereo number of channels.
  2975. If value is set to @var{multich}, number of additional streams should
  2976. be exactly one. Also number of input channels of additional stream
  2977. should be equal or greater than twice number of channels of first input
  2978. stream.
  2979. @end table
  2980. @subsection Examples
  2981. @itemize
  2982. @item
  2983. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2984. each amovie filter use stereo file with IR coefficients as input.
  2985. The files give coefficients for each position of virtual loudspeaker:
  2986. @example
  2987. ffmpeg -i input.wav
  2988. -filter_complex "amovie=azi_270_ele_0_DFC.wav[sr];amovie=azi_90_ele_0_DFC.wav[sl];amovie=azi_225_ele_0_DFC.wav[br];amovie=azi_135_ele_0_DFC.wav[bl];amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe];amovie=azi_35_ele_0_DFC.wav[fl];amovie=azi_325_ele_0_DFC.wav[fr];[0:a][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2989. output.wav
  2990. @end example
  2991. @item
  2992. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2993. but now in @var{multich} @var{hrir} format.
  2994. @example
  2995. ffmpeg -i input.wav -filter_complex "amovie=minp.wav[hrirs];[0:a][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  2996. output.wav
  2997. @end example
  2998. @end itemize
  2999. @section highpass
  3000. Apply a high-pass filter with 3dB point frequency.
  3001. The filter can be either single-pole, or double-pole (the default).
  3002. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3003. The filter accepts the following options:
  3004. @table @option
  3005. @item frequency, f
  3006. Set frequency in Hz. Default is 3000.
  3007. @item poles, p
  3008. Set number of poles. Default is 2.
  3009. @item width_type, t
  3010. Set method to specify band-width of filter.
  3011. @table @option
  3012. @item h
  3013. Hz
  3014. @item q
  3015. Q-Factor
  3016. @item o
  3017. octave
  3018. @item s
  3019. slope
  3020. @item k
  3021. kHz
  3022. @end table
  3023. @item width, w
  3024. Specify the band-width of a filter in width_type units.
  3025. Applies only to double-pole filter.
  3026. The default is 0.707q and gives a Butterworth response.
  3027. @item mix, m
  3028. How much to use filtered signal in output. Default is 1.
  3029. Range is between 0 and 1.
  3030. @item channels, c
  3031. Specify which channels to filter, by default all available are filtered.
  3032. @end table
  3033. @subsection Commands
  3034. This filter supports the following commands:
  3035. @table @option
  3036. @item frequency, f
  3037. Change highpass frequency.
  3038. Syntax for the command is : "@var{frequency}"
  3039. @item width_type, t
  3040. Change highpass width_type.
  3041. Syntax for the command is : "@var{width_type}"
  3042. @item width, w
  3043. Change highpass width.
  3044. Syntax for the command is : "@var{width}"
  3045. @item mix, m
  3046. Change highpass mix.
  3047. Syntax for the command is : "@var{mix}"
  3048. @end table
  3049. @section join
  3050. Join multiple input streams into one multi-channel stream.
  3051. It accepts the following parameters:
  3052. @table @option
  3053. @item inputs
  3054. The number of input streams. It defaults to 2.
  3055. @item channel_layout
  3056. The desired output channel layout. It defaults to stereo.
  3057. @item map
  3058. Map channels from inputs to output. The argument is a '|'-separated list of
  3059. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3060. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3061. can be either the name of the input channel (e.g. FL for front left) or its
  3062. index in the specified input stream. @var{out_channel} is the name of the output
  3063. channel.
  3064. @end table
  3065. The filter will attempt to guess the mappings when they are not specified
  3066. explicitly. It does so by first trying to find an unused matching input channel
  3067. and if that fails it picks the first unused input channel.
  3068. Join 3 inputs (with properly set channel layouts):
  3069. @example
  3070. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3071. @end example
  3072. Build a 5.1 output from 6 single-channel streams:
  3073. @example
  3074. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3075. 'join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-SL|4.0-SR|5.0-LFE'
  3076. out
  3077. @end example
  3078. @section ladspa
  3079. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3080. To enable compilation of this filter you need to configure FFmpeg with
  3081. @code{--enable-ladspa}.
  3082. @table @option
  3083. @item file, f
  3084. Specifies the name of LADSPA plugin library to load. If the environment
  3085. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3086. each one of the directories specified by the colon separated list in
  3087. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3088. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3089. @file{/usr/lib/ladspa/}.
  3090. @item plugin, p
  3091. Specifies the plugin within the library. Some libraries contain only
  3092. one plugin, but others contain many of them. If this is not set filter
  3093. will list all available plugins within the specified library.
  3094. @item controls, c
  3095. Set the '|' separated list of controls which are zero or more floating point
  3096. values that determine the behavior of the loaded plugin (for example delay,
  3097. threshold or gain).
  3098. Controls need to be defined using the following syntax:
  3099. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3100. @var{valuei} is the value set on the @var{i}-th control.
  3101. Alternatively they can be also defined using the following syntax:
  3102. @var{value0}|@var{value1}|@var{value2}|..., where
  3103. @var{valuei} is the value set on the @var{i}-th control.
  3104. If @option{controls} is set to @code{help}, all available controls and
  3105. their valid ranges are printed.
  3106. @item sample_rate, s
  3107. Specify the sample rate, default to 44100. Only used if plugin have
  3108. zero inputs.
  3109. @item nb_samples, n
  3110. Set the number of samples per channel per each output frame, default
  3111. is 1024. Only used if plugin have zero inputs.
  3112. @item duration, d
  3113. Set the minimum duration of the sourced audio. See
  3114. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3115. for the accepted syntax.
  3116. Note that the resulting duration may be greater than the specified duration,
  3117. as the generated audio is always cut at the end of a complete frame.
  3118. If not specified, or the expressed duration is negative, the audio is
  3119. supposed to be generated forever.
  3120. Only used if plugin have zero inputs.
  3121. @end table
  3122. @subsection Examples
  3123. @itemize
  3124. @item
  3125. List all available plugins within amp (LADSPA example plugin) library:
  3126. @example
  3127. ladspa=file=amp
  3128. @end example
  3129. @item
  3130. List all available controls and their valid ranges for @code{vcf_notch}
  3131. plugin from @code{VCF} library:
  3132. @example
  3133. ladspa=f=vcf:p=vcf_notch:c=help
  3134. @end example
  3135. @item
  3136. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3137. plugin library:
  3138. @example
  3139. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3140. @end example
  3141. @item
  3142. Add reverberation to the audio using TAP-plugins
  3143. (Tom's Audio Processing plugins):
  3144. @example
  3145. ladspa=file=tap_reverb:tap_reverb
  3146. @end example
  3147. @item
  3148. Generate white noise, with 0.2 amplitude:
  3149. @example
  3150. ladspa=file=cmt:noise_source_white:c=c0=.2
  3151. @end example
  3152. @item
  3153. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3154. @code{C* Audio Plugin Suite} (CAPS) library:
  3155. @example
  3156. ladspa=file=caps:Click:c=c1=20'
  3157. @end example
  3158. @item
  3159. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3160. @example
  3161. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3162. @end example
  3163. @item
  3164. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3165. @code{SWH Plugins} collection:
  3166. @example
  3167. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3168. @end example
  3169. @item
  3170. Attenuate low frequencies using Multiband EQ from Steve Harris
  3171. @code{SWH Plugins} collection:
  3172. @example
  3173. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3174. @end example
  3175. @item
  3176. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3177. (CAPS) library:
  3178. @example
  3179. ladspa=caps:Narrower
  3180. @end example
  3181. @item
  3182. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3183. @example
  3184. ladspa=caps:White:.2
  3185. @end example
  3186. @item
  3187. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3188. @example
  3189. ladspa=caps:Fractal:c=c1=1
  3190. @end example
  3191. @item
  3192. Dynamic volume normalization using @code{VLevel} plugin:
  3193. @example
  3194. ladspa=vlevel-ladspa:vlevel_mono
  3195. @end example
  3196. @end itemize
  3197. @subsection Commands
  3198. This filter supports the following commands:
  3199. @table @option
  3200. @item cN
  3201. Modify the @var{N}-th control value.
  3202. If the specified value is not valid, it is ignored and prior one is kept.
  3203. @end table
  3204. @section loudnorm
  3205. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3206. Support for both single pass (livestreams, files) and double pass (files) modes.
  3207. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3208. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3209. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3210. The filter accepts the following options:
  3211. @table @option
  3212. @item I, i
  3213. Set integrated loudness target.
  3214. Range is -70.0 - -5.0. Default value is -24.0.
  3215. @item LRA, lra
  3216. Set loudness range target.
  3217. Range is 1.0 - 20.0. Default value is 7.0.
  3218. @item TP, tp
  3219. Set maximum true peak.
  3220. Range is -9.0 - +0.0. Default value is -2.0.
  3221. @item measured_I, measured_i
  3222. Measured IL of input file.
  3223. Range is -99.0 - +0.0.
  3224. @item measured_LRA, measured_lra
  3225. Measured LRA of input file.
  3226. Range is 0.0 - 99.0.
  3227. @item measured_TP, measured_tp
  3228. Measured true peak of input file.
  3229. Range is -99.0 - +99.0.
  3230. @item measured_thresh
  3231. Measured threshold of input file.
  3232. Range is -99.0 - +0.0.
  3233. @item offset
  3234. Set offset gain. Gain is applied before the true-peak limiter.
  3235. Range is -99.0 - +99.0. Default is +0.0.
  3236. @item linear
  3237. Normalize linearly if possible.
  3238. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3239. to be specified in order to use this mode.
  3240. Options are true or false. Default is true.
  3241. @item dual_mono
  3242. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3243. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3244. If set to @code{true}, this option will compensate for this effect.
  3245. Multi-channel input files are not affected by this option.
  3246. Options are true or false. Default is false.
  3247. @item print_format
  3248. Set print format for stats. Options are summary, json, or none.
  3249. Default value is none.
  3250. @end table
  3251. @section lowpass
  3252. Apply a low-pass filter with 3dB point frequency.
  3253. The filter can be either single-pole or double-pole (the default).
  3254. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3255. The filter accepts the following options:
  3256. @table @option
  3257. @item frequency, f
  3258. Set frequency in Hz. Default is 500.
  3259. @item poles, p
  3260. Set number of poles. Default is 2.
  3261. @item width_type, t
  3262. Set method to specify band-width of filter.
  3263. @table @option
  3264. @item h
  3265. Hz
  3266. @item q
  3267. Q-Factor
  3268. @item o
  3269. octave
  3270. @item s
  3271. slope
  3272. @item k
  3273. kHz
  3274. @end table
  3275. @item width, w
  3276. Specify the band-width of a filter in width_type units.
  3277. Applies only to double-pole filter.
  3278. The default is 0.707q and gives a Butterworth response.
  3279. @item mix, m
  3280. How much to use filtered signal in output. Default is 1.
  3281. Range is between 0 and 1.
  3282. @item channels, c
  3283. Specify which channels to filter, by default all available are filtered.
  3284. @end table
  3285. @subsection Examples
  3286. @itemize
  3287. @item
  3288. Lowpass only LFE channel, it LFE is not present it does nothing:
  3289. @example
  3290. lowpass=c=LFE
  3291. @end example
  3292. @end itemize
  3293. @subsection Commands
  3294. This filter supports the following commands:
  3295. @table @option
  3296. @item frequency, f
  3297. Change lowpass frequency.
  3298. Syntax for the command is : "@var{frequency}"
  3299. @item width_type, t
  3300. Change lowpass width_type.
  3301. Syntax for the command is : "@var{width_type}"
  3302. @item width, w
  3303. Change lowpass width.
  3304. Syntax for the command is : "@var{width}"
  3305. @item mix, m
  3306. Change lowpass mix.
  3307. Syntax for the command is : "@var{mix}"
  3308. @end table
  3309. @section lv2
  3310. Load a LV2 (LADSPA Version 2) plugin.
  3311. To enable compilation of this filter you need to configure FFmpeg with
  3312. @code{--enable-lv2}.
  3313. @table @option
  3314. @item plugin, p
  3315. Specifies the plugin URI. You may need to escape ':'.
  3316. @item controls, c
  3317. Set the '|' separated list of controls which are zero or more floating point
  3318. values that determine the behavior of the loaded plugin (for example delay,
  3319. threshold or gain).
  3320. If @option{controls} is set to @code{help}, all available controls and
  3321. their valid ranges are printed.
  3322. @item sample_rate, s
  3323. Specify the sample rate, default to 44100. Only used if plugin have
  3324. zero inputs.
  3325. @item nb_samples, n
  3326. Set the number of samples per channel per each output frame, default
  3327. is 1024. Only used if plugin have zero inputs.
  3328. @item duration, d
  3329. Set the minimum duration of the sourced audio. See
  3330. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3331. for the accepted syntax.
  3332. Note that the resulting duration may be greater than the specified duration,
  3333. as the generated audio is always cut at the end of a complete frame.
  3334. If not specified, or the expressed duration is negative, the audio is
  3335. supposed to be generated forever.
  3336. Only used if plugin have zero inputs.
  3337. @end table
  3338. @subsection Examples
  3339. @itemize
  3340. @item
  3341. Apply bass enhancer plugin from Calf:
  3342. @example
  3343. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3344. @end example
  3345. @item
  3346. Apply vinyl plugin from Calf:
  3347. @example
  3348. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3349. @end example
  3350. @item
  3351. Apply bit crusher plugin from ArtyFX:
  3352. @example
  3353. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3354. @end example
  3355. @end itemize
  3356. @section mcompand
  3357. Multiband Compress or expand the audio's dynamic range.
  3358. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3359. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3360. response when absent compander action.
  3361. It accepts the following parameters:
  3362. @table @option
  3363. @item args
  3364. This option syntax is:
  3365. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3366. For explanation of each item refer to compand filter documentation.
  3367. @end table
  3368. @anchor{pan}
  3369. @section pan
  3370. Mix channels with specific gain levels. The filter accepts the output
  3371. channel layout followed by a set of channels definitions.
  3372. This filter is also designed to efficiently remap the channels of an audio
  3373. stream.
  3374. The filter accepts parameters of the form:
  3375. "@var{l}|@var{outdef}|@var{outdef}|..."
  3376. @table @option
  3377. @item l
  3378. output channel layout or number of channels
  3379. @item outdef
  3380. output channel specification, of the form:
  3381. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3382. @item out_name
  3383. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3384. number (c0, c1, etc.)
  3385. @item gain
  3386. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3387. @item in_name
  3388. input channel to use, see out_name for details; it is not possible to mix
  3389. named and numbered input channels
  3390. @end table
  3391. If the `=' in a channel specification is replaced by `<', then the gains for
  3392. that specification will be renormalized so that the total is 1, thus
  3393. avoiding clipping noise.
  3394. @subsection Mixing examples
  3395. For example, if you want to down-mix from stereo to mono, but with a bigger
  3396. factor for the left channel:
  3397. @example
  3398. pan=1c|c0=0.9*c0+0.1*c1
  3399. @end example
  3400. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3401. 7-channels surround:
  3402. @example
  3403. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3404. @end example
  3405. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3406. that should be preferred (see "-ac" option) unless you have very specific
  3407. needs.
  3408. @subsection Remapping examples
  3409. The channel remapping will be effective if, and only if:
  3410. @itemize
  3411. @item gain coefficients are zeroes or ones,
  3412. @item only one input per channel output,
  3413. @end itemize
  3414. If all these conditions are satisfied, the filter will notify the user ("Pure
  3415. channel mapping detected"), and use an optimized and lossless method to do the
  3416. remapping.
  3417. For example, if you have a 5.1 source and want a stereo audio stream by
  3418. dropping the extra channels:
  3419. @example
  3420. pan="stereo| c0=FL | c1=FR"
  3421. @end example
  3422. Given the same source, you can also switch front left and front right channels
  3423. and keep the input channel layout:
  3424. @example
  3425. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3426. @end example
  3427. If the input is a stereo audio stream, you can mute the front left channel (and
  3428. still keep the stereo channel layout) with:
  3429. @example
  3430. pan="stereo|c1=c1"
  3431. @end example
  3432. Still with a stereo audio stream input, you can copy the right channel in both
  3433. front left and right:
  3434. @example
  3435. pan="stereo| c0=FR | c1=FR"
  3436. @end example
  3437. @section replaygain
  3438. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3439. outputs it unchanged.
  3440. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3441. @section resample
  3442. Convert the audio sample format, sample rate and channel layout. It is
  3443. not meant to be used directly.
  3444. @section rubberband
  3445. Apply time-stretching and pitch-shifting with librubberband.
  3446. To enable compilation of this filter, you need to configure FFmpeg with
  3447. @code{--enable-librubberband}.
  3448. The filter accepts the following options:
  3449. @table @option
  3450. @item tempo
  3451. Set tempo scale factor.
  3452. @item pitch
  3453. Set pitch scale factor.
  3454. @item transients
  3455. Set transients detector.
  3456. Possible values are:
  3457. @table @var
  3458. @item crisp
  3459. @item mixed
  3460. @item smooth
  3461. @end table
  3462. @item detector
  3463. Set detector.
  3464. Possible values are:
  3465. @table @var
  3466. @item compound
  3467. @item percussive
  3468. @item soft
  3469. @end table
  3470. @item phase
  3471. Set phase.
  3472. Possible values are:
  3473. @table @var
  3474. @item laminar
  3475. @item independent
  3476. @end table
  3477. @item window
  3478. Set processing window size.
  3479. Possible values are:
  3480. @table @var
  3481. @item standard
  3482. @item short
  3483. @item long
  3484. @end table
  3485. @item smoothing
  3486. Set smoothing.
  3487. Possible values are:
  3488. @table @var
  3489. @item off
  3490. @item on
  3491. @end table
  3492. @item formant
  3493. Enable formant preservation when shift pitching.
  3494. Possible values are:
  3495. @table @var
  3496. @item shifted
  3497. @item preserved
  3498. @end table
  3499. @item pitchq
  3500. Set pitch quality.
  3501. Possible values are:
  3502. @table @var
  3503. @item quality
  3504. @item speed
  3505. @item consistency
  3506. @end table
  3507. @item channels
  3508. Set channels.
  3509. Possible values are:
  3510. @table @var
  3511. @item apart
  3512. @item together
  3513. @end table
  3514. @end table
  3515. @subsection Commands
  3516. This filter supports the following commands:
  3517. @table @option
  3518. @item tempo
  3519. Change filter tempo scale factor.
  3520. Syntax for the command is : "@var{tempo}"
  3521. @item pitch
  3522. Change filter pitch scale factor.
  3523. Syntax for the command is : "@var{pitch}"
  3524. @end table
  3525. @section sidechaincompress
  3526. This filter acts like normal compressor but has the ability to compress
  3527. detected signal using second input signal.
  3528. It needs two input streams and returns one output stream.
  3529. First input stream will be processed depending on second stream signal.
  3530. The filtered signal then can be filtered with other filters in later stages of
  3531. processing. See @ref{pan} and @ref{amerge} filter.
  3532. The filter accepts the following options:
  3533. @table @option
  3534. @item level_in
  3535. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3536. @item mode
  3537. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3538. Default is @code{downward}.
  3539. @item threshold
  3540. If a signal of second stream raises above this level it will affect the gain
  3541. reduction of first stream.
  3542. By default is 0.125. Range is between 0.00097563 and 1.
  3543. @item ratio
  3544. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3545. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3546. Default is 2. Range is between 1 and 20.
  3547. @item attack
  3548. Amount of milliseconds the signal has to rise above the threshold before gain
  3549. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3550. @item release
  3551. Amount of milliseconds the signal has to fall below the threshold before
  3552. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3553. @item makeup
  3554. Set the amount by how much signal will be amplified after processing.
  3555. Default is 1. Range is from 1 to 64.
  3556. @item knee
  3557. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3558. Default is 2.82843. Range is between 1 and 8.
  3559. @item link
  3560. Choose if the @code{average} level between all channels of side-chain stream
  3561. or the louder(@code{maximum}) channel of side-chain stream affects the
  3562. reduction. Default is @code{average}.
  3563. @item detection
  3564. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3565. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3566. @item level_sc
  3567. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3568. @item mix
  3569. How much to use compressed signal in output. Default is 1.
  3570. Range is between 0 and 1.
  3571. @end table
  3572. @subsection Examples
  3573. @itemize
  3574. @item
  3575. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3576. depending on the signal of 2nd input and later compressed signal to be
  3577. merged with 2nd input:
  3578. @example
  3579. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3580. @end example
  3581. @end itemize
  3582. @section sidechaingate
  3583. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3584. filter the detected signal before sending it to the gain reduction stage.
  3585. Normally a gate uses the full range signal to detect a level above the
  3586. threshold.
  3587. For example: If you cut all lower frequencies from your sidechain signal
  3588. the gate will decrease the volume of your track only if not enough highs
  3589. appear. With this technique you are able to reduce the resonation of a
  3590. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3591. guitar.
  3592. It needs two input streams and returns one output stream.
  3593. First input stream will be processed depending on second stream signal.
  3594. The filter accepts the following options:
  3595. @table @option
  3596. @item level_in
  3597. Set input level before filtering.
  3598. Default is 1. Allowed range is from 0.015625 to 64.
  3599. @item mode
  3600. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3601. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3602. will be amplified, expanding dynamic range in upward direction.
  3603. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3604. @item range
  3605. Set the level of gain reduction when the signal is below the threshold.
  3606. Default is 0.06125. Allowed range is from 0 to 1.
  3607. Setting this to 0 disables reduction and then filter behaves like expander.
  3608. @item threshold
  3609. If a signal rises above this level the gain reduction is released.
  3610. Default is 0.125. Allowed range is from 0 to 1.
  3611. @item ratio
  3612. Set a ratio about which the signal is reduced.
  3613. Default is 2. Allowed range is from 1 to 9000.
  3614. @item attack
  3615. Amount of milliseconds the signal has to rise above the threshold before gain
  3616. reduction stops.
  3617. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3618. @item release
  3619. Amount of milliseconds the signal has to fall below the threshold before the
  3620. reduction is increased again. Default is 250 milliseconds.
  3621. Allowed range is from 0.01 to 9000.
  3622. @item makeup
  3623. Set amount of amplification of signal after processing.
  3624. Default is 1. Allowed range is from 1 to 64.
  3625. @item knee
  3626. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3627. Default is 2.828427125. Allowed range is from 1 to 8.
  3628. @item detection
  3629. Choose if exact signal should be taken for detection or an RMS like one.
  3630. Default is rms. Can be peak or rms.
  3631. @item link
  3632. Choose if the average level between all channels or the louder channel affects
  3633. the reduction.
  3634. Default is average. Can be average or maximum.
  3635. @item level_sc
  3636. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3637. @end table
  3638. @section silencedetect
  3639. Detect silence in an audio stream.
  3640. This filter logs a message when it detects that the input audio volume is less
  3641. or equal to a noise tolerance value for a duration greater or equal to the
  3642. minimum detected noise duration.
  3643. The printed times and duration are expressed in seconds.
  3644. The filter accepts the following options:
  3645. @table @option
  3646. @item noise, n
  3647. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3648. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3649. @item duration, d
  3650. Set silence duration until notification (default is 2 seconds).
  3651. @item mono, m
  3652. Process each channel separately, instead of combined. By default is disabled.
  3653. @end table
  3654. @subsection Examples
  3655. @itemize
  3656. @item
  3657. Detect 5 seconds of silence with -50dB noise tolerance:
  3658. @example
  3659. silencedetect=n=-50dB:d=5
  3660. @end example
  3661. @item
  3662. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3663. tolerance in @file{silence.mp3}:
  3664. @example
  3665. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3666. @end example
  3667. @end itemize
  3668. @section silenceremove
  3669. Remove silence from the beginning, middle or end of the audio.
  3670. The filter accepts the following options:
  3671. @table @option
  3672. @item start_periods
  3673. This value is used to indicate if audio should be trimmed at beginning of
  3674. the audio. A value of zero indicates no silence should be trimmed from the
  3675. beginning. When specifying a non-zero value, it trims audio up until it
  3676. finds non-silence. Normally, when trimming silence from beginning of audio
  3677. the @var{start_periods} will be @code{1} but it can be increased to higher
  3678. values to trim all audio up to specific count of non-silence periods.
  3679. Default value is @code{0}.
  3680. @item start_duration
  3681. Specify the amount of time that non-silence must be detected before it stops
  3682. trimming audio. By increasing the duration, bursts of noises can be treated
  3683. as silence and trimmed off. Default value is @code{0}.
  3684. @item start_threshold
  3685. This indicates what sample value should be treated as silence. For digital
  3686. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3687. you may wish to increase the value to account for background noise.
  3688. Can be specified in dB (in case "dB" is appended to the specified value)
  3689. or amplitude ratio. Default value is @code{0}.
  3690. @item start_silence
  3691. Specify max duration of silence at beginning that will be kept after
  3692. trimming. Default is 0, which is equal to trimming all samples detected
  3693. as silence.
  3694. @item start_mode
  3695. Specify mode of detection of silence end in start of multi-channel audio.
  3696. Can be @var{any} or @var{all}. Default is @var{any}.
  3697. With @var{any}, any sample that is detected as non-silence will cause
  3698. stopped trimming of silence.
  3699. With @var{all}, only if all channels are detected as non-silence will cause
  3700. stopped trimming of silence.
  3701. @item stop_periods
  3702. Set the count for trimming silence from the end of audio.
  3703. To remove silence from the middle of a file, specify a @var{stop_periods}
  3704. that is negative. This value is then treated as a positive value and is
  3705. used to indicate the effect should restart processing as specified by
  3706. @var{start_periods}, making it suitable for removing periods of silence
  3707. in the middle of the audio.
  3708. Default value is @code{0}.
  3709. @item stop_duration
  3710. Specify a duration of silence that must exist before audio is not copied any
  3711. more. By specifying a higher duration, silence that is wanted can be left in
  3712. the audio.
  3713. Default value is @code{0}.
  3714. @item stop_threshold
  3715. This is the same as @option{start_threshold} but for trimming silence from
  3716. the end of audio.
  3717. Can be specified in dB (in case "dB" is appended to the specified value)
  3718. or amplitude ratio. Default value is @code{0}.
  3719. @item stop_silence
  3720. Specify max duration of silence at end that will be kept after
  3721. trimming. Default is 0, which is equal to trimming all samples detected
  3722. as silence.
  3723. @item stop_mode
  3724. Specify mode of detection of silence start in end of multi-channel audio.
  3725. Can be @var{any} or @var{all}. Default is @var{any}.
  3726. With @var{any}, any sample that is detected as non-silence will cause
  3727. stopped trimming of silence.
  3728. With @var{all}, only if all channels are detected as non-silence will cause
  3729. stopped trimming of silence.
  3730. @item detection
  3731. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3732. and works better with digital silence which is exactly 0.
  3733. Default value is @code{rms}.
  3734. @item window
  3735. Set duration in number of seconds used to calculate size of window in number
  3736. of samples for detecting silence.
  3737. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3738. @end table
  3739. @subsection Examples
  3740. @itemize
  3741. @item
  3742. The following example shows how this filter can be used to start a recording
  3743. that does not contain the delay at the start which usually occurs between
  3744. pressing the record button and the start of the performance:
  3745. @example
  3746. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3747. @end example
  3748. @item
  3749. Trim all silence encountered from beginning to end where there is more than 1
  3750. second of silence in audio:
  3751. @example
  3752. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3753. @end example
  3754. @item
  3755. Trim all digital silence samples, using peak detection, from beginning to end
  3756. where there is more than 0 samples of digital silence in audio and digital
  3757. silence is detected in all channels at same positions in stream:
  3758. @example
  3759. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  3760. @end example
  3761. @end itemize
  3762. @section sofalizer
  3763. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3764. loudspeakers around the user for binaural listening via headphones (audio
  3765. formats up to 9 channels supported).
  3766. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3767. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3768. Austrian Academy of Sciences.
  3769. To enable compilation of this filter you need to configure FFmpeg with
  3770. @code{--enable-libmysofa}.
  3771. The filter accepts the following options:
  3772. @table @option
  3773. @item sofa
  3774. Set the SOFA file used for rendering.
  3775. @item gain
  3776. Set gain applied to audio. Value is in dB. Default is 0.
  3777. @item rotation
  3778. Set rotation of virtual loudspeakers in deg. Default is 0.
  3779. @item elevation
  3780. Set elevation of virtual speakers in deg. Default is 0.
  3781. @item radius
  3782. Set distance in meters between loudspeakers and the listener with near-field
  3783. HRTFs. Default is 1.
  3784. @item type
  3785. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3786. processing audio in time domain which is slow.
  3787. @var{freq} is processing audio in frequency domain which is fast.
  3788. Default is @var{freq}.
  3789. @item speakers
  3790. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3791. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3792. Each virtual loudspeaker is described with short channel name following with
  3793. azimuth and elevation in degrees.
  3794. Each virtual loudspeaker description is separated by '|'.
  3795. For example to override front left and front right channel positions use:
  3796. 'speakers=FL 45 15|FR 345 15'.
  3797. Descriptions with unrecognised channel names are ignored.
  3798. @item lfegain
  3799. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3800. @item framesize
  3801. Set custom frame size in number of samples. Default is 1024.
  3802. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3803. is set to @var{freq}.
  3804. @item normalize
  3805. Should all IRs be normalized upon importing SOFA file.
  3806. By default is enabled.
  3807. @item interpolate
  3808. Should nearest IRs be interpolated with neighbor IRs if exact position
  3809. does not match. By default is disabled.
  3810. @item minphase
  3811. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3812. @item anglestep
  3813. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3814. @item radstep
  3815. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3816. @end table
  3817. @subsection Examples
  3818. @itemize
  3819. @item
  3820. Using ClubFritz6 sofa file:
  3821. @example
  3822. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3823. @end example
  3824. @item
  3825. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3826. @example
  3827. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3828. @end example
  3829. @item
  3830. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3831. and also with custom gain:
  3832. @example
  3833. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3834. @end example
  3835. @end itemize
  3836. @section stereotools
  3837. This filter has some handy utilities to manage stereo signals, for converting
  3838. M/S stereo recordings to L/R signal while having control over the parameters
  3839. or spreading the stereo image of master track.
  3840. The filter accepts the following options:
  3841. @table @option
  3842. @item level_in
  3843. Set input level before filtering for both channels. Defaults is 1.
  3844. Allowed range is from 0.015625 to 64.
  3845. @item level_out
  3846. Set output level after filtering for both channels. Defaults is 1.
  3847. Allowed range is from 0.015625 to 64.
  3848. @item balance_in
  3849. Set input balance between both channels. Default is 0.
  3850. Allowed range is from -1 to 1.
  3851. @item balance_out
  3852. Set output balance between both channels. Default is 0.
  3853. Allowed range is from -1 to 1.
  3854. @item softclip
  3855. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3856. clipping. Disabled by default.
  3857. @item mutel
  3858. Mute the left channel. Disabled by default.
  3859. @item muter
  3860. Mute the right channel. Disabled by default.
  3861. @item phasel
  3862. Change the phase of the left channel. Disabled by default.
  3863. @item phaser
  3864. Change the phase of the right channel. Disabled by default.
  3865. @item mode
  3866. Set stereo mode. Available values are:
  3867. @table @samp
  3868. @item lr>lr
  3869. Left/Right to Left/Right, this is default.
  3870. @item lr>ms
  3871. Left/Right to Mid/Side.
  3872. @item ms>lr
  3873. Mid/Side to Left/Right.
  3874. @item lr>ll
  3875. Left/Right to Left/Left.
  3876. @item lr>rr
  3877. Left/Right to Right/Right.
  3878. @item lr>l+r
  3879. Left/Right to Left + Right.
  3880. @item lr>rl
  3881. Left/Right to Right/Left.
  3882. @item ms>ll
  3883. Mid/Side to Left/Left.
  3884. @item ms>rr
  3885. Mid/Side to Right/Right.
  3886. @end table
  3887. @item slev
  3888. Set level of side signal. Default is 1.
  3889. Allowed range is from 0.015625 to 64.
  3890. @item sbal
  3891. Set balance of side signal. Default is 0.
  3892. Allowed range is from -1 to 1.
  3893. @item mlev
  3894. Set level of the middle signal. Default is 1.
  3895. Allowed range is from 0.015625 to 64.
  3896. @item mpan
  3897. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3898. @item base
  3899. Set stereo base between mono and inversed channels. Default is 0.
  3900. Allowed range is from -1 to 1.
  3901. @item delay
  3902. Set delay in milliseconds how much to delay left from right channel and
  3903. vice versa. Default is 0. Allowed range is from -20 to 20.
  3904. @item sclevel
  3905. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3906. @item phase
  3907. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3908. @item bmode_in, bmode_out
  3909. Set balance mode for balance_in/balance_out option.
  3910. Can be one of the following:
  3911. @table @samp
  3912. @item balance
  3913. Classic balance mode. Attenuate one channel at time.
  3914. Gain is raised up to 1.
  3915. @item amplitude
  3916. Similar as classic mode above but gain is raised up to 2.
  3917. @item power
  3918. Equal power distribution, from -6dB to +6dB range.
  3919. @end table
  3920. @end table
  3921. @subsection Examples
  3922. @itemize
  3923. @item
  3924. Apply karaoke like effect:
  3925. @example
  3926. stereotools=mlev=0.015625
  3927. @end example
  3928. @item
  3929. Convert M/S signal to L/R:
  3930. @example
  3931. "stereotools=mode=ms>lr"
  3932. @end example
  3933. @end itemize
  3934. @section stereowiden
  3935. This filter enhance the stereo effect by suppressing signal common to both
  3936. channels and by delaying the signal of left into right and vice versa,
  3937. thereby widening the stereo effect.
  3938. The filter accepts the following options:
  3939. @table @option
  3940. @item delay
  3941. Time in milliseconds of the delay of left signal into right and vice versa.
  3942. Default is 20 milliseconds.
  3943. @item feedback
  3944. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3945. effect of left signal in right output and vice versa which gives widening
  3946. effect. Default is 0.3.
  3947. @item crossfeed
  3948. Cross feed of left into right with inverted phase. This helps in suppressing
  3949. the mono. If the value is 1 it will cancel all the signal common to both
  3950. channels. Default is 0.3.
  3951. @item drymix
  3952. Set level of input signal of original channel. Default is 0.8.
  3953. @end table
  3954. @section superequalizer
  3955. Apply 18 band equalizer.
  3956. The filter accepts the following options:
  3957. @table @option
  3958. @item 1b
  3959. Set 65Hz band gain.
  3960. @item 2b
  3961. Set 92Hz band gain.
  3962. @item 3b
  3963. Set 131Hz band gain.
  3964. @item 4b
  3965. Set 185Hz band gain.
  3966. @item 5b
  3967. Set 262Hz band gain.
  3968. @item 6b
  3969. Set 370Hz band gain.
  3970. @item 7b
  3971. Set 523Hz band gain.
  3972. @item 8b
  3973. Set 740Hz band gain.
  3974. @item 9b
  3975. Set 1047Hz band gain.
  3976. @item 10b
  3977. Set 1480Hz band gain.
  3978. @item 11b
  3979. Set 2093Hz band gain.
  3980. @item 12b
  3981. Set 2960Hz band gain.
  3982. @item 13b
  3983. Set 4186Hz band gain.
  3984. @item 14b
  3985. Set 5920Hz band gain.
  3986. @item 15b
  3987. Set 8372Hz band gain.
  3988. @item 16b
  3989. Set 11840Hz band gain.
  3990. @item 17b
  3991. Set 16744Hz band gain.
  3992. @item 18b
  3993. Set 20000Hz band gain.
  3994. @end table
  3995. @section surround
  3996. Apply audio surround upmix filter.
  3997. This filter allows to produce multichannel output from audio stream.
  3998. The filter accepts the following options:
  3999. @table @option
  4000. @item chl_out
  4001. Set output channel layout. By default, this is @var{5.1}.
  4002. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4003. for the required syntax.
  4004. @item chl_in
  4005. Set input channel layout. By default, this is @var{stereo}.
  4006. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4007. for the required syntax.
  4008. @item level_in
  4009. Set input volume level. By default, this is @var{1}.
  4010. @item level_out
  4011. Set output volume level. By default, this is @var{1}.
  4012. @item lfe
  4013. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4014. @item lfe_low
  4015. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4016. @item lfe_high
  4017. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4018. @item lfe_mode
  4019. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4020. In @var{add} mode, LFE channel is created from input audio and added to output.
  4021. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4022. also all non-LFE output channels are subtracted with output LFE channel.
  4023. @item angle
  4024. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4025. Default is @var{90}.
  4026. @item fc_in
  4027. Set front center input volume. By default, this is @var{1}.
  4028. @item fc_out
  4029. Set front center output volume. By default, this is @var{1}.
  4030. @item fl_in
  4031. Set front left input volume. By default, this is @var{1}.
  4032. @item fl_out
  4033. Set front left output volume. By default, this is @var{1}.
  4034. @item fr_in
  4035. Set front right input volume. By default, this is @var{1}.
  4036. @item fr_out
  4037. Set front right output volume. By default, this is @var{1}.
  4038. @item sl_in
  4039. Set side left input volume. By default, this is @var{1}.
  4040. @item sl_out
  4041. Set side left output volume. By default, this is @var{1}.
  4042. @item sr_in
  4043. Set side right input volume. By default, this is @var{1}.
  4044. @item sr_out
  4045. Set side right output volume. By default, this is @var{1}.
  4046. @item bl_in
  4047. Set back left input volume. By default, this is @var{1}.
  4048. @item bl_out
  4049. Set back left output volume. By default, this is @var{1}.
  4050. @item br_in
  4051. Set back right input volume. By default, this is @var{1}.
  4052. @item br_out
  4053. Set back right output volume. By default, this is @var{1}.
  4054. @item bc_in
  4055. Set back center input volume. By default, this is @var{1}.
  4056. @item bc_out
  4057. Set back center output volume. By default, this is @var{1}.
  4058. @item lfe_in
  4059. Set LFE input volume. By default, this is @var{1}.
  4060. @item lfe_out
  4061. Set LFE output volume. By default, this is @var{1}.
  4062. @item allx
  4063. Set spread usage of stereo image across X axis for all channels.
  4064. @item ally
  4065. Set spread usage of stereo image across Y axis for all channels.
  4066. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4067. Set spread usage of stereo image across X axis for each channel.
  4068. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4069. Set spread usage of stereo image across Y axis for each channel.
  4070. @item win_size
  4071. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4072. @item win_func
  4073. Set window function.
  4074. It accepts the following values:
  4075. @table @samp
  4076. @item rect
  4077. @item bartlett
  4078. @item hann, hanning
  4079. @item hamming
  4080. @item blackman
  4081. @item welch
  4082. @item flattop
  4083. @item bharris
  4084. @item bnuttall
  4085. @item bhann
  4086. @item sine
  4087. @item nuttall
  4088. @item lanczos
  4089. @item gauss
  4090. @item tukey
  4091. @item dolph
  4092. @item cauchy
  4093. @item parzen
  4094. @item poisson
  4095. @item bohman
  4096. @end table
  4097. Default is @code{hann}.
  4098. @item overlap
  4099. Set window overlap. If set to 1, the recommended overlap for selected
  4100. window function will be picked. Default is @code{0.5}.
  4101. @end table
  4102. @section treble, highshelf
  4103. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4104. shelving filter with a response similar to that of a standard
  4105. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4106. The filter accepts the following options:
  4107. @table @option
  4108. @item gain, g
  4109. Give the gain at whichever is the lower of ~22 kHz and the
  4110. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4111. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4112. @item frequency, f
  4113. Set the filter's central frequency and so can be used
  4114. to extend or reduce the frequency range to be boosted or cut.
  4115. The default value is @code{3000} Hz.
  4116. @item width_type, t
  4117. Set method to specify band-width of filter.
  4118. @table @option
  4119. @item h
  4120. Hz
  4121. @item q
  4122. Q-Factor
  4123. @item o
  4124. octave
  4125. @item s
  4126. slope
  4127. @item k
  4128. kHz
  4129. @end table
  4130. @item width, w
  4131. Determine how steep is the filter's shelf transition.
  4132. @item mix, m
  4133. How much to use filtered signal in output. Default is 1.
  4134. Range is between 0 and 1.
  4135. @item channels, c
  4136. Specify which channels to filter, by default all available are filtered.
  4137. @end table
  4138. @subsection Commands
  4139. This filter supports the following commands:
  4140. @table @option
  4141. @item frequency, f
  4142. Change treble frequency.
  4143. Syntax for the command is : "@var{frequency}"
  4144. @item width_type, t
  4145. Change treble width_type.
  4146. Syntax for the command is : "@var{width_type}"
  4147. @item width, w
  4148. Change treble width.
  4149. Syntax for the command is : "@var{width}"
  4150. @item gain, g
  4151. Change treble gain.
  4152. Syntax for the command is : "@var{gain}"
  4153. @item mix, m
  4154. Change treble mix.
  4155. Syntax for the command is : "@var{mix}"
  4156. @end table
  4157. @section tremolo
  4158. Sinusoidal amplitude modulation.
  4159. The filter accepts the following options:
  4160. @table @option
  4161. @item f
  4162. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4163. (20 Hz or lower) will result in a tremolo effect.
  4164. This filter may also be used as a ring modulator by specifying
  4165. a modulation frequency higher than 20 Hz.
  4166. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4167. @item d
  4168. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4169. Default value is 0.5.
  4170. @end table
  4171. @section vibrato
  4172. Sinusoidal phase modulation.
  4173. The filter accepts the following options:
  4174. @table @option
  4175. @item f
  4176. Modulation frequency in Hertz.
  4177. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4178. @item d
  4179. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4180. Default value is 0.5.
  4181. @end table
  4182. @section volume
  4183. Adjust the input audio volume.
  4184. It accepts the following parameters:
  4185. @table @option
  4186. @item volume
  4187. Set audio volume expression.
  4188. Output values are clipped to the maximum value.
  4189. The output audio volume is given by the relation:
  4190. @example
  4191. @var{output_volume} = @var{volume} * @var{input_volume}
  4192. @end example
  4193. The default value for @var{volume} is "1.0".
  4194. @item precision
  4195. This parameter represents the mathematical precision.
  4196. It determines which input sample formats will be allowed, which affects the
  4197. precision of the volume scaling.
  4198. @table @option
  4199. @item fixed
  4200. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4201. @item float
  4202. 32-bit floating-point; this limits input sample format to FLT. (default)
  4203. @item double
  4204. 64-bit floating-point; this limits input sample format to DBL.
  4205. @end table
  4206. @item replaygain
  4207. Choose the behaviour on encountering ReplayGain side data in input frames.
  4208. @table @option
  4209. @item drop
  4210. Remove ReplayGain side data, ignoring its contents (the default).
  4211. @item ignore
  4212. Ignore ReplayGain side data, but leave it in the frame.
  4213. @item track
  4214. Prefer the track gain, if present.
  4215. @item album
  4216. Prefer the album gain, if present.
  4217. @end table
  4218. @item replaygain_preamp
  4219. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4220. Default value for @var{replaygain_preamp} is 0.0.
  4221. @item eval
  4222. Set when the volume expression is evaluated.
  4223. It accepts the following values:
  4224. @table @samp
  4225. @item once
  4226. only evaluate expression once during the filter initialization, or
  4227. when the @samp{volume} command is sent
  4228. @item frame
  4229. evaluate expression for each incoming frame
  4230. @end table
  4231. Default value is @samp{once}.
  4232. @end table
  4233. The volume expression can contain the following parameters.
  4234. @table @option
  4235. @item n
  4236. frame number (starting at zero)
  4237. @item nb_channels
  4238. number of channels
  4239. @item nb_consumed_samples
  4240. number of samples consumed by the filter
  4241. @item nb_samples
  4242. number of samples in the current frame
  4243. @item pos
  4244. original frame position in the file
  4245. @item pts
  4246. frame PTS
  4247. @item sample_rate
  4248. sample rate
  4249. @item startpts
  4250. PTS at start of stream
  4251. @item startt
  4252. time at start of stream
  4253. @item t
  4254. frame time
  4255. @item tb
  4256. timestamp timebase
  4257. @item volume
  4258. last set volume value
  4259. @end table
  4260. Note that when @option{eval} is set to @samp{once} only the
  4261. @var{sample_rate} and @var{tb} variables are available, all other
  4262. variables will evaluate to NAN.
  4263. @subsection Commands
  4264. This filter supports the following commands:
  4265. @table @option
  4266. @item volume
  4267. Modify the volume expression.
  4268. The command accepts the same syntax of the corresponding option.
  4269. If the specified expression is not valid, it is kept at its current
  4270. value.
  4271. @item replaygain_noclip
  4272. Prevent clipping by limiting the gain applied.
  4273. Default value for @var{replaygain_noclip} is 1.
  4274. @end table
  4275. @subsection Examples
  4276. @itemize
  4277. @item
  4278. Halve the input audio volume:
  4279. @example
  4280. volume=volume=0.5
  4281. volume=volume=1/2
  4282. volume=volume=-6.0206dB
  4283. @end example
  4284. In all the above example the named key for @option{volume} can be
  4285. omitted, for example like in:
  4286. @example
  4287. volume=0.5
  4288. @end example
  4289. @item
  4290. Increase input audio power by 6 decibels using fixed-point precision:
  4291. @example
  4292. volume=volume=6dB:precision=fixed
  4293. @end example
  4294. @item
  4295. Fade volume after time 10 with an annihilation period of 5 seconds:
  4296. @example
  4297. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4298. @end example
  4299. @end itemize
  4300. @section volumedetect
  4301. Detect the volume of the input video.
  4302. The filter has no parameters. The input is not modified. Statistics about
  4303. the volume will be printed in the log when the input stream end is reached.
  4304. In particular it will show the mean volume (root mean square), maximum
  4305. volume (on a per-sample basis), and the beginning of a histogram of the
  4306. registered volume values (from the maximum value to a cumulated 1/1000 of
  4307. the samples).
  4308. All volumes are in decibels relative to the maximum PCM value.
  4309. @subsection Examples
  4310. Here is an excerpt of the output:
  4311. @example
  4312. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4313. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4314. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4315. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4316. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4317. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4318. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4319. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4320. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4321. @end example
  4322. It means that:
  4323. @itemize
  4324. @item
  4325. The mean square energy is approximately -27 dB, or 10^-2.7.
  4326. @item
  4327. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4328. @item
  4329. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4330. @end itemize
  4331. In other words, raising the volume by +4 dB does not cause any clipping,
  4332. raising it by +5 dB causes clipping for 6 samples, etc.
  4333. @c man end AUDIO FILTERS
  4334. @chapter Audio Sources
  4335. @c man begin AUDIO SOURCES
  4336. Below is a description of the currently available audio sources.
  4337. @section abuffer
  4338. Buffer audio frames, and make them available to the filter chain.
  4339. This source is mainly intended for a programmatic use, in particular
  4340. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4341. It accepts the following parameters:
  4342. @table @option
  4343. @item time_base
  4344. The timebase which will be used for timestamps of submitted frames. It must be
  4345. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4346. @item sample_rate
  4347. The sample rate of the incoming audio buffers.
  4348. @item sample_fmt
  4349. The sample format of the incoming audio buffers.
  4350. Either a sample format name or its corresponding integer representation from
  4351. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4352. @item channel_layout
  4353. The channel layout of the incoming audio buffers.
  4354. Either a channel layout name from channel_layout_map in
  4355. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4356. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4357. @item channels
  4358. The number of channels of the incoming audio buffers.
  4359. If both @var{channels} and @var{channel_layout} are specified, then they
  4360. must be consistent.
  4361. @end table
  4362. @subsection Examples
  4363. @example
  4364. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4365. @end example
  4366. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4367. Since the sample format with name "s16p" corresponds to the number
  4368. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4369. equivalent to:
  4370. @example
  4371. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4372. @end example
  4373. @section aevalsrc
  4374. Generate an audio signal specified by an expression.
  4375. This source accepts in input one or more expressions (one for each
  4376. channel), which are evaluated and used to generate a corresponding
  4377. audio signal.
  4378. This source accepts the following options:
  4379. @table @option
  4380. @item exprs
  4381. Set the '|'-separated expressions list for each separate channel. In case the
  4382. @option{channel_layout} option is not specified, the selected channel layout
  4383. depends on the number of provided expressions. Otherwise the last
  4384. specified expression is applied to the remaining output channels.
  4385. @item channel_layout, c
  4386. Set the channel layout. The number of channels in the specified layout
  4387. must be equal to the number of specified expressions.
  4388. @item duration, d
  4389. Set the minimum duration of the sourced audio. See
  4390. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4391. for the accepted syntax.
  4392. Note that the resulting duration may be greater than the specified
  4393. duration, as the generated audio is always cut at the end of a
  4394. complete frame.
  4395. If not specified, or the expressed duration is negative, the audio is
  4396. supposed to be generated forever.
  4397. @item nb_samples, n
  4398. Set the number of samples per channel per each output frame,
  4399. default to 1024.
  4400. @item sample_rate, s
  4401. Specify the sample rate, default to 44100.
  4402. @end table
  4403. Each expression in @var{exprs} can contain the following constants:
  4404. @table @option
  4405. @item n
  4406. number of the evaluated sample, starting from 0
  4407. @item t
  4408. time of the evaluated sample expressed in seconds, starting from 0
  4409. @item s
  4410. sample rate
  4411. @end table
  4412. @subsection Examples
  4413. @itemize
  4414. @item
  4415. Generate silence:
  4416. @example
  4417. aevalsrc=0
  4418. @end example
  4419. @item
  4420. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4421. 8000 Hz:
  4422. @example
  4423. aevalsrc="sin(440*2*PI*t):s=8000"
  4424. @end example
  4425. @item
  4426. Generate a two channels signal, specify the channel layout (Front
  4427. Center + Back Center) explicitly:
  4428. @example
  4429. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4430. @end example
  4431. @item
  4432. Generate white noise:
  4433. @example
  4434. aevalsrc="-2+random(0)"
  4435. @end example
  4436. @item
  4437. Generate an amplitude modulated signal:
  4438. @example
  4439. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4440. @end example
  4441. @item
  4442. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4443. @example
  4444. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4445. @end example
  4446. @end itemize
  4447. @section anullsrc
  4448. The null audio source, return unprocessed audio frames. It is mainly useful
  4449. as a template and to be employed in analysis / debugging tools, or as
  4450. the source for filters which ignore the input data (for example the sox
  4451. synth filter).
  4452. This source accepts the following options:
  4453. @table @option
  4454. @item channel_layout, cl
  4455. Specifies the channel layout, and can be either an integer or a string
  4456. representing a channel layout. The default value of @var{channel_layout}
  4457. is "stereo".
  4458. Check the channel_layout_map definition in
  4459. @file{libavutil/channel_layout.c} for the mapping between strings and
  4460. channel layout values.
  4461. @item sample_rate, r
  4462. Specifies the sample rate, and defaults to 44100.
  4463. @item nb_samples, n
  4464. Set the number of samples per requested frames.
  4465. @end table
  4466. @subsection Examples
  4467. @itemize
  4468. @item
  4469. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4470. @example
  4471. anullsrc=r=48000:cl=4
  4472. @end example
  4473. @item
  4474. Do the same operation with a more obvious syntax:
  4475. @example
  4476. anullsrc=r=48000:cl=mono
  4477. @end example
  4478. @end itemize
  4479. All the parameters need to be explicitly defined.
  4480. @section flite
  4481. Synthesize a voice utterance using the libflite library.
  4482. To enable compilation of this filter you need to configure FFmpeg with
  4483. @code{--enable-libflite}.
  4484. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4485. The filter accepts the following options:
  4486. @table @option
  4487. @item list_voices
  4488. If set to 1, list the names of the available voices and exit
  4489. immediately. Default value is 0.
  4490. @item nb_samples, n
  4491. Set the maximum number of samples per frame. Default value is 512.
  4492. @item textfile
  4493. Set the filename containing the text to speak.
  4494. @item text
  4495. Set the text to speak.
  4496. @item voice, v
  4497. Set the voice to use for the speech synthesis. Default value is
  4498. @code{kal}. See also the @var{list_voices} option.
  4499. @end table
  4500. @subsection Examples
  4501. @itemize
  4502. @item
  4503. Read from file @file{speech.txt}, and synthesize the text using the
  4504. standard flite voice:
  4505. @example
  4506. flite=textfile=speech.txt
  4507. @end example
  4508. @item
  4509. Read the specified text selecting the @code{slt} voice:
  4510. @example
  4511. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4512. @end example
  4513. @item
  4514. Input text to ffmpeg:
  4515. @example
  4516. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4517. @end example
  4518. @item
  4519. Make @file{ffplay} speak the specified text, using @code{flite} and
  4520. the @code{lavfi} device:
  4521. @example
  4522. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4523. @end example
  4524. @end itemize
  4525. For more information about libflite, check:
  4526. @url{http://www.festvox.org/flite/}
  4527. @section anoisesrc
  4528. Generate a noise audio signal.
  4529. The filter accepts the following options:
  4530. @table @option
  4531. @item sample_rate, r
  4532. Specify the sample rate. Default value is 48000 Hz.
  4533. @item amplitude, a
  4534. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4535. is 1.0.
  4536. @item duration, d
  4537. Specify the duration of the generated audio stream. Not specifying this option
  4538. results in noise with an infinite length.
  4539. @item color, colour, c
  4540. Specify the color of noise. Available noise colors are white, pink, brown,
  4541. blue and violet. Default color is white.
  4542. @item seed, s
  4543. Specify a value used to seed the PRNG.
  4544. @item nb_samples, n
  4545. Set the number of samples per each output frame, default is 1024.
  4546. @end table
  4547. @subsection Examples
  4548. @itemize
  4549. @item
  4550. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4551. @example
  4552. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4553. @end example
  4554. @end itemize
  4555. @section hilbert
  4556. Generate odd-tap Hilbert transform FIR coefficients.
  4557. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4558. the signal by 90 degrees.
  4559. This is used in many matrix coding schemes and for analytic signal generation.
  4560. The process is often written as a multiplication by i (or j), the imaginary unit.
  4561. The filter accepts the following options:
  4562. @table @option
  4563. @item sample_rate, s
  4564. Set sample rate, default is 44100.
  4565. @item taps, t
  4566. Set length of FIR filter, default is 22051.
  4567. @item nb_samples, n
  4568. Set number of samples per each frame.
  4569. @item win_func, w
  4570. Set window function to be used when generating FIR coefficients.
  4571. @end table
  4572. @section sinc
  4573. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4574. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4575. The filter accepts the following options:
  4576. @table @option
  4577. @item sample_rate, r
  4578. Set sample rate, default is 44100.
  4579. @item nb_samples, n
  4580. Set number of samples per each frame. Default is 1024.
  4581. @item hp
  4582. Set high-pass frequency. Default is 0.
  4583. @item lp
  4584. Set low-pass frequency. Default is 0.
  4585. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4586. is higher than 0 then filter will create band-pass filter coefficients,
  4587. otherwise band-reject filter coefficients.
  4588. @item phase
  4589. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4590. @item beta
  4591. Set Kaiser window beta.
  4592. @item att
  4593. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4594. @item round
  4595. Enable rounding, by default is disabled.
  4596. @item hptaps
  4597. Set number of taps for high-pass filter.
  4598. @item lptaps
  4599. Set number of taps for low-pass filter.
  4600. @end table
  4601. @section sine
  4602. Generate an audio signal made of a sine wave with amplitude 1/8.
  4603. The audio signal is bit-exact.
  4604. The filter accepts the following options:
  4605. @table @option
  4606. @item frequency, f
  4607. Set the carrier frequency. Default is 440 Hz.
  4608. @item beep_factor, b
  4609. Enable a periodic beep every second with frequency @var{beep_factor} times
  4610. the carrier frequency. Default is 0, meaning the beep is disabled.
  4611. @item sample_rate, r
  4612. Specify the sample rate, default is 44100.
  4613. @item duration, d
  4614. Specify the duration of the generated audio stream.
  4615. @item samples_per_frame
  4616. Set the number of samples per output frame.
  4617. The expression can contain the following constants:
  4618. @table @option
  4619. @item n
  4620. The (sequential) number of the output audio frame, starting from 0.
  4621. @item pts
  4622. The PTS (Presentation TimeStamp) of the output audio frame,
  4623. expressed in @var{TB} units.
  4624. @item t
  4625. The PTS of the output audio frame, expressed in seconds.
  4626. @item TB
  4627. The timebase of the output audio frames.
  4628. @end table
  4629. Default is @code{1024}.
  4630. @end table
  4631. @subsection Examples
  4632. @itemize
  4633. @item
  4634. Generate a simple 440 Hz sine wave:
  4635. @example
  4636. sine
  4637. @end example
  4638. @item
  4639. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4640. @example
  4641. sine=220:4:d=5
  4642. sine=f=220:b=4:d=5
  4643. sine=frequency=220:beep_factor=4:duration=5
  4644. @end example
  4645. @item
  4646. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4647. pattern:
  4648. @example
  4649. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4650. @end example
  4651. @end itemize
  4652. @c man end AUDIO SOURCES
  4653. @chapter Audio Sinks
  4654. @c man begin AUDIO SINKS
  4655. Below is a description of the currently available audio sinks.
  4656. @section abuffersink
  4657. Buffer audio frames, and make them available to the end of filter chain.
  4658. This sink is mainly intended for programmatic use, in particular
  4659. through the interface defined in @file{libavfilter/buffersink.h}
  4660. or the options system.
  4661. It accepts a pointer to an AVABufferSinkContext structure, which
  4662. defines the incoming buffers' formats, to be passed as the opaque
  4663. parameter to @code{avfilter_init_filter} for initialization.
  4664. @section anullsink
  4665. Null audio sink; do absolutely nothing with the input audio. It is
  4666. mainly useful as a template and for use in analysis / debugging
  4667. tools.
  4668. @c man end AUDIO SINKS
  4669. @chapter Video Filters
  4670. @c man begin VIDEO FILTERS
  4671. When you configure your FFmpeg build, you can disable any of the
  4672. existing filters using @code{--disable-filters}.
  4673. The configure output will show the video filters included in your
  4674. build.
  4675. Below is a description of the currently available video filters.
  4676. @section addroi
  4677. Mark a region of interest in a video frame.
  4678. The frame data is passed through unchanged, but metadata is attached
  4679. to the frame indicating regions of interest which can affect the
  4680. behaviour of later encoding. Multiple regions can be marked by
  4681. applying the filter multiple times.
  4682. @table @option
  4683. @item x
  4684. Region distance in pixels from the left edge of the frame.
  4685. @item y
  4686. Region distance in pixels from the top edge of the frame.
  4687. @item w
  4688. Region width in pixels.
  4689. @item h
  4690. Region height in pixels.
  4691. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4692. and may contain the following variables:
  4693. @table @option
  4694. @item iw
  4695. Width of the input frame.
  4696. @item ih
  4697. Height of the input frame.
  4698. @end table
  4699. @item qoffset
  4700. Quantisation offset to apply within the region.
  4701. This must be a real value in the range -1 to +1. A value of zero
  4702. indicates no quality change. A negative value asks for better quality
  4703. (less quantisation), while a positive value asks for worse quality
  4704. (greater quantisation).
  4705. The range is calibrated so that the extreme values indicate the
  4706. largest possible offset - if the rest of the frame is encoded with the
  4707. worst possible quality, an offset of -1 indicates that this region
  4708. should be encoded with the best possible quality anyway. Intermediate
  4709. values are then interpolated in some codec-dependent way.
  4710. For example, in 10-bit H.264 the quantisation parameter varies between
  4711. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4712. this region should be encoded with a QP around one-tenth of the full
  4713. range better than the rest of the frame. So, if most of the frame
  4714. were to be encoded with a QP of around 30, this region would get a QP
  4715. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4716. An extreme value of -1 would indicate that this region should be
  4717. encoded with the best possible quality regardless of the treatment of
  4718. the rest of the frame - that is, should be encoded at a QP of -12.
  4719. @item clear
  4720. If set to true, remove any existing regions of interest marked on the
  4721. frame before adding the new one.
  4722. @end table
  4723. @subsection Examples
  4724. @itemize
  4725. @item
  4726. Mark the centre quarter of the frame as interesting.
  4727. @example
  4728. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4729. @end example
  4730. @item
  4731. Mark the 100-pixel-wide region on the left edge of the frame as very
  4732. uninteresting (to be encoded at much lower quality than the rest of
  4733. the frame).
  4734. @example
  4735. addroi=0:0:100:ih:+1/5
  4736. @end example
  4737. @end itemize
  4738. @section alphaextract
  4739. Extract the alpha component from the input as a grayscale video. This
  4740. is especially useful with the @var{alphamerge} filter.
  4741. @section alphamerge
  4742. Add or replace the alpha component of the primary input with the
  4743. grayscale value of a second input. This is intended for use with
  4744. @var{alphaextract} to allow the transmission or storage of frame
  4745. sequences that have alpha in a format that doesn't support an alpha
  4746. channel.
  4747. For example, to reconstruct full frames from a normal YUV-encoded video
  4748. and a separate video created with @var{alphaextract}, you might use:
  4749. @example
  4750. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4751. @end example
  4752. Since this filter is designed for reconstruction, it operates on frame
  4753. sequences without considering timestamps, and terminates when either
  4754. input reaches end of stream. This will cause problems if your encoding
  4755. pipeline drops frames. If you're trying to apply an image as an
  4756. overlay to a video stream, consider the @var{overlay} filter instead.
  4757. @section amplify
  4758. Amplify differences between current pixel and pixels of adjacent frames in
  4759. same pixel location.
  4760. This filter accepts the following options:
  4761. @table @option
  4762. @item radius
  4763. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4764. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4765. @item factor
  4766. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4767. @item threshold
  4768. Set threshold for difference amplification. Any difference greater or equal to
  4769. this value will not alter source pixel. Default is 10.
  4770. Allowed range is from 0 to 65535.
  4771. @item tolerance
  4772. Set tolerance for difference amplification. Any difference lower to
  4773. this value will not alter source pixel. Default is 0.
  4774. Allowed range is from 0 to 65535.
  4775. @item low
  4776. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4777. This option controls maximum possible value that will decrease source pixel value.
  4778. @item high
  4779. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4780. This option controls maximum possible value that will increase source pixel value.
  4781. @item planes
  4782. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4783. @end table
  4784. @subsection Commands
  4785. This filter supports the following @ref{commands} that corresponds to option of same name:
  4786. @table @option
  4787. @item factor
  4788. @item threshold
  4789. @item tolerance
  4790. @item low
  4791. @item high
  4792. @item planes
  4793. @end table
  4794. @section ass
  4795. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4796. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4797. Substation Alpha) subtitles files.
  4798. This filter accepts the following option in addition to the common options from
  4799. the @ref{subtitles} filter:
  4800. @table @option
  4801. @item shaping
  4802. Set the shaping engine
  4803. Available values are:
  4804. @table @samp
  4805. @item auto
  4806. The default libass shaping engine, which is the best available.
  4807. @item simple
  4808. Fast, font-agnostic shaper that can do only substitutions
  4809. @item complex
  4810. Slower shaper using OpenType for substitutions and positioning
  4811. @end table
  4812. The default is @code{auto}.
  4813. @end table
  4814. @section atadenoise
  4815. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4816. The filter accepts the following options:
  4817. @table @option
  4818. @item 0a
  4819. Set threshold A for 1st plane. Default is 0.02.
  4820. Valid range is 0 to 0.3.
  4821. @item 0b
  4822. Set threshold B for 1st plane. Default is 0.04.
  4823. Valid range is 0 to 5.
  4824. @item 1a
  4825. Set threshold A for 2nd plane. Default is 0.02.
  4826. Valid range is 0 to 0.3.
  4827. @item 1b
  4828. Set threshold B for 2nd plane. Default is 0.04.
  4829. Valid range is 0 to 5.
  4830. @item 2a
  4831. Set threshold A for 3rd plane. Default is 0.02.
  4832. Valid range is 0 to 0.3.
  4833. @item 2b
  4834. Set threshold B for 3rd plane. Default is 0.04.
  4835. Valid range is 0 to 5.
  4836. Threshold A is designed to react on abrupt changes in the input signal and
  4837. threshold B is designed to react on continuous changes in the input signal.
  4838. @item s
  4839. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4840. number in range [5, 129].
  4841. @item p
  4842. Set what planes of frame filter will use for averaging. Default is all.
  4843. @item a
  4844. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  4845. Alternatively can be set to @code{s} serial.
  4846. Parallel can be faster then serial, while other way around is never true.
  4847. Parallel will abort early on first change being greater then thresholds, while serial
  4848. will continue processing other side of frames if they are equal or bellow thresholds.
  4849. @end table
  4850. @subsection Commands
  4851. This filter supports same @ref{commands} as options except option @code{s}.
  4852. The command accepts the same syntax of the corresponding option.
  4853. @section avgblur
  4854. Apply average blur filter.
  4855. The filter accepts the following options:
  4856. @table @option
  4857. @item sizeX
  4858. Set horizontal radius size.
  4859. @item planes
  4860. Set which planes to filter. By default all planes are filtered.
  4861. @item sizeY
  4862. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4863. Default is @code{0}.
  4864. @end table
  4865. @subsection Commands
  4866. This filter supports same commands as options.
  4867. The command accepts the same syntax of the corresponding option.
  4868. If the specified expression is not valid, it is kept at its current
  4869. value.
  4870. @section bbox
  4871. Compute the bounding box for the non-black pixels in the input frame
  4872. luminance plane.
  4873. This filter computes the bounding box containing all the pixels with a
  4874. luminance value greater than the minimum allowed value.
  4875. The parameters describing the bounding box are printed on the filter
  4876. log.
  4877. The filter accepts the following option:
  4878. @table @option
  4879. @item min_val
  4880. Set the minimal luminance value. Default is @code{16}.
  4881. @end table
  4882. @section bitplanenoise
  4883. Show and measure bit plane noise.
  4884. The filter accepts the following options:
  4885. @table @option
  4886. @item bitplane
  4887. Set which plane to analyze. Default is @code{1}.
  4888. @item filter
  4889. Filter out noisy pixels from @code{bitplane} set above.
  4890. Default is disabled.
  4891. @end table
  4892. @section blackdetect
  4893. Detect video intervals that are (almost) completely black. Can be
  4894. useful to detect chapter transitions, commercials, or invalid
  4895. recordings. Output lines contains the time for the start, end and
  4896. duration of the detected black interval expressed in seconds.
  4897. In order to display the output lines, you need to set the loglevel at
  4898. least to the AV_LOG_INFO value.
  4899. The filter accepts the following options:
  4900. @table @option
  4901. @item black_min_duration, d
  4902. Set the minimum detected black duration expressed in seconds. It must
  4903. be a non-negative floating point number.
  4904. Default value is 2.0.
  4905. @item picture_black_ratio_th, pic_th
  4906. Set the threshold for considering a picture "black".
  4907. Express the minimum value for the ratio:
  4908. @example
  4909. @var{nb_black_pixels} / @var{nb_pixels}
  4910. @end example
  4911. for which a picture is considered black.
  4912. Default value is 0.98.
  4913. @item pixel_black_th, pix_th
  4914. Set the threshold for considering a pixel "black".
  4915. The threshold expresses the maximum pixel luminance value for which a
  4916. pixel is considered "black". The provided value is scaled according to
  4917. the following equation:
  4918. @example
  4919. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4920. @end example
  4921. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4922. the input video format, the range is [0-255] for YUV full-range
  4923. formats and [16-235] for YUV non full-range formats.
  4924. Default value is 0.10.
  4925. @end table
  4926. The following example sets the maximum pixel threshold to the minimum
  4927. value, and detects only black intervals of 2 or more seconds:
  4928. @example
  4929. blackdetect=d=2:pix_th=0.00
  4930. @end example
  4931. @section blackframe
  4932. Detect frames that are (almost) completely black. Can be useful to
  4933. detect chapter transitions or commercials. Output lines consist of
  4934. the frame number of the detected frame, the percentage of blackness,
  4935. the position in the file if known or -1 and the timestamp in seconds.
  4936. In order to display the output lines, you need to set the loglevel at
  4937. least to the AV_LOG_INFO value.
  4938. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4939. The value represents the percentage of pixels in the picture that
  4940. are below the threshold value.
  4941. It accepts the following parameters:
  4942. @table @option
  4943. @item amount
  4944. The percentage of the pixels that have to be below the threshold; it defaults to
  4945. @code{98}.
  4946. @item threshold, thresh
  4947. The threshold below which a pixel value is considered black; it defaults to
  4948. @code{32}.
  4949. @end table
  4950. @section blend, tblend
  4951. Blend two video frames into each other.
  4952. The @code{blend} filter takes two input streams and outputs one
  4953. stream, the first input is the "top" layer and second input is
  4954. "bottom" layer. By default, the output terminates when the longest input terminates.
  4955. The @code{tblend} (time blend) filter takes two consecutive frames
  4956. from one single stream, and outputs the result obtained by blending
  4957. the new frame on top of the old frame.
  4958. A description of the accepted options follows.
  4959. @table @option
  4960. @item c0_mode
  4961. @item c1_mode
  4962. @item c2_mode
  4963. @item c3_mode
  4964. @item all_mode
  4965. Set blend mode for specific pixel component or all pixel components in case
  4966. of @var{all_mode}. Default value is @code{normal}.
  4967. Available values for component modes are:
  4968. @table @samp
  4969. @item addition
  4970. @item grainmerge
  4971. @item and
  4972. @item average
  4973. @item burn
  4974. @item darken
  4975. @item difference
  4976. @item grainextract
  4977. @item divide
  4978. @item dodge
  4979. @item freeze
  4980. @item exclusion
  4981. @item extremity
  4982. @item glow
  4983. @item hardlight
  4984. @item hardmix
  4985. @item heat
  4986. @item lighten
  4987. @item linearlight
  4988. @item multiply
  4989. @item multiply128
  4990. @item negation
  4991. @item normal
  4992. @item or
  4993. @item overlay
  4994. @item phoenix
  4995. @item pinlight
  4996. @item reflect
  4997. @item screen
  4998. @item softlight
  4999. @item subtract
  5000. @item vividlight
  5001. @item xor
  5002. @end table
  5003. @item c0_opacity
  5004. @item c1_opacity
  5005. @item c2_opacity
  5006. @item c3_opacity
  5007. @item all_opacity
  5008. Set blend opacity for specific pixel component or all pixel components in case
  5009. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5010. @item c0_expr
  5011. @item c1_expr
  5012. @item c2_expr
  5013. @item c3_expr
  5014. @item all_expr
  5015. Set blend expression for specific pixel component or all pixel components in case
  5016. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5017. The expressions can use the following variables:
  5018. @table @option
  5019. @item N
  5020. The sequential number of the filtered frame, starting from @code{0}.
  5021. @item X
  5022. @item Y
  5023. the coordinates of the current sample
  5024. @item W
  5025. @item H
  5026. the width and height of currently filtered plane
  5027. @item SW
  5028. @item SH
  5029. Width and height scale for the plane being filtered. It is the
  5030. ratio between the dimensions of the current plane to the luma plane,
  5031. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5032. the luma plane and @code{0.5,0.5} for the chroma planes.
  5033. @item T
  5034. Time of the current frame, expressed in seconds.
  5035. @item TOP, A
  5036. Value of pixel component at current location for first video frame (top layer).
  5037. @item BOTTOM, B
  5038. Value of pixel component at current location for second video frame (bottom layer).
  5039. @end table
  5040. @end table
  5041. The @code{blend} filter also supports the @ref{framesync} options.
  5042. @subsection Examples
  5043. @itemize
  5044. @item
  5045. Apply transition from bottom layer to top layer in first 10 seconds:
  5046. @example
  5047. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5048. @end example
  5049. @item
  5050. Apply linear horizontal transition from top layer to bottom layer:
  5051. @example
  5052. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5053. @end example
  5054. @item
  5055. Apply 1x1 checkerboard effect:
  5056. @example
  5057. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5058. @end example
  5059. @item
  5060. Apply uncover left effect:
  5061. @example
  5062. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5063. @end example
  5064. @item
  5065. Apply uncover down effect:
  5066. @example
  5067. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5068. @end example
  5069. @item
  5070. Apply uncover up-left effect:
  5071. @example
  5072. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5073. @end example
  5074. @item
  5075. Split diagonally video and shows top and bottom layer on each side:
  5076. @example
  5077. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5078. @end example
  5079. @item
  5080. Display differences between the current and the previous frame:
  5081. @example
  5082. tblend=all_mode=grainextract
  5083. @end example
  5084. @end itemize
  5085. @section bm3d
  5086. Denoise frames using Block-Matching 3D algorithm.
  5087. The filter accepts the following options.
  5088. @table @option
  5089. @item sigma
  5090. Set denoising strength. Default value is 1.
  5091. Allowed range is from 0 to 999.9.
  5092. The denoising algorithm is very sensitive to sigma, so adjust it
  5093. according to the source.
  5094. @item block
  5095. Set local patch size. This sets dimensions in 2D.
  5096. @item bstep
  5097. Set sliding step for processing blocks. Default value is 4.
  5098. Allowed range is from 1 to 64.
  5099. Smaller values allows processing more reference blocks and is slower.
  5100. @item group
  5101. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5102. When set to 1, no block matching is done. Larger values allows more blocks
  5103. in single group.
  5104. Allowed range is from 1 to 256.
  5105. @item range
  5106. Set radius for search block matching. Default is 9.
  5107. Allowed range is from 1 to INT32_MAX.
  5108. @item mstep
  5109. Set step between two search locations for block matching. Default is 1.
  5110. Allowed range is from 1 to 64. Smaller is slower.
  5111. @item thmse
  5112. Set threshold of mean square error for block matching. Valid range is 0 to
  5113. INT32_MAX.
  5114. @item hdthr
  5115. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5116. Larger values results in stronger hard-thresholding filtering in frequency
  5117. domain.
  5118. @item estim
  5119. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5120. Default is @code{basic}.
  5121. @item ref
  5122. If enabled, filter will use 2nd stream for block matching.
  5123. Default is disabled for @code{basic} value of @var{estim} option,
  5124. and always enabled if value of @var{estim} is @code{final}.
  5125. @item planes
  5126. Set planes to filter. Default is all available except alpha.
  5127. @end table
  5128. @subsection Examples
  5129. @itemize
  5130. @item
  5131. Basic filtering with bm3d:
  5132. @example
  5133. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5134. @end example
  5135. @item
  5136. Same as above, but filtering only luma:
  5137. @example
  5138. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5139. @end example
  5140. @item
  5141. Same as above, but with both estimation modes:
  5142. @example
  5143. 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
  5144. @end example
  5145. @item
  5146. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5147. @example
  5148. 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
  5149. @end example
  5150. @end itemize
  5151. @section boxblur
  5152. Apply a boxblur algorithm to the input video.
  5153. It accepts the following parameters:
  5154. @table @option
  5155. @item luma_radius, lr
  5156. @item luma_power, lp
  5157. @item chroma_radius, cr
  5158. @item chroma_power, cp
  5159. @item alpha_radius, ar
  5160. @item alpha_power, ap
  5161. @end table
  5162. A description of the accepted options follows.
  5163. @table @option
  5164. @item luma_radius, lr
  5165. @item chroma_radius, cr
  5166. @item alpha_radius, ar
  5167. Set an expression for the box radius in pixels used for blurring the
  5168. corresponding input plane.
  5169. The radius value must be a non-negative number, and must not be
  5170. greater than the value of the expression @code{min(w,h)/2} for the
  5171. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5172. planes.
  5173. Default value for @option{luma_radius} is "2". If not specified,
  5174. @option{chroma_radius} and @option{alpha_radius} default to the
  5175. corresponding value set for @option{luma_radius}.
  5176. The expressions can contain the following constants:
  5177. @table @option
  5178. @item w
  5179. @item h
  5180. The input width and height in pixels.
  5181. @item cw
  5182. @item ch
  5183. The input chroma image width and height in pixels.
  5184. @item hsub
  5185. @item vsub
  5186. The horizontal and vertical chroma subsample values. For example, for the
  5187. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5188. @end table
  5189. @item luma_power, lp
  5190. @item chroma_power, cp
  5191. @item alpha_power, ap
  5192. Specify how many times the boxblur filter is applied to the
  5193. corresponding plane.
  5194. Default value for @option{luma_power} is 2. If not specified,
  5195. @option{chroma_power} and @option{alpha_power} default to the
  5196. corresponding value set for @option{luma_power}.
  5197. A value of 0 will disable the effect.
  5198. @end table
  5199. @subsection Examples
  5200. @itemize
  5201. @item
  5202. Apply a boxblur filter with the luma, chroma, and alpha radii
  5203. set to 2:
  5204. @example
  5205. boxblur=luma_radius=2:luma_power=1
  5206. boxblur=2:1
  5207. @end example
  5208. @item
  5209. Set the luma radius to 2, and alpha and chroma radius to 0:
  5210. @example
  5211. boxblur=2:1:cr=0:ar=0
  5212. @end example
  5213. @item
  5214. Set the luma and chroma radii to a fraction of the video dimension:
  5215. @example
  5216. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5217. @end example
  5218. @end itemize
  5219. @section bwdif
  5220. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5221. Deinterlacing Filter").
  5222. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5223. interpolation algorithms.
  5224. It accepts the following parameters:
  5225. @table @option
  5226. @item mode
  5227. The interlacing mode to adopt. It accepts one of the following values:
  5228. @table @option
  5229. @item 0, send_frame
  5230. Output one frame for each frame.
  5231. @item 1, send_field
  5232. Output one frame for each field.
  5233. @end table
  5234. The default value is @code{send_field}.
  5235. @item parity
  5236. The picture field parity assumed for the input interlaced video. It accepts one
  5237. of the following values:
  5238. @table @option
  5239. @item 0, tff
  5240. Assume the top field is first.
  5241. @item 1, bff
  5242. Assume the bottom field is first.
  5243. @item -1, auto
  5244. Enable automatic detection of field parity.
  5245. @end table
  5246. The default value is @code{auto}.
  5247. If the interlacing is unknown or the decoder does not export this information,
  5248. top field first will be assumed.
  5249. @item deint
  5250. Specify which frames to deinterlace. Accepts one of the following
  5251. values:
  5252. @table @option
  5253. @item 0, all
  5254. Deinterlace all frames.
  5255. @item 1, interlaced
  5256. Only deinterlace frames marked as interlaced.
  5257. @end table
  5258. The default value is @code{all}.
  5259. @end table
  5260. @section chromahold
  5261. Remove all color information for all colors except for certain one.
  5262. The filter accepts the following options:
  5263. @table @option
  5264. @item color
  5265. The color which will not be replaced with neutral chroma.
  5266. @item similarity
  5267. Similarity percentage with the above color.
  5268. 0.01 matches only the exact key color, while 1.0 matches everything.
  5269. @item blend
  5270. Blend percentage.
  5271. 0.0 makes pixels either fully gray, or not gray at all.
  5272. Higher values result in more preserved color.
  5273. @item yuv
  5274. Signals that the color passed is already in YUV instead of RGB.
  5275. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5276. This can be used to pass exact YUV values as hexadecimal numbers.
  5277. @end table
  5278. @section chromakey
  5279. YUV colorspace color/chroma keying.
  5280. The filter accepts the following options:
  5281. @table @option
  5282. @item color
  5283. The color which will be replaced with transparency.
  5284. @item similarity
  5285. Similarity percentage with the key color.
  5286. 0.01 matches only the exact key color, while 1.0 matches everything.
  5287. @item blend
  5288. Blend percentage.
  5289. 0.0 makes pixels either fully transparent, or not transparent at all.
  5290. Higher values result in semi-transparent pixels, with a higher transparency
  5291. the more similar the pixels color is to the key color.
  5292. @item yuv
  5293. Signals that the color passed is already in YUV instead of RGB.
  5294. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5295. This can be used to pass exact YUV values as hexadecimal numbers.
  5296. @end table
  5297. @subsection Examples
  5298. @itemize
  5299. @item
  5300. Make every green pixel in the input image transparent:
  5301. @example
  5302. ffmpeg -i input.png -vf chromakey=green out.png
  5303. @end example
  5304. @item
  5305. Overlay a greenscreen-video on top of a static black background.
  5306. @example
  5307. 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
  5308. @end example
  5309. @end itemize
  5310. @section chromashift
  5311. Shift chroma pixels horizontally and/or vertically.
  5312. The filter accepts the following options:
  5313. @table @option
  5314. @item cbh
  5315. Set amount to shift chroma-blue horizontally.
  5316. @item cbv
  5317. Set amount to shift chroma-blue vertically.
  5318. @item crh
  5319. Set amount to shift chroma-red horizontally.
  5320. @item crv
  5321. Set amount to shift chroma-red vertically.
  5322. @item edge
  5323. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5324. @end table
  5325. @section ciescope
  5326. Display CIE color diagram with pixels overlaid onto it.
  5327. The filter accepts the following options:
  5328. @table @option
  5329. @item system
  5330. Set color system.
  5331. @table @samp
  5332. @item ntsc, 470m
  5333. @item ebu, 470bg
  5334. @item smpte
  5335. @item 240m
  5336. @item apple
  5337. @item widergb
  5338. @item cie1931
  5339. @item rec709, hdtv
  5340. @item uhdtv, rec2020
  5341. @item dcip3
  5342. @end table
  5343. @item cie
  5344. Set CIE system.
  5345. @table @samp
  5346. @item xyy
  5347. @item ucs
  5348. @item luv
  5349. @end table
  5350. @item gamuts
  5351. Set what gamuts to draw.
  5352. See @code{system} option for available values.
  5353. @item size, s
  5354. Set ciescope size, by default set to 512.
  5355. @item intensity, i
  5356. Set intensity used to map input pixel values to CIE diagram.
  5357. @item contrast
  5358. Set contrast used to draw tongue colors that are out of active color system gamut.
  5359. @item corrgamma
  5360. Correct gamma displayed on scope, by default enabled.
  5361. @item showwhite
  5362. Show white point on CIE diagram, by default disabled.
  5363. @item gamma
  5364. Set input gamma. Used only with XYZ input color space.
  5365. @end table
  5366. @section codecview
  5367. Visualize information exported by some codecs.
  5368. Some codecs can export information through frames using side-data or other
  5369. means. For example, some MPEG based codecs export motion vectors through the
  5370. @var{export_mvs} flag in the codec @option{flags2} option.
  5371. The filter accepts the following option:
  5372. @table @option
  5373. @item mv
  5374. Set motion vectors to visualize.
  5375. Available flags for @var{mv} are:
  5376. @table @samp
  5377. @item pf
  5378. forward predicted MVs of P-frames
  5379. @item bf
  5380. forward predicted MVs of B-frames
  5381. @item bb
  5382. backward predicted MVs of B-frames
  5383. @end table
  5384. @item qp
  5385. Display quantization parameters using the chroma planes.
  5386. @item mv_type, mvt
  5387. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5388. Available flags for @var{mv_type} are:
  5389. @table @samp
  5390. @item fp
  5391. forward predicted MVs
  5392. @item bp
  5393. backward predicted MVs
  5394. @end table
  5395. @item frame_type, ft
  5396. Set frame type to visualize motion vectors of.
  5397. Available flags for @var{frame_type} are:
  5398. @table @samp
  5399. @item if
  5400. intra-coded frames (I-frames)
  5401. @item pf
  5402. predicted frames (P-frames)
  5403. @item bf
  5404. bi-directionally predicted frames (B-frames)
  5405. @end table
  5406. @end table
  5407. @subsection Examples
  5408. @itemize
  5409. @item
  5410. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5411. @example
  5412. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5413. @end example
  5414. @item
  5415. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5416. @example
  5417. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5418. @end example
  5419. @end itemize
  5420. @section colorbalance
  5421. Modify intensity of primary colors (red, green and blue) of input frames.
  5422. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5423. regions for the red-cyan, green-magenta or blue-yellow balance.
  5424. A positive adjustment value shifts the balance towards the primary color, a negative
  5425. value towards the complementary color.
  5426. The filter accepts the following options:
  5427. @table @option
  5428. @item rs
  5429. @item gs
  5430. @item bs
  5431. Adjust red, green and blue shadows (darkest pixels).
  5432. @item rm
  5433. @item gm
  5434. @item bm
  5435. Adjust red, green and blue midtones (medium pixels).
  5436. @item rh
  5437. @item gh
  5438. @item bh
  5439. Adjust red, green and blue highlights (brightest pixels).
  5440. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5441. @end table
  5442. @subsection Examples
  5443. @itemize
  5444. @item
  5445. Add red color cast to shadows:
  5446. @example
  5447. colorbalance=rs=.3
  5448. @end example
  5449. @end itemize
  5450. @section colorchannelmixer
  5451. Adjust video input frames by re-mixing color channels.
  5452. This filter modifies a color channel by adding the values associated to
  5453. the other channels of the same pixels. For example if the value to
  5454. modify is red, the output value will be:
  5455. @example
  5456. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5457. @end example
  5458. The filter accepts the following options:
  5459. @table @option
  5460. @item rr
  5461. @item rg
  5462. @item rb
  5463. @item ra
  5464. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5465. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5466. @item gr
  5467. @item gg
  5468. @item gb
  5469. @item ga
  5470. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5471. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5472. @item br
  5473. @item bg
  5474. @item bb
  5475. @item ba
  5476. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5477. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5478. @item ar
  5479. @item ag
  5480. @item ab
  5481. @item aa
  5482. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5483. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5484. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5485. @end table
  5486. @subsection Examples
  5487. @itemize
  5488. @item
  5489. Convert source to grayscale:
  5490. @example
  5491. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5492. @end example
  5493. @item
  5494. Simulate sepia tones:
  5495. @example
  5496. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5497. @end example
  5498. @end itemize
  5499. @subsection Commands
  5500. This filter supports the all above options as @ref{commands}.
  5501. @section colorkey
  5502. RGB colorspace color keying.
  5503. The filter accepts the following options:
  5504. @table @option
  5505. @item color
  5506. The color which will be replaced with transparency.
  5507. @item similarity
  5508. Similarity percentage with the key color.
  5509. 0.01 matches only the exact key color, while 1.0 matches everything.
  5510. @item blend
  5511. Blend percentage.
  5512. 0.0 makes pixels either fully transparent, or not transparent at all.
  5513. Higher values result in semi-transparent pixels, with a higher transparency
  5514. the more similar the pixels color is to the key color.
  5515. @end table
  5516. @subsection Examples
  5517. @itemize
  5518. @item
  5519. Make every green pixel in the input image transparent:
  5520. @example
  5521. ffmpeg -i input.png -vf colorkey=green out.png
  5522. @end example
  5523. @item
  5524. Overlay a greenscreen-video on top of a static background image.
  5525. @example
  5526. 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
  5527. @end example
  5528. @end itemize
  5529. @section colorhold
  5530. Remove all color information for all RGB colors except for certain one.
  5531. The filter accepts the following options:
  5532. @table @option
  5533. @item color
  5534. The color which will not be replaced with neutral gray.
  5535. @item similarity
  5536. Similarity percentage with the above color.
  5537. 0.01 matches only the exact key color, while 1.0 matches everything.
  5538. @item blend
  5539. Blend percentage. 0.0 makes pixels fully gray.
  5540. Higher values result in more preserved color.
  5541. @end table
  5542. @section colorlevels
  5543. Adjust video input frames using levels.
  5544. The filter accepts the following options:
  5545. @table @option
  5546. @item rimin
  5547. @item gimin
  5548. @item bimin
  5549. @item aimin
  5550. Adjust red, green, blue and alpha input black point.
  5551. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5552. @item rimax
  5553. @item gimax
  5554. @item bimax
  5555. @item aimax
  5556. Adjust red, green, blue and alpha input white point.
  5557. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5558. Input levels are used to lighten highlights (bright tones), darken shadows
  5559. (dark tones), change the balance of bright and dark tones.
  5560. @item romin
  5561. @item gomin
  5562. @item bomin
  5563. @item aomin
  5564. Adjust red, green, blue and alpha output black point.
  5565. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5566. @item romax
  5567. @item gomax
  5568. @item bomax
  5569. @item aomax
  5570. Adjust red, green, blue and alpha output white point.
  5571. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5572. Output levels allows manual selection of a constrained output level range.
  5573. @end table
  5574. @subsection Examples
  5575. @itemize
  5576. @item
  5577. Make video output darker:
  5578. @example
  5579. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5580. @end example
  5581. @item
  5582. Increase contrast:
  5583. @example
  5584. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5585. @end example
  5586. @item
  5587. Make video output lighter:
  5588. @example
  5589. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5590. @end example
  5591. @item
  5592. Increase brightness:
  5593. @example
  5594. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5595. @end example
  5596. @end itemize
  5597. @section colormatrix
  5598. Convert color matrix.
  5599. The filter accepts the following options:
  5600. @table @option
  5601. @item src
  5602. @item dst
  5603. Specify the source and destination color matrix. Both values must be
  5604. specified.
  5605. The accepted values are:
  5606. @table @samp
  5607. @item bt709
  5608. BT.709
  5609. @item fcc
  5610. FCC
  5611. @item bt601
  5612. BT.601
  5613. @item bt470
  5614. BT.470
  5615. @item bt470bg
  5616. BT.470BG
  5617. @item smpte170m
  5618. SMPTE-170M
  5619. @item smpte240m
  5620. SMPTE-240M
  5621. @item bt2020
  5622. BT.2020
  5623. @end table
  5624. @end table
  5625. For example to convert from BT.601 to SMPTE-240M, use the command:
  5626. @example
  5627. colormatrix=bt601:smpte240m
  5628. @end example
  5629. @section colorspace
  5630. Convert colorspace, transfer characteristics or color primaries.
  5631. Input video needs to have an even size.
  5632. The filter accepts the following options:
  5633. @table @option
  5634. @anchor{all}
  5635. @item all
  5636. Specify all color properties at once.
  5637. The accepted values are:
  5638. @table @samp
  5639. @item bt470m
  5640. BT.470M
  5641. @item bt470bg
  5642. BT.470BG
  5643. @item bt601-6-525
  5644. BT.601-6 525
  5645. @item bt601-6-625
  5646. BT.601-6 625
  5647. @item bt709
  5648. BT.709
  5649. @item smpte170m
  5650. SMPTE-170M
  5651. @item smpte240m
  5652. SMPTE-240M
  5653. @item bt2020
  5654. BT.2020
  5655. @end table
  5656. @anchor{space}
  5657. @item space
  5658. Specify output colorspace.
  5659. The accepted values are:
  5660. @table @samp
  5661. @item bt709
  5662. BT.709
  5663. @item fcc
  5664. FCC
  5665. @item bt470bg
  5666. BT.470BG or BT.601-6 625
  5667. @item smpte170m
  5668. SMPTE-170M or BT.601-6 525
  5669. @item smpte240m
  5670. SMPTE-240M
  5671. @item ycgco
  5672. YCgCo
  5673. @item bt2020ncl
  5674. BT.2020 with non-constant luminance
  5675. @end table
  5676. @anchor{trc}
  5677. @item trc
  5678. Specify output transfer characteristics.
  5679. The accepted values are:
  5680. @table @samp
  5681. @item bt709
  5682. BT.709
  5683. @item bt470m
  5684. BT.470M
  5685. @item bt470bg
  5686. BT.470BG
  5687. @item gamma22
  5688. Constant gamma of 2.2
  5689. @item gamma28
  5690. Constant gamma of 2.8
  5691. @item smpte170m
  5692. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5693. @item smpte240m
  5694. SMPTE-240M
  5695. @item srgb
  5696. SRGB
  5697. @item iec61966-2-1
  5698. iec61966-2-1
  5699. @item iec61966-2-4
  5700. iec61966-2-4
  5701. @item xvycc
  5702. xvycc
  5703. @item bt2020-10
  5704. BT.2020 for 10-bits content
  5705. @item bt2020-12
  5706. BT.2020 for 12-bits content
  5707. @end table
  5708. @anchor{primaries}
  5709. @item primaries
  5710. Specify output color primaries.
  5711. The accepted values are:
  5712. @table @samp
  5713. @item bt709
  5714. BT.709
  5715. @item bt470m
  5716. BT.470M
  5717. @item bt470bg
  5718. BT.470BG or BT.601-6 625
  5719. @item smpte170m
  5720. SMPTE-170M or BT.601-6 525
  5721. @item smpte240m
  5722. SMPTE-240M
  5723. @item film
  5724. film
  5725. @item smpte431
  5726. SMPTE-431
  5727. @item smpte432
  5728. SMPTE-432
  5729. @item bt2020
  5730. BT.2020
  5731. @item jedec-p22
  5732. JEDEC P22 phosphors
  5733. @end table
  5734. @anchor{range}
  5735. @item range
  5736. Specify output color range.
  5737. The accepted values are:
  5738. @table @samp
  5739. @item tv
  5740. TV (restricted) range
  5741. @item mpeg
  5742. MPEG (restricted) range
  5743. @item pc
  5744. PC (full) range
  5745. @item jpeg
  5746. JPEG (full) range
  5747. @end table
  5748. @item format
  5749. Specify output color format.
  5750. The accepted values are:
  5751. @table @samp
  5752. @item yuv420p
  5753. YUV 4:2:0 planar 8-bits
  5754. @item yuv420p10
  5755. YUV 4:2:0 planar 10-bits
  5756. @item yuv420p12
  5757. YUV 4:2:0 planar 12-bits
  5758. @item yuv422p
  5759. YUV 4:2:2 planar 8-bits
  5760. @item yuv422p10
  5761. YUV 4:2:2 planar 10-bits
  5762. @item yuv422p12
  5763. YUV 4:2:2 planar 12-bits
  5764. @item yuv444p
  5765. YUV 4:4:4 planar 8-bits
  5766. @item yuv444p10
  5767. YUV 4:4:4 planar 10-bits
  5768. @item yuv444p12
  5769. YUV 4:4:4 planar 12-bits
  5770. @end table
  5771. @item fast
  5772. Do a fast conversion, which skips gamma/primary correction. This will take
  5773. significantly less CPU, but will be mathematically incorrect. To get output
  5774. compatible with that produced by the colormatrix filter, use fast=1.
  5775. @item dither
  5776. Specify dithering mode.
  5777. The accepted values are:
  5778. @table @samp
  5779. @item none
  5780. No dithering
  5781. @item fsb
  5782. Floyd-Steinberg dithering
  5783. @end table
  5784. @item wpadapt
  5785. Whitepoint adaptation mode.
  5786. The accepted values are:
  5787. @table @samp
  5788. @item bradford
  5789. Bradford whitepoint adaptation
  5790. @item vonkries
  5791. von Kries whitepoint adaptation
  5792. @item identity
  5793. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5794. @end table
  5795. @item iall
  5796. Override all input properties at once. Same accepted values as @ref{all}.
  5797. @item ispace
  5798. Override input colorspace. Same accepted values as @ref{space}.
  5799. @item iprimaries
  5800. Override input color primaries. Same accepted values as @ref{primaries}.
  5801. @item itrc
  5802. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5803. @item irange
  5804. Override input color range. Same accepted values as @ref{range}.
  5805. @end table
  5806. The filter converts the transfer characteristics, color space and color
  5807. primaries to the specified user values. The output value, if not specified,
  5808. is set to a default value based on the "all" property. If that property is
  5809. also not specified, the filter will log an error. The output color range and
  5810. format default to the same value as the input color range and format. The
  5811. input transfer characteristics, color space, color primaries and color range
  5812. should be set on the input data. If any of these are missing, the filter will
  5813. log an error and no conversion will take place.
  5814. For example to convert the input to SMPTE-240M, use the command:
  5815. @example
  5816. colorspace=smpte240m
  5817. @end example
  5818. @section convolution
  5819. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5820. The filter accepts the following options:
  5821. @table @option
  5822. @item 0m
  5823. @item 1m
  5824. @item 2m
  5825. @item 3m
  5826. Set matrix for each plane.
  5827. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5828. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5829. @item 0rdiv
  5830. @item 1rdiv
  5831. @item 2rdiv
  5832. @item 3rdiv
  5833. Set multiplier for calculated value for each plane.
  5834. If unset or 0, it will be sum of all matrix elements.
  5835. @item 0bias
  5836. @item 1bias
  5837. @item 2bias
  5838. @item 3bias
  5839. Set bias for each plane. This value is added to the result of the multiplication.
  5840. Useful for making the overall image brighter or darker. Default is 0.0.
  5841. @item 0mode
  5842. @item 1mode
  5843. @item 2mode
  5844. @item 3mode
  5845. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5846. Default is @var{square}.
  5847. @end table
  5848. @subsection Examples
  5849. @itemize
  5850. @item
  5851. Apply sharpen:
  5852. @example
  5853. 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"
  5854. @end example
  5855. @item
  5856. Apply blur:
  5857. @example
  5858. 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"
  5859. @end example
  5860. @item
  5861. Apply edge enhance:
  5862. @example
  5863. 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"
  5864. @end example
  5865. @item
  5866. Apply edge detect:
  5867. @example
  5868. 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"
  5869. @end example
  5870. @item
  5871. Apply laplacian edge detector which includes diagonals:
  5872. @example
  5873. 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"
  5874. @end example
  5875. @item
  5876. Apply emboss:
  5877. @example
  5878. 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"
  5879. @end example
  5880. @end itemize
  5881. @section convolve
  5882. Apply 2D convolution of video stream in frequency domain using second stream
  5883. as impulse.
  5884. The filter accepts the following options:
  5885. @table @option
  5886. @item planes
  5887. Set which planes to process.
  5888. @item impulse
  5889. Set which impulse video frames will be processed, can be @var{first}
  5890. or @var{all}. Default is @var{all}.
  5891. @end table
  5892. The @code{convolve} filter also supports the @ref{framesync} options.
  5893. @section copy
  5894. Copy the input video source unchanged to the output. This is mainly useful for
  5895. testing purposes.
  5896. @anchor{coreimage}
  5897. @section coreimage
  5898. Video filtering on GPU using Apple's CoreImage API on OSX.
  5899. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5900. processed by video hardware. However, software-based OpenGL implementations
  5901. exist which means there is no guarantee for hardware processing. It depends on
  5902. the respective OSX.
  5903. There are many filters and image generators provided by Apple that come with a
  5904. large variety of options. The filter has to be referenced by its name along
  5905. with its options.
  5906. The coreimage filter accepts the following options:
  5907. @table @option
  5908. @item list_filters
  5909. List all available filters and generators along with all their respective
  5910. options as well as possible minimum and maximum values along with the default
  5911. values.
  5912. @example
  5913. list_filters=true
  5914. @end example
  5915. @item filter
  5916. Specify all filters by their respective name and options.
  5917. Use @var{list_filters} to determine all valid filter names and options.
  5918. Numerical options are specified by a float value and are automatically clamped
  5919. to their respective value range. Vector and color options have to be specified
  5920. by a list of space separated float values. Character escaping has to be done.
  5921. A special option name @code{default} is available to use default options for a
  5922. filter.
  5923. It is required to specify either @code{default} or at least one of the filter options.
  5924. All omitted options are used with their default values.
  5925. The syntax of the filter string is as follows:
  5926. @example
  5927. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5928. @end example
  5929. @item output_rect
  5930. Specify a rectangle where the output of the filter chain is copied into the
  5931. input image. It is given by a list of space separated float values:
  5932. @example
  5933. output_rect=x\ y\ width\ height
  5934. @end example
  5935. If not given, the output rectangle equals the dimensions of the input image.
  5936. The output rectangle is automatically cropped at the borders of the input
  5937. image. Negative values are valid for each component.
  5938. @example
  5939. output_rect=25\ 25\ 100\ 100
  5940. @end example
  5941. @end table
  5942. Several filters can be chained for successive processing without GPU-HOST
  5943. transfers allowing for fast processing of complex filter chains.
  5944. Currently, only filters with zero (generators) or exactly one (filters) input
  5945. image and one output image are supported. Also, transition filters are not yet
  5946. usable as intended.
  5947. Some filters generate output images with additional padding depending on the
  5948. respective filter kernel. The padding is automatically removed to ensure the
  5949. filter output has the same size as the input image.
  5950. For image generators, the size of the output image is determined by the
  5951. previous output image of the filter chain or the input image of the whole
  5952. filterchain, respectively. The generators do not use the pixel information of
  5953. this image to generate their output. However, the generated output is
  5954. blended onto this image, resulting in partial or complete coverage of the
  5955. output image.
  5956. The @ref{coreimagesrc} video source can be used for generating input images
  5957. which are directly fed into the filter chain. By using it, providing input
  5958. images by another video source or an input video is not required.
  5959. @subsection Examples
  5960. @itemize
  5961. @item
  5962. List all filters available:
  5963. @example
  5964. coreimage=list_filters=true
  5965. @end example
  5966. @item
  5967. Use the CIBoxBlur filter with default options to blur an image:
  5968. @example
  5969. coreimage=filter=CIBoxBlur@@default
  5970. @end example
  5971. @item
  5972. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5973. its center at 100x100 and a radius of 50 pixels:
  5974. @example
  5975. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5976. @end example
  5977. @item
  5978. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5979. given as complete and escaped command-line for Apple's standard bash shell:
  5980. @example
  5981. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5982. @end example
  5983. @end itemize
  5984. @section cover_rect
  5985. Cover a rectangular object
  5986. It accepts the following options:
  5987. @table @option
  5988. @item cover
  5989. Filepath of the optional cover image, needs to be in yuv420.
  5990. @item mode
  5991. Set covering mode.
  5992. It accepts the following values:
  5993. @table @samp
  5994. @item cover
  5995. cover it by the supplied image
  5996. @item blur
  5997. cover it by interpolating the surrounding pixels
  5998. @end table
  5999. Default value is @var{blur}.
  6000. @end table
  6001. @subsection Examples
  6002. @itemize
  6003. @item
  6004. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6005. @example
  6006. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6007. @end example
  6008. @end itemize
  6009. @section crop
  6010. Crop the input video to given dimensions.
  6011. It accepts the following parameters:
  6012. @table @option
  6013. @item w, out_w
  6014. The width of the output video. It defaults to @code{iw}.
  6015. This expression is evaluated only once during the filter
  6016. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6017. @item h, out_h
  6018. The height of the output video. It defaults to @code{ih}.
  6019. This expression is evaluated only once during the filter
  6020. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6021. @item x
  6022. The horizontal position, in the input video, of the left edge of the output
  6023. video. It defaults to @code{(in_w-out_w)/2}.
  6024. This expression is evaluated per-frame.
  6025. @item y
  6026. The vertical position, in the input video, of the top edge of the output video.
  6027. It defaults to @code{(in_h-out_h)/2}.
  6028. This expression is evaluated per-frame.
  6029. @item keep_aspect
  6030. If set to 1 will force the output display aspect ratio
  6031. to be the same of the input, by changing the output sample aspect
  6032. ratio. It defaults to 0.
  6033. @item exact
  6034. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6035. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6036. It defaults to 0.
  6037. @end table
  6038. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6039. expressions containing the following constants:
  6040. @table @option
  6041. @item x
  6042. @item y
  6043. The computed values for @var{x} and @var{y}. They are evaluated for
  6044. each new frame.
  6045. @item in_w
  6046. @item in_h
  6047. The input width and height.
  6048. @item iw
  6049. @item ih
  6050. These are the same as @var{in_w} and @var{in_h}.
  6051. @item out_w
  6052. @item out_h
  6053. The output (cropped) width and height.
  6054. @item ow
  6055. @item oh
  6056. These are the same as @var{out_w} and @var{out_h}.
  6057. @item a
  6058. same as @var{iw} / @var{ih}
  6059. @item sar
  6060. input sample aspect ratio
  6061. @item dar
  6062. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6063. @item hsub
  6064. @item vsub
  6065. horizontal and vertical chroma subsample values. For example for the
  6066. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6067. @item n
  6068. The number of the input frame, starting from 0.
  6069. @item pos
  6070. the position in the file of the input frame, NAN if unknown
  6071. @item t
  6072. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6073. @end table
  6074. The expression for @var{out_w} may depend on the value of @var{out_h},
  6075. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6076. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6077. evaluated after @var{out_w} and @var{out_h}.
  6078. The @var{x} and @var{y} parameters specify the expressions for the
  6079. position of the top-left corner of the output (non-cropped) area. They
  6080. are evaluated for each frame. If the evaluated value is not valid, it
  6081. is approximated to the nearest valid value.
  6082. The expression for @var{x} may depend on @var{y}, and the expression
  6083. for @var{y} may depend on @var{x}.
  6084. @subsection Examples
  6085. @itemize
  6086. @item
  6087. Crop area with size 100x100 at position (12,34).
  6088. @example
  6089. crop=100:100:12:34
  6090. @end example
  6091. Using named options, the example above becomes:
  6092. @example
  6093. crop=w=100:h=100:x=12:y=34
  6094. @end example
  6095. @item
  6096. Crop the central input area with size 100x100:
  6097. @example
  6098. crop=100:100
  6099. @end example
  6100. @item
  6101. Crop the central input area with size 2/3 of the input video:
  6102. @example
  6103. crop=2/3*in_w:2/3*in_h
  6104. @end example
  6105. @item
  6106. Crop the input video central square:
  6107. @example
  6108. crop=out_w=in_h
  6109. crop=in_h
  6110. @end example
  6111. @item
  6112. Delimit the rectangle with the top-left corner placed at position
  6113. 100:100 and the right-bottom corner corresponding to the right-bottom
  6114. corner of the input image.
  6115. @example
  6116. crop=in_w-100:in_h-100:100:100
  6117. @end example
  6118. @item
  6119. Crop 10 pixels from the left and right borders, and 20 pixels from
  6120. the top and bottom borders
  6121. @example
  6122. crop=in_w-2*10:in_h-2*20
  6123. @end example
  6124. @item
  6125. Keep only the bottom right quarter of the input image:
  6126. @example
  6127. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6128. @end example
  6129. @item
  6130. Crop height for getting Greek harmony:
  6131. @example
  6132. crop=in_w:1/PHI*in_w
  6133. @end example
  6134. @item
  6135. Apply trembling effect:
  6136. @example
  6137. 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)
  6138. @end example
  6139. @item
  6140. Apply erratic camera effect depending on timestamp:
  6141. @example
  6142. 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)"
  6143. @end example
  6144. @item
  6145. Set x depending on the value of y:
  6146. @example
  6147. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6148. @end example
  6149. @end itemize
  6150. @subsection Commands
  6151. This filter supports the following commands:
  6152. @table @option
  6153. @item w, out_w
  6154. @item h, out_h
  6155. @item x
  6156. @item y
  6157. Set width/height of the output video and the horizontal/vertical position
  6158. in the input video.
  6159. The command accepts the same syntax of the corresponding option.
  6160. If the specified expression is not valid, it is kept at its current
  6161. value.
  6162. @end table
  6163. @section cropdetect
  6164. Auto-detect the crop size.
  6165. It calculates the necessary cropping parameters and prints the
  6166. recommended parameters via the logging system. The detected dimensions
  6167. correspond to the non-black area of the input video.
  6168. It accepts the following parameters:
  6169. @table @option
  6170. @item limit
  6171. Set higher black value threshold, which can be optionally specified
  6172. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6173. value greater to the set value is considered non-black. It defaults to 24.
  6174. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6175. on the bitdepth of the pixel format.
  6176. @item round
  6177. The value which the width/height should be divisible by. It defaults to
  6178. 16. The offset is automatically adjusted to center the video. Use 2 to
  6179. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6180. encoding to most video codecs.
  6181. @item reset_count, reset
  6182. Set the counter that determines after how many frames cropdetect will
  6183. reset the previously detected largest video area and start over to
  6184. detect the current optimal crop area. Default value is 0.
  6185. This can be useful when channel logos distort the video area. 0
  6186. indicates 'never reset', and returns the largest area encountered during
  6187. playback.
  6188. @end table
  6189. @anchor{cue}
  6190. @section cue
  6191. Delay video filtering until a given wallclock timestamp. The filter first
  6192. passes on @option{preroll} amount of frames, then it buffers at most
  6193. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6194. it forwards the buffered frames and also any subsequent frames coming in its
  6195. input.
  6196. The filter can be used synchronize the output of multiple ffmpeg processes for
  6197. realtime output devices like decklink. By putting the delay in the filtering
  6198. chain and pre-buffering frames the process can pass on data to output almost
  6199. immediately after the target wallclock timestamp is reached.
  6200. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6201. some use cases.
  6202. @table @option
  6203. @item cue
  6204. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6205. @item preroll
  6206. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6207. @item buffer
  6208. The maximum duration of content to buffer before waiting for the cue expressed
  6209. in seconds. Default is 0.
  6210. @end table
  6211. @anchor{curves}
  6212. @section curves
  6213. Apply color adjustments using curves.
  6214. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6215. component (red, green and blue) has its values defined by @var{N} key points
  6216. tied from each other using a smooth curve. The x-axis represents the pixel
  6217. values from the input frame, and the y-axis the new pixel values to be set for
  6218. the output frame.
  6219. By default, a component curve is defined by the two points @var{(0;0)} and
  6220. @var{(1;1)}. This creates a straight line where each original pixel value is
  6221. "adjusted" to its own value, which means no change to the image.
  6222. The filter allows you to redefine these two points and add some more. A new
  6223. curve (using a natural cubic spline interpolation) will be define to pass
  6224. smoothly through all these new coordinates. The new defined points needs to be
  6225. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6226. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6227. the vector spaces, the values will be clipped accordingly.
  6228. The filter accepts the following options:
  6229. @table @option
  6230. @item preset
  6231. Select one of the available color presets. This option can be used in addition
  6232. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6233. options takes priority on the preset values.
  6234. Available presets are:
  6235. @table @samp
  6236. @item none
  6237. @item color_negative
  6238. @item cross_process
  6239. @item darker
  6240. @item increase_contrast
  6241. @item lighter
  6242. @item linear_contrast
  6243. @item medium_contrast
  6244. @item negative
  6245. @item strong_contrast
  6246. @item vintage
  6247. @end table
  6248. Default is @code{none}.
  6249. @item master, m
  6250. Set the master key points. These points will define a second pass mapping. It
  6251. is sometimes called a "luminance" or "value" mapping. It can be used with
  6252. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6253. post-processing LUT.
  6254. @item red, r
  6255. Set the key points for the red component.
  6256. @item green, g
  6257. Set the key points for the green component.
  6258. @item blue, b
  6259. Set the key points for the blue component.
  6260. @item all
  6261. Set the key points for all components (not including master).
  6262. Can be used in addition to the other key points component
  6263. options. In this case, the unset component(s) will fallback on this
  6264. @option{all} setting.
  6265. @item psfile
  6266. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6267. @item plot
  6268. Save Gnuplot script of the curves in specified file.
  6269. @end table
  6270. To avoid some filtergraph syntax conflicts, each key points list need to be
  6271. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6272. @subsection Examples
  6273. @itemize
  6274. @item
  6275. Increase slightly the middle level of blue:
  6276. @example
  6277. curves=blue='0/0 0.5/0.58 1/1'
  6278. @end example
  6279. @item
  6280. Vintage effect:
  6281. @example
  6282. 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'
  6283. @end example
  6284. Here we obtain the following coordinates for each components:
  6285. @table @var
  6286. @item red
  6287. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6288. @item green
  6289. @code{(0;0) (0.50;0.48) (1;1)}
  6290. @item blue
  6291. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6292. @end table
  6293. @item
  6294. The previous example can also be achieved with the associated built-in preset:
  6295. @example
  6296. curves=preset=vintage
  6297. @end example
  6298. @item
  6299. Or simply:
  6300. @example
  6301. curves=vintage
  6302. @end example
  6303. @item
  6304. Use a Photoshop preset and redefine the points of the green component:
  6305. @example
  6306. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6307. @end example
  6308. @item
  6309. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6310. and @command{gnuplot}:
  6311. @example
  6312. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6313. gnuplot -p /tmp/curves.plt
  6314. @end example
  6315. @end itemize
  6316. @section datascope
  6317. Video data analysis filter.
  6318. This filter shows hexadecimal pixel values of part of video.
  6319. The filter accepts the following options:
  6320. @table @option
  6321. @item size, s
  6322. Set output video size.
  6323. @item x
  6324. Set x offset from where to pick pixels.
  6325. @item y
  6326. Set y offset from where to pick pixels.
  6327. @item mode
  6328. Set scope mode, can be one of the following:
  6329. @table @samp
  6330. @item mono
  6331. Draw hexadecimal pixel values with white color on black background.
  6332. @item color
  6333. Draw hexadecimal pixel values with input video pixel color on black
  6334. background.
  6335. @item color2
  6336. Draw hexadecimal pixel values on color background picked from input video,
  6337. the text color is picked in such way so its always visible.
  6338. @end table
  6339. @item axis
  6340. Draw rows and columns numbers on left and top of video.
  6341. @item opacity
  6342. Set background opacity.
  6343. @end table
  6344. @section dctdnoiz
  6345. Denoise frames using 2D DCT (frequency domain filtering).
  6346. This filter is not designed for real time.
  6347. The filter accepts the following options:
  6348. @table @option
  6349. @item sigma, s
  6350. Set the noise sigma constant.
  6351. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6352. coefficient (absolute value) below this threshold with be dropped.
  6353. If you need a more advanced filtering, see @option{expr}.
  6354. Default is @code{0}.
  6355. @item overlap
  6356. Set number overlapping pixels for each block. Since the filter can be slow, you
  6357. may want to reduce this value, at the cost of a less effective filter and the
  6358. risk of various artefacts.
  6359. If the overlapping value doesn't permit processing the whole input width or
  6360. height, a warning will be displayed and according borders won't be denoised.
  6361. Default value is @var{blocksize}-1, which is the best possible setting.
  6362. @item expr, e
  6363. Set the coefficient factor expression.
  6364. For each coefficient of a DCT block, this expression will be evaluated as a
  6365. multiplier value for the coefficient.
  6366. If this is option is set, the @option{sigma} option will be ignored.
  6367. The absolute value of the coefficient can be accessed through the @var{c}
  6368. variable.
  6369. @item n
  6370. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6371. @var{blocksize}, which is the width and height of the processed blocks.
  6372. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6373. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6374. on the speed processing. Also, a larger block size does not necessarily means a
  6375. better de-noising.
  6376. @end table
  6377. @subsection Examples
  6378. Apply a denoise with a @option{sigma} of @code{4.5}:
  6379. @example
  6380. dctdnoiz=4.5
  6381. @end example
  6382. The same operation can be achieved using the expression system:
  6383. @example
  6384. dctdnoiz=e='gte(c, 4.5*3)'
  6385. @end example
  6386. Violent denoise using a block size of @code{16x16}:
  6387. @example
  6388. dctdnoiz=15:n=4
  6389. @end example
  6390. @section deband
  6391. Remove banding artifacts from input video.
  6392. It works by replacing banded pixels with average value of referenced pixels.
  6393. The filter accepts the following options:
  6394. @table @option
  6395. @item 1thr
  6396. @item 2thr
  6397. @item 3thr
  6398. @item 4thr
  6399. Set banding detection threshold for each plane. Default is 0.02.
  6400. Valid range is 0.00003 to 0.5.
  6401. If difference between current pixel and reference pixel is less than threshold,
  6402. it will be considered as banded.
  6403. @item range, r
  6404. Banding detection range in pixels. Default is 16. If positive, random number
  6405. in range 0 to set value will be used. If negative, exact absolute value
  6406. will be used.
  6407. The range defines square of four pixels around current pixel.
  6408. @item direction, d
  6409. Set direction in radians from which four pixel will be compared. If positive,
  6410. random direction from 0 to set direction will be picked. If negative, exact of
  6411. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6412. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6413. column.
  6414. @item blur, b
  6415. If enabled, current pixel is compared with average value of all four
  6416. surrounding pixels. The default is enabled. If disabled current pixel is
  6417. compared with all four surrounding pixels. The pixel is considered banded
  6418. if only all four differences with surrounding pixels are less than threshold.
  6419. @item coupling, c
  6420. If enabled, current pixel is changed if and only if all pixel components are banded,
  6421. e.g. banding detection threshold is triggered for all color components.
  6422. The default is disabled.
  6423. @end table
  6424. @section deblock
  6425. Remove blocking artifacts from input video.
  6426. The filter accepts the following options:
  6427. @table @option
  6428. @item filter
  6429. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6430. This controls what kind of deblocking is applied.
  6431. @item block
  6432. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6433. @item alpha
  6434. @item beta
  6435. @item gamma
  6436. @item delta
  6437. Set blocking detection thresholds. Allowed range is 0 to 1.
  6438. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6439. Using higher threshold gives more deblocking strength.
  6440. Setting @var{alpha} controls threshold detection at exact edge of block.
  6441. Remaining options controls threshold detection near the edge. Each one for
  6442. below/above or left/right. Setting any of those to @var{0} disables
  6443. deblocking.
  6444. @item planes
  6445. Set planes to filter. Default is to filter all available planes.
  6446. @end table
  6447. @subsection Examples
  6448. @itemize
  6449. @item
  6450. Deblock using weak filter and block size of 4 pixels.
  6451. @example
  6452. deblock=filter=weak:block=4
  6453. @end example
  6454. @item
  6455. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6456. deblocking more edges.
  6457. @example
  6458. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6459. @end example
  6460. @item
  6461. Similar as above, but filter only first plane.
  6462. @example
  6463. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6464. @end example
  6465. @item
  6466. Similar as above, but filter only second and third plane.
  6467. @example
  6468. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6469. @end example
  6470. @end itemize
  6471. @anchor{decimate}
  6472. @section decimate
  6473. Drop duplicated frames at regular intervals.
  6474. The filter accepts the following options:
  6475. @table @option
  6476. @item cycle
  6477. Set the number of frames from which one will be dropped. Setting this to
  6478. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6479. Default is @code{5}.
  6480. @item dupthresh
  6481. Set the threshold for duplicate detection. If the difference metric for a frame
  6482. is less than or equal to this value, then it is declared as duplicate. Default
  6483. is @code{1.1}
  6484. @item scthresh
  6485. Set scene change threshold. Default is @code{15}.
  6486. @item blockx
  6487. @item blocky
  6488. Set the size of the x and y-axis blocks used during metric calculations.
  6489. Larger blocks give better noise suppression, but also give worse detection of
  6490. small movements. Must be a power of two. Default is @code{32}.
  6491. @item ppsrc
  6492. Mark main input as a pre-processed input and activate clean source input
  6493. stream. This allows the input to be pre-processed with various filters to help
  6494. the metrics calculation while keeping the frame selection lossless. When set to
  6495. @code{1}, the first stream is for the pre-processed input, and the second
  6496. stream is the clean source from where the kept frames are chosen. Default is
  6497. @code{0}.
  6498. @item chroma
  6499. Set whether or not chroma is considered in the metric calculations. Default is
  6500. @code{1}.
  6501. @end table
  6502. @section deconvolve
  6503. Apply 2D deconvolution of video stream in frequency domain using second stream
  6504. as impulse.
  6505. The filter accepts the following options:
  6506. @table @option
  6507. @item planes
  6508. Set which planes to process.
  6509. @item impulse
  6510. Set which impulse video frames will be processed, can be @var{first}
  6511. or @var{all}. Default is @var{all}.
  6512. @item noise
  6513. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6514. and height are not same and not power of 2 or if stream prior to convolving
  6515. had noise.
  6516. @end table
  6517. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6518. @section dedot
  6519. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6520. It accepts the following options:
  6521. @table @option
  6522. @item m
  6523. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6524. @var{rainbows} for cross-color reduction.
  6525. @item lt
  6526. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6527. @item tl
  6528. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6529. @item tc
  6530. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6531. @item ct
  6532. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6533. @end table
  6534. @section deflate
  6535. Apply deflate effect to the video.
  6536. This filter replaces the pixel by the local(3x3) average by taking into account
  6537. only values lower than the pixel.
  6538. It accepts the following options:
  6539. @table @option
  6540. @item threshold0
  6541. @item threshold1
  6542. @item threshold2
  6543. @item threshold3
  6544. Limit the maximum change for each plane, default is 65535.
  6545. If 0, plane will remain unchanged.
  6546. @end table
  6547. @section deflicker
  6548. Remove temporal frame luminance variations.
  6549. It accepts the following options:
  6550. @table @option
  6551. @item size, s
  6552. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6553. @item mode, m
  6554. Set averaging mode to smooth temporal luminance variations.
  6555. Available values are:
  6556. @table @samp
  6557. @item am
  6558. Arithmetic mean
  6559. @item gm
  6560. Geometric mean
  6561. @item hm
  6562. Harmonic mean
  6563. @item qm
  6564. Quadratic mean
  6565. @item cm
  6566. Cubic mean
  6567. @item pm
  6568. Power mean
  6569. @item median
  6570. Median
  6571. @end table
  6572. @item bypass
  6573. Do not actually modify frame. Useful when one only wants metadata.
  6574. @end table
  6575. @section dejudder
  6576. Remove judder produced by partially interlaced telecined content.
  6577. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6578. source was partially telecined content then the output of @code{pullup,dejudder}
  6579. will have a variable frame rate. May change the recorded frame rate of the
  6580. container. Aside from that change, this filter will not affect constant frame
  6581. rate video.
  6582. The option available in this filter is:
  6583. @table @option
  6584. @item cycle
  6585. Specify the length of the window over which the judder repeats.
  6586. Accepts any integer greater than 1. Useful values are:
  6587. @table @samp
  6588. @item 4
  6589. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6590. @item 5
  6591. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6592. @item 20
  6593. If a mixture of the two.
  6594. @end table
  6595. The default is @samp{4}.
  6596. @end table
  6597. @section delogo
  6598. Suppress a TV station logo by a simple interpolation of the surrounding
  6599. pixels. Just set a rectangle covering the logo and watch it disappear
  6600. (and sometimes something even uglier appear - your mileage may vary).
  6601. It accepts the following parameters:
  6602. @table @option
  6603. @item x
  6604. @item y
  6605. Specify the top left corner coordinates of the logo. They must be
  6606. specified.
  6607. @item w
  6608. @item h
  6609. Specify the width and height of the logo to clear. They must be
  6610. specified.
  6611. @item band, t
  6612. Specify the thickness of the fuzzy edge of the rectangle (added to
  6613. @var{w} and @var{h}). The default value is 1. This option is
  6614. deprecated, setting higher values should no longer be necessary and
  6615. is not recommended.
  6616. @item show
  6617. When set to 1, a green rectangle is drawn on the screen to simplify
  6618. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6619. The default value is 0.
  6620. The rectangle is drawn on the outermost pixels which will be (partly)
  6621. replaced with interpolated values. The values of the next pixels
  6622. immediately outside this rectangle in each direction will be used to
  6623. compute the interpolated pixel values inside the rectangle.
  6624. @end table
  6625. @subsection Examples
  6626. @itemize
  6627. @item
  6628. Set a rectangle covering the area with top left corner coordinates 0,0
  6629. and size 100x77, and a band of size 10:
  6630. @example
  6631. delogo=x=0:y=0:w=100:h=77:band=10
  6632. @end example
  6633. @end itemize
  6634. @section derain
  6635. Remove the rain in the input image/video by applying the derain methods based on
  6636. convolutional neural networks. Supported models:
  6637. @itemize
  6638. @item
  6639. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6640. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6641. @end itemize
  6642. Training as well as model generation scripts are provided in
  6643. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6644. Native model files (.model) can be generated from TensorFlow model
  6645. files (.pb) by using tools/python/convert.py
  6646. The filter accepts the following options:
  6647. @table @option
  6648. @item filter_type
  6649. Specify which filter to use. This option accepts the following values:
  6650. @table @samp
  6651. @item derain
  6652. Derain filter. To conduct derain filter, you need to use a derain model.
  6653. @item dehaze
  6654. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  6655. @end table
  6656. Default value is @samp{derain}.
  6657. @item dnn_backend
  6658. Specify which DNN backend to use for model loading and execution. This option accepts
  6659. the following values:
  6660. @table @samp
  6661. @item native
  6662. Native implementation of DNN loading and execution.
  6663. @item tensorflow
  6664. TensorFlow backend. To enable this backend you
  6665. need to install the TensorFlow for C library (see
  6666. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6667. @code{--enable-libtensorflow}
  6668. @end table
  6669. Default value is @samp{native}.
  6670. @item model
  6671. Set path to model file specifying network architecture and its parameters.
  6672. Note that different backends use different file formats. TensorFlow and native
  6673. backend can load files for only its format.
  6674. @end table
  6675. @section deshake
  6676. Attempt to fix small changes in horizontal and/or vertical shift. This
  6677. filter helps remove camera shake from hand-holding a camera, bumping a
  6678. tripod, moving on a vehicle, etc.
  6679. The filter accepts the following options:
  6680. @table @option
  6681. @item x
  6682. @item y
  6683. @item w
  6684. @item h
  6685. Specify a rectangular area where to limit the search for motion
  6686. vectors.
  6687. If desired the search for motion vectors can be limited to a
  6688. rectangular area of the frame defined by its top left corner, width
  6689. and height. These parameters have the same meaning as the drawbox
  6690. filter which can be used to visualise the position of the bounding
  6691. box.
  6692. This is useful when simultaneous movement of subjects within the frame
  6693. might be confused for camera motion by the motion vector search.
  6694. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6695. then the full frame is used. This allows later options to be set
  6696. without specifying the bounding box for the motion vector search.
  6697. Default - search the whole frame.
  6698. @item rx
  6699. @item ry
  6700. Specify the maximum extent of movement in x and y directions in the
  6701. range 0-64 pixels. Default 16.
  6702. @item edge
  6703. Specify how to generate pixels to fill blanks at the edge of the
  6704. frame. Available values are:
  6705. @table @samp
  6706. @item blank, 0
  6707. Fill zeroes at blank locations
  6708. @item original, 1
  6709. Original image at blank locations
  6710. @item clamp, 2
  6711. Extruded edge value at blank locations
  6712. @item mirror, 3
  6713. Mirrored edge at blank locations
  6714. @end table
  6715. Default value is @samp{mirror}.
  6716. @item blocksize
  6717. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6718. default 8.
  6719. @item contrast
  6720. Specify the contrast threshold for blocks. Only blocks with more than
  6721. the specified contrast (difference between darkest and lightest
  6722. pixels) will be considered. Range 1-255, default 125.
  6723. @item search
  6724. Specify the search strategy. Available values are:
  6725. @table @samp
  6726. @item exhaustive, 0
  6727. Set exhaustive search
  6728. @item less, 1
  6729. Set less exhaustive search.
  6730. @end table
  6731. Default value is @samp{exhaustive}.
  6732. @item filename
  6733. If set then a detailed log of the motion search is written to the
  6734. specified file.
  6735. @end table
  6736. @section despill
  6737. Remove unwanted contamination of foreground colors, caused by reflected color of
  6738. greenscreen or bluescreen.
  6739. This filter accepts the following options:
  6740. @table @option
  6741. @item type
  6742. Set what type of despill to use.
  6743. @item mix
  6744. Set how spillmap will be generated.
  6745. @item expand
  6746. Set how much to get rid of still remaining spill.
  6747. @item red
  6748. Controls amount of red in spill area.
  6749. @item green
  6750. Controls amount of green in spill area.
  6751. Should be -1 for greenscreen.
  6752. @item blue
  6753. Controls amount of blue in spill area.
  6754. Should be -1 for bluescreen.
  6755. @item brightness
  6756. Controls brightness of spill area, preserving colors.
  6757. @item alpha
  6758. Modify alpha from generated spillmap.
  6759. @end table
  6760. @section detelecine
  6761. Apply an exact inverse of the telecine operation. It requires a predefined
  6762. pattern specified using the pattern option which must be the same as that passed
  6763. to the telecine filter.
  6764. This filter accepts the following options:
  6765. @table @option
  6766. @item first_field
  6767. @table @samp
  6768. @item top, t
  6769. top field first
  6770. @item bottom, b
  6771. bottom field first
  6772. The default value is @code{top}.
  6773. @end table
  6774. @item pattern
  6775. A string of numbers representing the pulldown pattern you wish to apply.
  6776. The default value is @code{23}.
  6777. @item start_frame
  6778. A number representing position of the first frame with respect to the telecine
  6779. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6780. @end table
  6781. @section dilation
  6782. Apply dilation effect to the video.
  6783. This filter replaces the pixel by the local(3x3) maximum.
  6784. It accepts the following options:
  6785. @table @option
  6786. @item threshold0
  6787. @item threshold1
  6788. @item threshold2
  6789. @item threshold3
  6790. Limit the maximum change for each plane, default is 65535.
  6791. If 0, plane will remain unchanged.
  6792. @item coordinates
  6793. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6794. pixels are used.
  6795. Flags to local 3x3 coordinates maps like this:
  6796. 1 2 3
  6797. 4 5
  6798. 6 7 8
  6799. @end table
  6800. @section displace
  6801. Displace pixels as indicated by second and third input stream.
  6802. It takes three input streams and outputs one stream, the first input is the
  6803. source, and second and third input are displacement maps.
  6804. The second input specifies how much to displace pixels along the
  6805. x-axis, while the third input specifies how much to displace pixels
  6806. along the y-axis.
  6807. If one of displacement map streams terminates, last frame from that
  6808. displacement map will be used.
  6809. Note that once generated, displacements maps can be reused over and over again.
  6810. A description of the accepted options follows.
  6811. @table @option
  6812. @item edge
  6813. Set displace behavior for pixels that are out of range.
  6814. Available values are:
  6815. @table @samp
  6816. @item blank
  6817. Missing pixels are replaced by black pixels.
  6818. @item smear
  6819. Adjacent pixels will spread out to replace missing pixels.
  6820. @item wrap
  6821. Out of range pixels are wrapped so they point to pixels of other side.
  6822. @item mirror
  6823. Out of range pixels will be replaced with mirrored pixels.
  6824. @end table
  6825. Default is @samp{smear}.
  6826. @end table
  6827. @subsection Examples
  6828. @itemize
  6829. @item
  6830. Add ripple effect to rgb input of video size hd720:
  6831. @example
  6832. 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
  6833. @end example
  6834. @item
  6835. Add wave effect to rgb input of video size hd720:
  6836. @example
  6837. 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
  6838. @end example
  6839. @end itemize
  6840. @section drawbox
  6841. Draw a colored box on the input image.
  6842. It accepts the following parameters:
  6843. @table @option
  6844. @item x
  6845. @item y
  6846. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6847. @item width, w
  6848. @item height, h
  6849. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6850. the input width and height. It defaults to 0.
  6851. @item color, c
  6852. Specify the color of the box to write. For the general syntax of this option,
  6853. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6854. value @code{invert} is used, the box edge color is the same as the
  6855. video with inverted luma.
  6856. @item thickness, t
  6857. The expression which sets the thickness of the box edge.
  6858. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6859. See below for the list of accepted constants.
  6860. @item replace
  6861. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6862. will overwrite the video's color and alpha pixels.
  6863. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6864. @end table
  6865. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6866. following constants:
  6867. @table @option
  6868. @item dar
  6869. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6870. @item hsub
  6871. @item vsub
  6872. horizontal and vertical chroma subsample values. For example for the
  6873. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6874. @item in_h, ih
  6875. @item in_w, iw
  6876. The input width and height.
  6877. @item sar
  6878. The input sample aspect ratio.
  6879. @item x
  6880. @item y
  6881. The x and y offset coordinates where the box is drawn.
  6882. @item w
  6883. @item h
  6884. The width and height of the drawn box.
  6885. @item t
  6886. The thickness of the drawn box.
  6887. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6888. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6889. @end table
  6890. @subsection Examples
  6891. @itemize
  6892. @item
  6893. Draw a black box around the edge of the input image:
  6894. @example
  6895. drawbox
  6896. @end example
  6897. @item
  6898. Draw a box with color red and an opacity of 50%:
  6899. @example
  6900. drawbox=10:20:200:60:red@@0.5
  6901. @end example
  6902. The previous example can be specified as:
  6903. @example
  6904. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6905. @end example
  6906. @item
  6907. Fill the box with pink color:
  6908. @example
  6909. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6910. @end example
  6911. @item
  6912. Draw a 2-pixel red 2.40:1 mask:
  6913. @example
  6914. 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
  6915. @end example
  6916. @end itemize
  6917. @subsection Commands
  6918. This filter supports same commands as options.
  6919. The command accepts the same syntax of the corresponding option.
  6920. If the specified expression is not valid, it is kept at its current
  6921. value.
  6922. @section drawgrid
  6923. Draw a grid on the input image.
  6924. It accepts the following parameters:
  6925. @table @option
  6926. @item x
  6927. @item y
  6928. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6929. @item width, w
  6930. @item height, h
  6931. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6932. input width and height, respectively, minus @code{thickness}, so image gets
  6933. framed. Default to 0.
  6934. @item color, c
  6935. Specify the color of the grid. For the general syntax of this option,
  6936. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6937. value @code{invert} is used, the grid color is the same as the
  6938. video with inverted luma.
  6939. @item thickness, t
  6940. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6941. See below for the list of accepted constants.
  6942. @item replace
  6943. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6944. will overwrite the video's color and alpha pixels.
  6945. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6946. @end table
  6947. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6948. following constants:
  6949. @table @option
  6950. @item dar
  6951. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6952. @item hsub
  6953. @item vsub
  6954. horizontal and vertical chroma subsample values. For example for the
  6955. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6956. @item in_h, ih
  6957. @item in_w, iw
  6958. The input grid cell width and height.
  6959. @item sar
  6960. The input sample aspect ratio.
  6961. @item x
  6962. @item y
  6963. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6964. @item w
  6965. @item h
  6966. The width and height of the drawn cell.
  6967. @item t
  6968. The thickness of the drawn cell.
  6969. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6970. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6971. @end table
  6972. @subsection Examples
  6973. @itemize
  6974. @item
  6975. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6976. @example
  6977. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6978. @end example
  6979. @item
  6980. Draw a white 3x3 grid with an opacity of 50%:
  6981. @example
  6982. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6983. @end example
  6984. @end itemize
  6985. @subsection Commands
  6986. This filter supports same commands as options.
  6987. The command accepts the same syntax of the corresponding option.
  6988. If the specified expression is not valid, it is kept at its current
  6989. value.
  6990. @anchor{drawtext}
  6991. @section drawtext
  6992. Draw a text string or text from a specified file on top of a video, using the
  6993. libfreetype library.
  6994. To enable compilation of this filter, you need to configure FFmpeg with
  6995. @code{--enable-libfreetype}.
  6996. To enable default font fallback and the @var{font} option you need to
  6997. configure FFmpeg with @code{--enable-libfontconfig}.
  6998. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6999. @code{--enable-libfribidi}.
  7000. @subsection Syntax
  7001. It accepts the following parameters:
  7002. @table @option
  7003. @item box
  7004. Used to draw a box around text using the background color.
  7005. The value must be either 1 (enable) or 0 (disable).
  7006. The default value of @var{box} is 0.
  7007. @item boxborderw
  7008. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7009. The default value of @var{boxborderw} is 0.
  7010. @item boxcolor
  7011. The color to be used for drawing box around text. For the syntax of this
  7012. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7013. The default value of @var{boxcolor} is "white".
  7014. @item line_spacing
  7015. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7016. The default value of @var{line_spacing} is 0.
  7017. @item borderw
  7018. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7019. The default value of @var{borderw} is 0.
  7020. @item bordercolor
  7021. Set the color to be used for drawing border around text. For the syntax of this
  7022. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7023. The default value of @var{bordercolor} is "black".
  7024. @item expansion
  7025. Select how the @var{text} is expanded. Can be either @code{none},
  7026. @code{strftime} (deprecated) or
  7027. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7028. below for details.
  7029. @item basetime
  7030. Set a start time for the count. Value is in microseconds. Only applied
  7031. in the deprecated strftime expansion mode. To emulate in normal expansion
  7032. mode use the @code{pts} function, supplying the start time (in seconds)
  7033. as the second argument.
  7034. @item fix_bounds
  7035. If true, check and fix text coords to avoid clipping.
  7036. @item fontcolor
  7037. The color to be used for drawing fonts. For the syntax of this option, check
  7038. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7039. The default value of @var{fontcolor} is "black".
  7040. @item fontcolor_expr
  7041. String which is expanded the same way as @var{text} to obtain dynamic
  7042. @var{fontcolor} value. By default this option has empty value and is not
  7043. processed. When this option is set, it overrides @var{fontcolor} option.
  7044. @item font
  7045. The font family to be used for drawing text. By default Sans.
  7046. @item fontfile
  7047. The font file to be used for drawing text. The path must be included.
  7048. This parameter is mandatory if the fontconfig support is disabled.
  7049. @item alpha
  7050. Draw the text applying alpha blending. The value can
  7051. be a number between 0.0 and 1.0.
  7052. The expression accepts the same variables @var{x, y} as well.
  7053. The default value is 1.
  7054. Please see @var{fontcolor_expr}.
  7055. @item fontsize
  7056. The font size to be used for drawing text.
  7057. The default value of @var{fontsize} is 16.
  7058. @item text_shaping
  7059. If set to 1, attempt to shape the text (for example, reverse the order of
  7060. right-to-left text and join Arabic characters) before drawing it.
  7061. Otherwise, just draw the text exactly as given.
  7062. By default 1 (if supported).
  7063. @item ft_load_flags
  7064. The flags to be used for loading the fonts.
  7065. The flags map the corresponding flags supported by libfreetype, and are
  7066. a combination of the following values:
  7067. @table @var
  7068. @item default
  7069. @item no_scale
  7070. @item no_hinting
  7071. @item render
  7072. @item no_bitmap
  7073. @item vertical_layout
  7074. @item force_autohint
  7075. @item crop_bitmap
  7076. @item pedantic
  7077. @item ignore_global_advance_width
  7078. @item no_recurse
  7079. @item ignore_transform
  7080. @item monochrome
  7081. @item linear_design
  7082. @item no_autohint
  7083. @end table
  7084. Default value is "default".
  7085. For more information consult the documentation for the FT_LOAD_*
  7086. libfreetype flags.
  7087. @item shadowcolor
  7088. The color to be used for drawing a shadow behind the drawn text. For the
  7089. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7090. ffmpeg-utils manual,ffmpeg-utils}.
  7091. The default value of @var{shadowcolor} is "black".
  7092. @item shadowx
  7093. @item shadowy
  7094. The x and y offsets for the text shadow position with respect to the
  7095. position of the text. They can be either positive or negative
  7096. values. The default value for both is "0".
  7097. @item start_number
  7098. The starting frame number for the n/frame_num variable. The default value
  7099. is "0".
  7100. @item tabsize
  7101. The size in number of spaces to use for rendering the tab.
  7102. Default value is 4.
  7103. @item timecode
  7104. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7105. format. It can be used with or without text parameter. @var{timecode_rate}
  7106. option must be specified.
  7107. @item timecode_rate, rate, r
  7108. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7109. integer. Minimum value is "1".
  7110. Drop-frame timecode is supported for frame rates 30 & 60.
  7111. @item tc24hmax
  7112. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7113. Default is 0 (disabled).
  7114. @item text
  7115. The text string to be drawn. The text must be a sequence of UTF-8
  7116. encoded characters.
  7117. This parameter is mandatory if no file is specified with the parameter
  7118. @var{textfile}.
  7119. @item textfile
  7120. A text file containing text to be drawn. The text must be a sequence
  7121. of UTF-8 encoded characters.
  7122. This parameter is mandatory if no text string is specified with the
  7123. parameter @var{text}.
  7124. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7125. @item reload
  7126. If set to 1, the @var{textfile} will be reloaded before each frame.
  7127. Be sure to update it atomically, or it may be read partially, or even fail.
  7128. @item x
  7129. @item y
  7130. The expressions which specify the offsets where text will be drawn
  7131. within the video frame. They are relative to the top/left border of the
  7132. output image.
  7133. The default value of @var{x} and @var{y} is "0".
  7134. See below for the list of accepted constants and functions.
  7135. @end table
  7136. The parameters for @var{x} and @var{y} are expressions containing the
  7137. following constants and functions:
  7138. @table @option
  7139. @item dar
  7140. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7141. @item hsub
  7142. @item vsub
  7143. horizontal and vertical chroma subsample values. For example for the
  7144. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7145. @item line_h, lh
  7146. the height of each text line
  7147. @item main_h, h, H
  7148. the input height
  7149. @item main_w, w, W
  7150. the input width
  7151. @item max_glyph_a, ascent
  7152. the maximum distance from the baseline to the highest/upper grid
  7153. coordinate used to place a glyph outline point, for all the rendered
  7154. glyphs.
  7155. It is a positive value, due to the grid's orientation with the Y axis
  7156. upwards.
  7157. @item max_glyph_d, descent
  7158. the maximum distance from the baseline to the lowest grid coordinate
  7159. used to place a glyph outline point, for all the rendered glyphs.
  7160. This is a negative value, due to the grid's orientation, with the Y axis
  7161. upwards.
  7162. @item max_glyph_h
  7163. maximum glyph height, that is the maximum height for all the glyphs
  7164. contained in the rendered text, it is equivalent to @var{ascent} -
  7165. @var{descent}.
  7166. @item max_glyph_w
  7167. maximum glyph width, that is the maximum width for all the glyphs
  7168. contained in the rendered text
  7169. @item n
  7170. the number of input frame, starting from 0
  7171. @item rand(min, max)
  7172. return a random number included between @var{min} and @var{max}
  7173. @item sar
  7174. The input sample aspect ratio.
  7175. @item t
  7176. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7177. @item text_h, th
  7178. the height of the rendered text
  7179. @item text_w, tw
  7180. the width of the rendered text
  7181. @item x
  7182. @item y
  7183. the x and y offset coordinates where the text is drawn.
  7184. These parameters allow the @var{x} and @var{y} expressions to refer
  7185. to each other, so you can for example specify @code{y=x/dar}.
  7186. @item pict_type
  7187. A one character description of the current frame's picture type.
  7188. @item pkt_pos
  7189. The current packet's position in the input file or stream
  7190. (in bytes, from the start of the input). A value of -1 indicates
  7191. this info is not available.
  7192. @item pkt_duration
  7193. The current packet's duration, in seconds.
  7194. @item pkt_size
  7195. The current packet's size (in bytes).
  7196. @end table
  7197. @anchor{drawtext_expansion}
  7198. @subsection Text expansion
  7199. If @option{expansion} is set to @code{strftime},
  7200. the filter recognizes strftime() sequences in the provided text and
  7201. expands them accordingly. Check the documentation of strftime(). This
  7202. feature is deprecated.
  7203. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7204. If @option{expansion} is set to @code{normal} (which is the default),
  7205. the following expansion mechanism is used.
  7206. The backslash character @samp{\}, followed by any character, always expands to
  7207. the second character.
  7208. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7209. braces is a function name, possibly followed by arguments separated by ':'.
  7210. If the arguments contain special characters or delimiters (':' or '@}'),
  7211. they should be escaped.
  7212. Note that they probably must also be escaped as the value for the
  7213. @option{text} option in the filter argument string and as the filter
  7214. argument in the filtergraph description, and possibly also for the shell,
  7215. that makes up to four levels of escaping; using a text file avoids these
  7216. problems.
  7217. The following functions are available:
  7218. @table @command
  7219. @item expr, e
  7220. The expression evaluation result.
  7221. It must take one argument specifying the expression to be evaluated,
  7222. which accepts the same constants and functions as the @var{x} and
  7223. @var{y} values. Note that not all constants should be used, for
  7224. example the text size is not known when evaluating the expression, so
  7225. the constants @var{text_w} and @var{text_h} will have an undefined
  7226. value.
  7227. @item expr_int_format, eif
  7228. Evaluate the expression's value and output as formatted integer.
  7229. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7230. The second argument specifies the output format. Allowed values are @samp{x},
  7231. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7232. @code{printf} function.
  7233. The third parameter is optional and sets the number of positions taken by the output.
  7234. It can be used to add padding with zeros from the left.
  7235. @item gmtime
  7236. The time at which the filter is running, expressed in UTC.
  7237. It can accept an argument: a strftime() format string.
  7238. @item localtime
  7239. The time at which the filter is running, expressed in the local time zone.
  7240. It can accept an argument: a strftime() format string.
  7241. @item metadata
  7242. Frame metadata. Takes one or two arguments.
  7243. The first argument is mandatory and specifies the metadata key.
  7244. The second argument is optional and specifies a default value, used when the
  7245. metadata key is not found or empty.
  7246. Available metadata can be identified by inspecting entries
  7247. starting with TAG included within each frame section
  7248. printed by running @code{ffprobe -show_frames}.
  7249. String metadata generated in filters leading to
  7250. the drawtext filter are also available.
  7251. @item n, frame_num
  7252. The frame number, starting from 0.
  7253. @item pict_type
  7254. A one character description of the current picture type.
  7255. @item pts
  7256. The timestamp of the current frame.
  7257. It can take up to three arguments.
  7258. The first argument is the format of the timestamp; it defaults to @code{flt}
  7259. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7260. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7261. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7262. @code{localtime} stands for the timestamp of the frame formatted as
  7263. local time zone time.
  7264. The second argument is an offset added to the timestamp.
  7265. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7266. supplied to present the hour part of the formatted timestamp in 24h format
  7267. (00-23).
  7268. If the format is set to @code{localtime} or @code{gmtime},
  7269. a third argument may be supplied: a strftime() format string.
  7270. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7271. @end table
  7272. @subsection Commands
  7273. This filter supports altering parameters via commands:
  7274. @table @option
  7275. @item reinit
  7276. Alter existing filter parameters.
  7277. Syntax for the argument is the same as for filter invocation, e.g.
  7278. @example
  7279. fontsize=56:fontcolor=green:text='Hello World'
  7280. @end example
  7281. Full filter invocation with sendcmd would look like this:
  7282. @example
  7283. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7284. @end example
  7285. @end table
  7286. If the entire argument can't be parsed or applied as valid values then the filter will
  7287. continue with its existing parameters.
  7288. @subsection Examples
  7289. @itemize
  7290. @item
  7291. Draw "Test Text" with font FreeSerif, using the default values for the
  7292. optional parameters.
  7293. @example
  7294. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7295. @end example
  7296. @item
  7297. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7298. and y=50 (counting from the top-left corner of the screen), text is
  7299. yellow with a red box around it. Both the text and the box have an
  7300. opacity of 20%.
  7301. @example
  7302. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7303. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7304. @end example
  7305. Note that the double quotes are not necessary if spaces are not used
  7306. within the parameter list.
  7307. @item
  7308. Show the text at the center of the video frame:
  7309. @example
  7310. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7311. @end example
  7312. @item
  7313. Show the text at a random position, switching to a new position every 30 seconds:
  7314. @example
  7315. 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)"
  7316. @end example
  7317. @item
  7318. Show a text line sliding from right to left in the last row of the video
  7319. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7320. with no newlines.
  7321. @example
  7322. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7323. @end example
  7324. @item
  7325. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7326. @example
  7327. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7328. @end example
  7329. @item
  7330. Draw a single green letter "g", at the center of the input video.
  7331. The glyph baseline is placed at half screen height.
  7332. @example
  7333. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7334. @end example
  7335. @item
  7336. Show text for 1 second every 3 seconds:
  7337. @example
  7338. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7339. @end example
  7340. @item
  7341. Use fontconfig to set the font. Note that the colons need to be escaped.
  7342. @example
  7343. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7344. @end example
  7345. @item
  7346. Print the date of a real-time encoding (see strftime(3)):
  7347. @example
  7348. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7349. @end example
  7350. @item
  7351. Show text fading in and out (appearing/disappearing):
  7352. @example
  7353. #!/bin/sh
  7354. DS=1.0 # display start
  7355. DE=10.0 # display end
  7356. FID=1.5 # fade in duration
  7357. FOD=5 # fade out duration
  7358. 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 @}"
  7359. @end example
  7360. @item
  7361. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7362. and the @option{fontsize} value are included in the @option{y} offset.
  7363. @example
  7364. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7365. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7366. @end example
  7367. @end itemize
  7368. For more information about libfreetype, check:
  7369. @url{http://www.freetype.org/}.
  7370. For more information about fontconfig, check:
  7371. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7372. For more information about libfribidi, check:
  7373. @url{http://fribidi.org/}.
  7374. @section edgedetect
  7375. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7376. The filter accepts the following options:
  7377. @table @option
  7378. @item low
  7379. @item high
  7380. Set low and high threshold values used by the Canny thresholding
  7381. algorithm.
  7382. The high threshold selects the "strong" edge pixels, which are then
  7383. connected through 8-connectivity with the "weak" edge pixels selected
  7384. by the low threshold.
  7385. @var{low} and @var{high} threshold values must be chosen in the range
  7386. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7387. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7388. is @code{50/255}.
  7389. @item mode
  7390. Define the drawing mode.
  7391. @table @samp
  7392. @item wires
  7393. Draw white/gray wires on black background.
  7394. @item colormix
  7395. Mix the colors to create a paint/cartoon effect.
  7396. @item canny
  7397. Apply Canny edge detector on all selected planes.
  7398. @end table
  7399. Default value is @var{wires}.
  7400. @item planes
  7401. Select planes for filtering. By default all available planes are filtered.
  7402. @end table
  7403. @subsection Examples
  7404. @itemize
  7405. @item
  7406. Standard edge detection with custom values for the hysteresis thresholding:
  7407. @example
  7408. edgedetect=low=0.1:high=0.4
  7409. @end example
  7410. @item
  7411. Painting effect without thresholding:
  7412. @example
  7413. edgedetect=mode=colormix:high=0
  7414. @end example
  7415. @end itemize
  7416. @section elbg
  7417. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7418. For each input image, the filter will compute the optimal mapping from
  7419. the input to the output given the codebook length, that is the number
  7420. of distinct output colors.
  7421. This filter accepts the following options.
  7422. @table @option
  7423. @item codebook_length, l
  7424. Set codebook length. The value must be a positive integer, and
  7425. represents the number of distinct output colors. Default value is 256.
  7426. @item nb_steps, n
  7427. Set the maximum number of iterations to apply for computing the optimal
  7428. mapping. The higher the value the better the result and the higher the
  7429. computation time. Default value is 1.
  7430. @item seed, s
  7431. Set a random seed, must be an integer included between 0 and
  7432. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7433. will try to use a good random seed on a best effort basis.
  7434. @item pal8
  7435. Set pal8 output pixel format. This option does not work with codebook
  7436. length greater than 256.
  7437. @end table
  7438. @section entropy
  7439. Measure graylevel entropy in histogram of color channels of video frames.
  7440. It accepts the following parameters:
  7441. @table @option
  7442. @item mode
  7443. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7444. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7445. between neighbour histogram values.
  7446. @end table
  7447. @section eq
  7448. Set brightness, contrast, saturation and approximate gamma adjustment.
  7449. The filter accepts the following options:
  7450. @table @option
  7451. @item contrast
  7452. Set the contrast expression. The value must be a float value in range
  7453. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7454. @item brightness
  7455. Set the brightness expression. The value must be a float value in
  7456. range @code{-1.0} to @code{1.0}. The default value is "0".
  7457. @item saturation
  7458. Set the saturation expression. The value must be a float in
  7459. range @code{0.0} to @code{3.0}. The default value is "1".
  7460. @item gamma
  7461. Set the gamma expression. The value must be a float in range
  7462. @code{0.1} to @code{10.0}. The default value is "1".
  7463. @item gamma_r
  7464. Set the gamma expression for red. The value must be a float in
  7465. range @code{0.1} to @code{10.0}. The default value is "1".
  7466. @item gamma_g
  7467. Set the gamma expression for green. The value must be a float in range
  7468. @code{0.1} to @code{10.0}. The default value is "1".
  7469. @item gamma_b
  7470. Set the gamma expression for blue. The value must be a float in range
  7471. @code{0.1} to @code{10.0}. The default value is "1".
  7472. @item gamma_weight
  7473. Set the gamma weight expression. It can be used to reduce the effect
  7474. of a high gamma value on bright image areas, e.g. keep them from
  7475. getting overamplified and just plain white. The value must be a float
  7476. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7477. gamma correction all the way down while @code{1.0} leaves it at its
  7478. full strength. Default is "1".
  7479. @item eval
  7480. Set when the expressions for brightness, contrast, saturation and
  7481. gamma expressions are evaluated.
  7482. It accepts the following values:
  7483. @table @samp
  7484. @item init
  7485. only evaluate expressions once during the filter initialization or
  7486. when a command is processed
  7487. @item frame
  7488. evaluate expressions for each incoming frame
  7489. @end table
  7490. Default value is @samp{init}.
  7491. @end table
  7492. The expressions accept the following parameters:
  7493. @table @option
  7494. @item n
  7495. frame count of the input frame starting from 0
  7496. @item pos
  7497. byte position of the corresponding packet in the input file, NAN if
  7498. unspecified
  7499. @item r
  7500. frame rate of the input video, NAN if the input frame rate is unknown
  7501. @item t
  7502. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7503. @end table
  7504. @subsection Commands
  7505. The filter supports the following commands:
  7506. @table @option
  7507. @item contrast
  7508. Set the contrast expression.
  7509. @item brightness
  7510. Set the brightness expression.
  7511. @item saturation
  7512. Set the saturation expression.
  7513. @item gamma
  7514. Set the gamma expression.
  7515. @item gamma_r
  7516. Set the gamma_r expression.
  7517. @item gamma_g
  7518. Set gamma_g expression.
  7519. @item gamma_b
  7520. Set gamma_b expression.
  7521. @item gamma_weight
  7522. Set gamma_weight expression.
  7523. The command accepts the same syntax of the corresponding option.
  7524. If the specified expression is not valid, it is kept at its current
  7525. value.
  7526. @end table
  7527. @section erosion
  7528. Apply erosion effect to the video.
  7529. This filter replaces the pixel by the local(3x3) minimum.
  7530. It accepts the following options:
  7531. @table @option
  7532. @item threshold0
  7533. @item threshold1
  7534. @item threshold2
  7535. @item threshold3
  7536. Limit the maximum change for each plane, default is 65535.
  7537. If 0, plane will remain unchanged.
  7538. @item coordinates
  7539. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7540. pixels are used.
  7541. Flags to local 3x3 coordinates maps like this:
  7542. 1 2 3
  7543. 4 5
  7544. 6 7 8
  7545. @end table
  7546. @section extractplanes
  7547. Extract color channel components from input video stream into
  7548. separate grayscale video streams.
  7549. The filter accepts the following option:
  7550. @table @option
  7551. @item planes
  7552. Set plane(s) to extract.
  7553. Available values for planes are:
  7554. @table @samp
  7555. @item y
  7556. @item u
  7557. @item v
  7558. @item a
  7559. @item r
  7560. @item g
  7561. @item b
  7562. @end table
  7563. Choosing planes not available in the input will result in an error.
  7564. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7565. with @code{y}, @code{u}, @code{v} planes at same time.
  7566. @end table
  7567. @subsection Examples
  7568. @itemize
  7569. @item
  7570. Extract luma, u and v color channel component from input video frame
  7571. into 3 grayscale outputs:
  7572. @example
  7573. 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
  7574. @end example
  7575. @end itemize
  7576. @section fade
  7577. Apply a fade-in/out effect to the input video.
  7578. It accepts the following parameters:
  7579. @table @option
  7580. @item type, t
  7581. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7582. effect.
  7583. Default is @code{in}.
  7584. @item start_frame, s
  7585. Specify the number of the frame to start applying the fade
  7586. effect at. Default is 0.
  7587. @item nb_frames, n
  7588. The number of frames that the fade effect lasts. At the end of the
  7589. fade-in effect, the output video will have the same intensity as the input video.
  7590. At the end of the fade-out transition, the output video will be filled with the
  7591. selected @option{color}.
  7592. Default is 25.
  7593. @item alpha
  7594. If set to 1, fade only alpha channel, if one exists on the input.
  7595. Default value is 0.
  7596. @item start_time, st
  7597. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7598. effect. If both start_frame and start_time are specified, the fade will start at
  7599. whichever comes last. Default is 0.
  7600. @item duration, d
  7601. The number of seconds for which the fade effect has to last. At the end of the
  7602. fade-in effect the output video will have the same intensity as the input video,
  7603. at the end of the fade-out transition the output video will be filled with the
  7604. selected @option{color}.
  7605. If both duration and nb_frames are specified, duration is used. Default is 0
  7606. (nb_frames is used by default).
  7607. @item color, c
  7608. Specify the color of the fade. Default is "black".
  7609. @end table
  7610. @subsection Examples
  7611. @itemize
  7612. @item
  7613. Fade in the first 30 frames of video:
  7614. @example
  7615. fade=in:0:30
  7616. @end example
  7617. The command above is equivalent to:
  7618. @example
  7619. fade=t=in:s=0:n=30
  7620. @end example
  7621. @item
  7622. Fade out the last 45 frames of a 200-frame video:
  7623. @example
  7624. fade=out:155:45
  7625. fade=type=out:start_frame=155:nb_frames=45
  7626. @end example
  7627. @item
  7628. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7629. @example
  7630. fade=in:0:25, fade=out:975:25
  7631. @end example
  7632. @item
  7633. Make the first 5 frames yellow, then fade in from frame 5-24:
  7634. @example
  7635. fade=in:5:20:color=yellow
  7636. @end example
  7637. @item
  7638. Fade in alpha over first 25 frames of video:
  7639. @example
  7640. fade=in:0:25:alpha=1
  7641. @end example
  7642. @item
  7643. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7644. @example
  7645. fade=t=in:st=5.5:d=0.5
  7646. @end example
  7647. @end itemize
  7648. @section fftdnoiz
  7649. Denoise frames using 3D FFT (frequency domain filtering).
  7650. The filter accepts the following options:
  7651. @table @option
  7652. @item sigma
  7653. Set the noise sigma constant. This sets denoising strength.
  7654. Default value is 1. Allowed range is from 0 to 30.
  7655. Using very high sigma with low overlap may give blocking artifacts.
  7656. @item amount
  7657. Set amount of denoising. By default all detected noise is reduced.
  7658. Default value is 1. Allowed range is from 0 to 1.
  7659. @item block
  7660. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7661. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7662. block size in pixels is 2^4 which is 16.
  7663. @item overlap
  7664. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7665. @item prev
  7666. Set number of previous frames to use for denoising. By default is set to 0.
  7667. @item next
  7668. Set number of next frames to to use for denoising. By default is set to 0.
  7669. @item planes
  7670. Set planes which will be filtered, by default are all available filtered
  7671. except alpha.
  7672. @end table
  7673. @section fftfilt
  7674. Apply arbitrary expressions to samples in frequency domain
  7675. @table @option
  7676. @item dc_Y
  7677. Adjust the dc value (gain) of the luma plane of the image. The filter
  7678. accepts an integer value in range @code{0} to @code{1000}. The default
  7679. value is set to @code{0}.
  7680. @item dc_U
  7681. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7682. filter accepts an integer value in range @code{0} to @code{1000}. The
  7683. default value is set to @code{0}.
  7684. @item dc_V
  7685. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7686. filter accepts an integer value in range @code{0} to @code{1000}. The
  7687. default value is set to @code{0}.
  7688. @item weight_Y
  7689. Set the frequency domain weight expression for the luma plane.
  7690. @item weight_U
  7691. Set the frequency domain weight expression for the 1st chroma plane.
  7692. @item weight_V
  7693. Set the frequency domain weight expression for the 2nd chroma plane.
  7694. @item eval
  7695. Set when the expressions are evaluated.
  7696. It accepts the following values:
  7697. @table @samp
  7698. @item init
  7699. Only evaluate expressions once during the filter initialization.
  7700. @item frame
  7701. Evaluate expressions for each incoming frame.
  7702. @end table
  7703. Default value is @samp{init}.
  7704. The filter accepts the following variables:
  7705. @item X
  7706. @item Y
  7707. The coordinates of the current sample.
  7708. @item W
  7709. @item H
  7710. The width and height of the image.
  7711. @item N
  7712. The number of input frame, starting from 0.
  7713. @end table
  7714. @subsection Examples
  7715. @itemize
  7716. @item
  7717. High-pass:
  7718. @example
  7719. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7720. @end example
  7721. @item
  7722. Low-pass:
  7723. @example
  7724. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7725. @end example
  7726. @item
  7727. Sharpen:
  7728. @example
  7729. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7730. @end example
  7731. @item
  7732. Blur:
  7733. @example
  7734. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7735. @end example
  7736. @end itemize
  7737. @section field
  7738. Extract a single field from an interlaced image using stride
  7739. arithmetic to avoid wasting CPU time. The output frames are marked as
  7740. non-interlaced.
  7741. The filter accepts the following options:
  7742. @table @option
  7743. @item type
  7744. Specify whether to extract the top (if the value is @code{0} or
  7745. @code{top}) or the bottom field (if the value is @code{1} or
  7746. @code{bottom}).
  7747. @end table
  7748. @section fieldhint
  7749. Create new frames by copying the top and bottom fields from surrounding frames
  7750. supplied as numbers by the hint file.
  7751. @table @option
  7752. @item hint
  7753. Set file containing hints: absolute/relative frame numbers.
  7754. There must be one line for each frame in a clip. Each line must contain two
  7755. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7756. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7757. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7758. for @code{relative} mode. First number tells from which frame to pick up top
  7759. field and second number tells from which frame to pick up bottom field.
  7760. If optionally followed by @code{+} output frame will be marked as interlaced,
  7761. else if followed by @code{-} output frame will be marked as progressive, else
  7762. it will be marked same as input frame.
  7763. If optionally followed by @code{t} output frame will use only top field, or in
  7764. case of @code{b} it will use only bottom field.
  7765. If line starts with @code{#} or @code{;} that line is skipped.
  7766. @item mode
  7767. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7768. @end table
  7769. Example of first several lines of @code{hint} file for @code{relative} mode:
  7770. @example
  7771. 0,0 - # first frame
  7772. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7773. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7774. 1,0 -
  7775. 0,0 -
  7776. 0,0 -
  7777. 1,0 -
  7778. 1,0 -
  7779. 1,0 -
  7780. 0,0 -
  7781. 0,0 -
  7782. 1,0 -
  7783. 1,0 -
  7784. 1,0 -
  7785. 0,0 -
  7786. @end example
  7787. @section fieldmatch
  7788. Field matching filter for inverse telecine. It is meant to reconstruct the
  7789. progressive frames from a telecined stream. The filter does not drop duplicated
  7790. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7791. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7792. The separation of the field matching and the decimation is notably motivated by
  7793. the possibility of inserting a de-interlacing filter fallback between the two.
  7794. If the source has mixed telecined and real interlaced content,
  7795. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7796. But these remaining combed frames will be marked as interlaced, and thus can be
  7797. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7798. In addition to the various configuration options, @code{fieldmatch} can take an
  7799. optional second stream, activated through the @option{ppsrc} option. If
  7800. enabled, the frames reconstruction will be based on the fields and frames from
  7801. this second stream. This allows the first input to be pre-processed in order to
  7802. help the various algorithms of the filter, while keeping the output lossless
  7803. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7804. or brightness/contrast adjustments can help.
  7805. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7806. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7807. which @code{fieldmatch} is based on. While the semantic and usage are very
  7808. close, some behaviour and options names can differ.
  7809. The @ref{decimate} filter currently only works for constant frame rate input.
  7810. If your input has mixed telecined (30fps) and progressive content with a lower
  7811. framerate like 24fps use the following filterchain to produce the necessary cfr
  7812. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7813. The filter accepts the following options:
  7814. @table @option
  7815. @item order
  7816. Specify the assumed field order of the input stream. Available values are:
  7817. @table @samp
  7818. @item auto
  7819. Auto detect parity (use FFmpeg's internal parity value).
  7820. @item bff
  7821. Assume bottom field first.
  7822. @item tff
  7823. Assume top field first.
  7824. @end table
  7825. Note that it is sometimes recommended not to trust the parity announced by the
  7826. stream.
  7827. Default value is @var{auto}.
  7828. @item mode
  7829. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7830. sense that it won't risk creating jerkiness due to duplicate frames when
  7831. possible, but if there are bad edits or blended fields it will end up
  7832. outputting combed frames when a good match might actually exist. On the other
  7833. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7834. but will almost always find a good frame if there is one. The other values are
  7835. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7836. jerkiness and creating duplicate frames versus finding good matches in sections
  7837. with bad edits, orphaned fields, blended fields, etc.
  7838. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7839. Available values are:
  7840. @table @samp
  7841. @item pc
  7842. 2-way matching (p/c)
  7843. @item pc_n
  7844. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7845. @item pc_u
  7846. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7847. @item pc_n_ub
  7848. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7849. still combed (p/c + n + u/b)
  7850. @item pcn
  7851. 3-way matching (p/c/n)
  7852. @item pcn_ub
  7853. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7854. detected as combed (p/c/n + u/b)
  7855. @end table
  7856. The parenthesis at the end indicate the matches that would be used for that
  7857. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7858. @var{top}).
  7859. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7860. the slowest.
  7861. Default value is @var{pc_n}.
  7862. @item ppsrc
  7863. Mark the main input stream as a pre-processed input, and enable the secondary
  7864. input stream as the clean source to pick the fields from. See the filter
  7865. introduction for more details. It is similar to the @option{clip2} feature from
  7866. VFM/TFM.
  7867. Default value is @code{0} (disabled).
  7868. @item field
  7869. Set the field to match from. It is recommended to set this to the same value as
  7870. @option{order} unless you experience matching failures with that setting. In
  7871. certain circumstances changing the field that is used to match from can have a
  7872. large impact on matching performance. Available values are:
  7873. @table @samp
  7874. @item auto
  7875. Automatic (same value as @option{order}).
  7876. @item bottom
  7877. Match from the bottom field.
  7878. @item top
  7879. Match from the top field.
  7880. @end table
  7881. Default value is @var{auto}.
  7882. @item mchroma
  7883. Set whether or not chroma is included during the match comparisons. In most
  7884. cases it is recommended to leave this enabled. You should set this to @code{0}
  7885. only if your clip has bad chroma problems such as heavy rainbowing or other
  7886. artifacts. Setting this to @code{0} could also be used to speed things up at
  7887. the cost of some accuracy.
  7888. Default value is @code{1}.
  7889. @item y0
  7890. @item y1
  7891. These define an exclusion band which excludes the lines between @option{y0} and
  7892. @option{y1} from being included in the field matching decision. An exclusion
  7893. band can be used to ignore subtitles, a logo, or other things that may
  7894. interfere with the matching. @option{y0} sets the starting scan line and
  7895. @option{y1} sets the ending line; all lines in between @option{y0} and
  7896. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7897. @option{y0} and @option{y1} to the same value will disable the feature.
  7898. @option{y0} and @option{y1} defaults to @code{0}.
  7899. @item scthresh
  7900. Set the scene change detection threshold as a percentage of maximum change on
  7901. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7902. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7903. @option{scthresh} is @code{[0.0, 100.0]}.
  7904. Default value is @code{12.0}.
  7905. @item combmatch
  7906. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7907. account the combed scores of matches when deciding what match to use as the
  7908. final match. Available values are:
  7909. @table @samp
  7910. @item none
  7911. No final matching based on combed scores.
  7912. @item sc
  7913. Combed scores are only used when a scene change is detected.
  7914. @item full
  7915. Use combed scores all the time.
  7916. @end table
  7917. Default is @var{sc}.
  7918. @item combdbg
  7919. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7920. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7921. Available values are:
  7922. @table @samp
  7923. @item none
  7924. No forced calculation.
  7925. @item pcn
  7926. Force p/c/n calculations.
  7927. @item pcnub
  7928. Force p/c/n/u/b calculations.
  7929. @end table
  7930. Default value is @var{none}.
  7931. @item cthresh
  7932. This is the area combing threshold used for combed frame detection. This
  7933. essentially controls how "strong" or "visible" combing must be to be detected.
  7934. Larger values mean combing must be more visible and smaller values mean combing
  7935. can be less visible or strong and still be detected. Valid settings are from
  7936. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7937. be detected as combed). This is basically a pixel difference value. A good
  7938. range is @code{[8, 12]}.
  7939. Default value is @code{9}.
  7940. @item chroma
  7941. Sets whether or not chroma is considered in the combed frame decision. Only
  7942. disable this if your source has chroma problems (rainbowing, etc.) that are
  7943. causing problems for the combed frame detection with chroma enabled. Actually,
  7944. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7945. where there is chroma only combing in the source.
  7946. Default value is @code{0}.
  7947. @item blockx
  7948. @item blocky
  7949. Respectively set the x-axis and y-axis size of the window used during combed
  7950. frame detection. This has to do with the size of the area in which
  7951. @option{combpel} pixels are required to be detected as combed for a frame to be
  7952. declared combed. See the @option{combpel} parameter description for more info.
  7953. Possible values are any number that is a power of 2 starting at 4 and going up
  7954. to 512.
  7955. Default value is @code{16}.
  7956. @item combpel
  7957. The number of combed pixels inside any of the @option{blocky} by
  7958. @option{blockx} size blocks on the frame for the frame to be detected as
  7959. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7960. setting controls "how much" combing there must be in any localized area (a
  7961. window defined by the @option{blockx} and @option{blocky} settings) on the
  7962. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7963. which point no frames will ever be detected as combed). This setting is known
  7964. as @option{MI} in TFM/VFM vocabulary.
  7965. Default value is @code{80}.
  7966. @end table
  7967. @anchor{p/c/n/u/b meaning}
  7968. @subsection p/c/n/u/b meaning
  7969. @subsubsection p/c/n
  7970. We assume the following telecined stream:
  7971. @example
  7972. Top fields: 1 2 2 3 4
  7973. Bottom fields: 1 2 3 4 4
  7974. @end example
  7975. The numbers correspond to the progressive frame the fields relate to. Here, the
  7976. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7977. When @code{fieldmatch} is configured to run a matching from bottom
  7978. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7979. @example
  7980. Input stream:
  7981. T 1 2 2 3 4
  7982. B 1 2 3 4 4 <-- matching reference
  7983. Matches: c c n n c
  7984. Output stream:
  7985. T 1 2 3 4 4
  7986. B 1 2 3 4 4
  7987. @end example
  7988. As a result of the field matching, we can see that some frames get duplicated.
  7989. To perform a complete inverse telecine, you need to rely on a decimation filter
  7990. after this operation. See for instance the @ref{decimate} filter.
  7991. The same operation now matching from top fields (@option{field}=@var{top})
  7992. looks like this:
  7993. @example
  7994. Input stream:
  7995. T 1 2 2 3 4 <-- matching reference
  7996. B 1 2 3 4 4
  7997. Matches: c c p p c
  7998. Output stream:
  7999. T 1 2 2 3 4
  8000. B 1 2 2 3 4
  8001. @end example
  8002. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8003. basically, they refer to the frame and field of the opposite parity:
  8004. @itemize
  8005. @item @var{p} matches the field of the opposite parity in the previous frame
  8006. @item @var{c} matches the field of the opposite parity in the current frame
  8007. @item @var{n} matches the field of the opposite parity in the next frame
  8008. @end itemize
  8009. @subsubsection u/b
  8010. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8011. from the opposite parity flag. In the following examples, we assume that we are
  8012. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8013. 'x' is placed above and below each matched fields.
  8014. With bottom matching (@option{field}=@var{bottom}):
  8015. @example
  8016. Match: c p n b u
  8017. x x x x x
  8018. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8019. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8020. x x x x x
  8021. Output frames:
  8022. 2 1 2 2 2
  8023. 2 2 2 1 3
  8024. @end example
  8025. With top matching (@option{field}=@var{top}):
  8026. @example
  8027. Match: c p n b u
  8028. x x x x x
  8029. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8030. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8031. x x x x x
  8032. Output frames:
  8033. 2 2 2 1 2
  8034. 2 1 3 2 2
  8035. @end example
  8036. @subsection Examples
  8037. Simple IVTC of a top field first telecined stream:
  8038. @example
  8039. fieldmatch=order=tff:combmatch=none, decimate
  8040. @end example
  8041. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8042. @example
  8043. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8044. @end example
  8045. @section fieldorder
  8046. Transform the field order of the input video.
  8047. It accepts the following parameters:
  8048. @table @option
  8049. @item order
  8050. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8051. for bottom field first.
  8052. @end table
  8053. The default value is @samp{tff}.
  8054. The transformation is done by shifting the picture content up or down
  8055. by one line, and filling the remaining line with appropriate picture content.
  8056. This method is consistent with most broadcast field order converters.
  8057. If the input video is not flagged as being interlaced, or it is already
  8058. flagged as being of the required output field order, then this filter does
  8059. not alter the incoming video.
  8060. It is very useful when converting to or from PAL DV material,
  8061. which is bottom field first.
  8062. For example:
  8063. @example
  8064. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8065. @end example
  8066. @section fifo, afifo
  8067. Buffer input images and send them when they are requested.
  8068. It is mainly useful when auto-inserted by the libavfilter
  8069. framework.
  8070. It does not take parameters.
  8071. @section fillborders
  8072. Fill borders of the input video, without changing video stream dimensions.
  8073. Sometimes video can have garbage at the four edges and you may not want to
  8074. crop video input to keep size multiple of some number.
  8075. This filter accepts the following options:
  8076. @table @option
  8077. @item left
  8078. Number of pixels to fill from left border.
  8079. @item right
  8080. Number of pixels to fill from right border.
  8081. @item top
  8082. Number of pixels to fill from top border.
  8083. @item bottom
  8084. Number of pixels to fill from bottom border.
  8085. @item mode
  8086. Set fill mode.
  8087. It accepts the following values:
  8088. @table @samp
  8089. @item smear
  8090. fill pixels using outermost pixels
  8091. @item mirror
  8092. fill pixels using mirroring
  8093. @item fixed
  8094. fill pixels with constant value
  8095. @end table
  8096. Default is @var{smear}.
  8097. @item color
  8098. Set color for pixels in fixed mode. Default is @var{black}.
  8099. @end table
  8100. @section find_rect
  8101. Find a rectangular object
  8102. It accepts the following options:
  8103. @table @option
  8104. @item object
  8105. Filepath of the object image, needs to be in gray8.
  8106. @item threshold
  8107. Detection threshold, default is 0.5.
  8108. @item mipmaps
  8109. Number of mipmaps, default is 3.
  8110. @item xmin, ymin, xmax, ymax
  8111. Specifies the rectangle in which to search.
  8112. @end table
  8113. @subsection Examples
  8114. @itemize
  8115. @item
  8116. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8117. @example
  8118. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8119. @end example
  8120. @end itemize
  8121. @section floodfill
  8122. Flood area with values of same pixel components with another values.
  8123. It accepts the following options:
  8124. @table @option
  8125. @item x
  8126. Set pixel x coordinate.
  8127. @item y
  8128. Set pixel y coordinate.
  8129. @item s0
  8130. Set source #0 component value.
  8131. @item s1
  8132. Set source #1 component value.
  8133. @item s2
  8134. Set source #2 component value.
  8135. @item s3
  8136. Set source #3 component value.
  8137. @item d0
  8138. Set destination #0 component value.
  8139. @item d1
  8140. Set destination #1 component value.
  8141. @item d2
  8142. Set destination #2 component value.
  8143. @item d3
  8144. Set destination #3 component value.
  8145. @end table
  8146. @anchor{format}
  8147. @section format
  8148. Convert the input video to one of the specified pixel formats.
  8149. Libavfilter will try to pick one that is suitable as input to
  8150. the next filter.
  8151. It accepts the following parameters:
  8152. @table @option
  8153. @item pix_fmts
  8154. A '|'-separated list of pixel format names, such as
  8155. "pix_fmts=yuv420p|monow|rgb24".
  8156. @end table
  8157. @subsection Examples
  8158. @itemize
  8159. @item
  8160. Convert the input video to the @var{yuv420p} format
  8161. @example
  8162. format=pix_fmts=yuv420p
  8163. @end example
  8164. Convert the input video to any of the formats in the list
  8165. @example
  8166. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8167. @end example
  8168. @end itemize
  8169. @anchor{fps}
  8170. @section fps
  8171. Convert the video to specified constant frame rate by duplicating or dropping
  8172. frames as necessary.
  8173. It accepts the following parameters:
  8174. @table @option
  8175. @item fps
  8176. The desired output frame rate. The default is @code{25}.
  8177. @item start_time
  8178. Assume the first PTS should be the given value, in seconds. This allows for
  8179. padding/trimming at the start of stream. By default, no assumption is made
  8180. about the first frame's expected PTS, so no padding or trimming is done.
  8181. For example, this could be set to 0 to pad the beginning with duplicates of
  8182. the first frame if a video stream starts after the audio stream or to trim any
  8183. frames with a negative PTS.
  8184. @item round
  8185. Timestamp (PTS) rounding method.
  8186. Possible values are:
  8187. @table @option
  8188. @item zero
  8189. round towards 0
  8190. @item inf
  8191. round away from 0
  8192. @item down
  8193. round towards -infinity
  8194. @item up
  8195. round towards +infinity
  8196. @item near
  8197. round to nearest
  8198. @end table
  8199. The default is @code{near}.
  8200. @item eof_action
  8201. Action performed when reading the last frame.
  8202. Possible values are:
  8203. @table @option
  8204. @item round
  8205. Use same timestamp rounding method as used for other frames.
  8206. @item pass
  8207. Pass through last frame if input duration has not been reached yet.
  8208. @end table
  8209. The default is @code{round}.
  8210. @end table
  8211. Alternatively, the options can be specified as a flat string:
  8212. @var{fps}[:@var{start_time}[:@var{round}]].
  8213. See also the @ref{setpts} filter.
  8214. @subsection Examples
  8215. @itemize
  8216. @item
  8217. A typical usage in order to set the fps to 25:
  8218. @example
  8219. fps=fps=25
  8220. @end example
  8221. @item
  8222. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8223. @example
  8224. fps=fps=film:round=near
  8225. @end example
  8226. @end itemize
  8227. @section framepack
  8228. Pack two different video streams into a stereoscopic video, setting proper
  8229. metadata on supported codecs. The two views should have the same size and
  8230. framerate and processing will stop when the shorter video ends. Please note
  8231. that you may conveniently adjust view properties with the @ref{scale} and
  8232. @ref{fps} filters.
  8233. It accepts the following parameters:
  8234. @table @option
  8235. @item format
  8236. The desired packing format. Supported values are:
  8237. @table @option
  8238. @item sbs
  8239. The views are next to each other (default).
  8240. @item tab
  8241. The views are on top of each other.
  8242. @item lines
  8243. The views are packed by line.
  8244. @item columns
  8245. The views are packed by column.
  8246. @item frameseq
  8247. The views are temporally interleaved.
  8248. @end table
  8249. @end table
  8250. Some examples:
  8251. @example
  8252. # Convert left and right views into a frame-sequential video
  8253. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8254. # Convert views into a side-by-side video with the same output resolution as the input
  8255. 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
  8256. @end example
  8257. @section framerate
  8258. Change the frame rate by interpolating new video output frames from the source
  8259. frames.
  8260. This filter is not designed to function correctly with interlaced media. If
  8261. you wish to change the frame rate of interlaced media then you are required
  8262. to deinterlace before this filter and re-interlace after this filter.
  8263. A description of the accepted options follows.
  8264. @table @option
  8265. @item fps
  8266. Specify the output frames per second. This option can also be specified
  8267. as a value alone. The default is @code{50}.
  8268. @item interp_start
  8269. Specify the start of a range where the output frame will be created as a
  8270. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8271. the default is @code{15}.
  8272. @item interp_end
  8273. Specify the end of a range where the output frame will be created as a
  8274. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8275. the default is @code{240}.
  8276. @item scene
  8277. Specify the level at which a scene change is detected as a value between
  8278. 0 and 100 to indicate a new scene; a low value reflects a low
  8279. probability for the current frame to introduce a new scene, while a higher
  8280. value means the current frame is more likely to be one.
  8281. The default is @code{8.2}.
  8282. @item flags
  8283. Specify flags influencing the filter process.
  8284. Available value for @var{flags} is:
  8285. @table @option
  8286. @item scene_change_detect, scd
  8287. Enable scene change detection using the value of the option @var{scene}.
  8288. This flag is enabled by default.
  8289. @end table
  8290. @end table
  8291. @section framestep
  8292. Select one frame every N-th frame.
  8293. This filter accepts the following option:
  8294. @table @option
  8295. @item step
  8296. Select frame after every @code{step} frames.
  8297. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8298. @end table
  8299. @section freezedetect
  8300. Detect frozen video.
  8301. This filter logs a message and sets frame metadata when it detects that the
  8302. input video has no significant change in content during a specified duration.
  8303. Video freeze detection calculates the mean average absolute difference of all
  8304. the components of video frames and compares it to a noise floor.
  8305. The printed times and duration are expressed in seconds. The
  8306. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8307. whose timestamp equals or exceeds the detection duration and it contains the
  8308. timestamp of the first frame of the freeze. The
  8309. @code{lavfi.freezedetect.freeze_duration} and
  8310. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8311. after the freeze.
  8312. The filter accepts the following options:
  8313. @table @option
  8314. @item noise, n
  8315. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8316. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8317. 0.001.
  8318. @item duration, d
  8319. Set freeze duration until notification (default is 2 seconds).
  8320. @end table
  8321. @anchor{frei0r}
  8322. @section frei0r
  8323. Apply a frei0r effect to the input video.
  8324. To enable the compilation of this filter, you need to install the frei0r
  8325. header and configure FFmpeg with @code{--enable-frei0r}.
  8326. It accepts the following parameters:
  8327. @table @option
  8328. @item filter_name
  8329. The name of the frei0r effect to load. If the environment variable
  8330. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8331. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8332. Otherwise, the standard frei0r paths are searched, in this order:
  8333. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8334. @file{/usr/lib/frei0r-1/}.
  8335. @item filter_params
  8336. A '|'-separated list of parameters to pass to the frei0r effect.
  8337. @end table
  8338. A frei0r effect parameter can be a boolean (its value is either
  8339. "y" or "n"), a double, a color (specified as
  8340. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8341. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8342. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8343. a position (specified as @var{X}/@var{Y}, where
  8344. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8345. The number and types of parameters depend on the loaded effect. If an
  8346. effect parameter is not specified, the default value is set.
  8347. @subsection Examples
  8348. @itemize
  8349. @item
  8350. Apply the distort0r effect, setting the first two double parameters:
  8351. @example
  8352. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8353. @end example
  8354. @item
  8355. Apply the colordistance effect, taking a color as the first parameter:
  8356. @example
  8357. frei0r=colordistance:0.2/0.3/0.4
  8358. frei0r=colordistance:violet
  8359. frei0r=colordistance:0x112233
  8360. @end example
  8361. @item
  8362. Apply the perspective effect, specifying the top left and top right image
  8363. positions:
  8364. @example
  8365. frei0r=perspective:0.2/0.2|0.8/0.2
  8366. @end example
  8367. @end itemize
  8368. For more information, see
  8369. @url{http://frei0r.dyne.org}
  8370. @section fspp
  8371. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8372. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8373. processing filter, one of them is performed once per block, not per pixel.
  8374. This allows for much higher speed.
  8375. The filter accepts the following options:
  8376. @table @option
  8377. @item quality
  8378. Set quality. This option defines the number of levels for averaging. It accepts
  8379. an integer in the range 4-5. Default value is @code{4}.
  8380. @item qp
  8381. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8382. If not set, the filter will use the QP from the video stream (if available).
  8383. @item strength
  8384. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8385. more details but also more artifacts, while higher values make the image smoother
  8386. but also blurrier. Default value is @code{0} − PSNR optimal.
  8387. @item use_bframe_qp
  8388. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8389. option may cause flicker since the B-Frames have often larger QP. Default is
  8390. @code{0} (not enabled).
  8391. @end table
  8392. @section gblur
  8393. Apply Gaussian blur filter.
  8394. The filter accepts the following options:
  8395. @table @option
  8396. @item sigma
  8397. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8398. @item steps
  8399. Set number of steps for Gaussian approximation. Default is @code{1}.
  8400. @item planes
  8401. Set which planes to filter. By default all planes are filtered.
  8402. @item sigmaV
  8403. Set vertical sigma, if negative it will be same as @code{sigma}.
  8404. Default is @code{-1}.
  8405. @end table
  8406. @subsection Commands
  8407. This filter supports same commands as options.
  8408. The command accepts the same syntax of the corresponding option.
  8409. If the specified expression is not valid, it is kept at its current
  8410. value.
  8411. @section geq
  8412. Apply generic equation to each pixel.
  8413. The filter accepts the following options:
  8414. @table @option
  8415. @item lum_expr, lum
  8416. Set the luminance expression.
  8417. @item cb_expr, cb
  8418. Set the chrominance blue expression.
  8419. @item cr_expr, cr
  8420. Set the chrominance red expression.
  8421. @item alpha_expr, a
  8422. Set the alpha expression.
  8423. @item red_expr, r
  8424. Set the red expression.
  8425. @item green_expr, g
  8426. Set the green expression.
  8427. @item blue_expr, b
  8428. Set the blue expression.
  8429. @end table
  8430. The colorspace is selected according to the specified options. If one
  8431. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8432. options is specified, the filter will automatically select a YCbCr
  8433. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8434. @option{blue_expr} options is specified, it will select an RGB
  8435. colorspace.
  8436. If one of the chrominance expression is not defined, it falls back on the other
  8437. one. If no alpha expression is specified it will evaluate to opaque value.
  8438. If none of chrominance expressions are specified, they will evaluate
  8439. to the luminance expression.
  8440. The expressions can use the following variables and functions:
  8441. @table @option
  8442. @item N
  8443. The sequential number of the filtered frame, starting from @code{0}.
  8444. @item X
  8445. @item Y
  8446. The coordinates of the current sample.
  8447. @item W
  8448. @item H
  8449. The width and height of the image.
  8450. @item SW
  8451. @item SH
  8452. Width and height scale depending on the currently filtered plane. It is the
  8453. ratio between the corresponding luma plane number of pixels and the current
  8454. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8455. @code{0.5,0.5} for chroma planes.
  8456. @item T
  8457. Time of the current frame, expressed in seconds.
  8458. @item p(x, y)
  8459. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8460. plane.
  8461. @item lum(x, y)
  8462. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8463. plane.
  8464. @item cb(x, y)
  8465. Return the value of the pixel at location (@var{x},@var{y}) of the
  8466. blue-difference chroma plane. Return 0 if there is no such plane.
  8467. @item cr(x, y)
  8468. Return the value of the pixel at location (@var{x},@var{y}) of the
  8469. red-difference chroma plane. Return 0 if there is no such plane.
  8470. @item r(x, y)
  8471. @item g(x, y)
  8472. @item b(x, y)
  8473. Return the value of the pixel at location (@var{x},@var{y}) of the
  8474. red/green/blue component. Return 0 if there is no such component.
  8475. @item alpha(x, y)
  8476. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8477. plane. Return 0 if there is no such plane.
  8478. @item interpolation
  8479. Set one of interpolation methods:
  8480. @table @option
  8481. @item nearest, n
  8482. @item bilinear, b
  8483. @end table
  8484. Default is bilinear.
  8485. @end table
  8486. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8487. automatically clipped to the closer edge.
  8488. @subsection Examples
  8489. @itemize
  8490. @item
  8491. Flip the image horizontally:
  8492. @example
  8493. geq=p(W-X\,Y)
  8494. @end example
  8495. @item
  8496. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8497. wavelength of 100 pixels:
  8498. @example
  8499. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8500. @end example
  8501. @item
  8502. Generate a fancy enigmatic moving light:
  8503. @example
  8504. 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
  8505. @end example
  8506. @item
  8507. Generate a quick emboss effect:
  8508. @example
  8509. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8510. @end example
  8511. @item
  8512. Modify RGB components depending on pixel position:
  8513. @example
  8514. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8515. @end example
  8516. @item
  8517. Create a radial gradient that is the same size as the input (also see
  8518. the @ref{vignette} filter):
  8519. @example
  8520. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8521. @end example
  8522. @end itemize
  8523. @section gradfun
  8524. Fix the banding artifacts that are sometimes introduced into nearly flat
  8525. regions by truncation to 8-bit color depth.
  8526. Interpolate the gradients that should go where the bands are, and
  8527. dither them.
  8528. It is designed for playback only. Do not use it prior to
  8529. lossy compression, because compression tends to lose the dither and
  8530. bring back the bands.
  8531. It accepts the following parameters:
  8532. @table @option
  8533. @item strength
  8534. The maximum amount by which the filter will change any one pixel. This is also
  8535. the threshold for detecting nearly flat regions. Acceptable values range from
  8536. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8537. valid range.
  8538. @item radius
  8539. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8540. gradients, but also prevents the filter from modifying the pixels near detailed
  8541. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8542. values will be clipped to the valid range.
  8543. @end table
  8544. Alternatively, the options can be specified as a flat string:
  8545. @var{strength}[:@var{radius}]
  8546. @subsection Examples
  8547. @itemize
  8548. @item
  8549. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8550. @example
  8551. gradfun=3.5:8
  8552. @end example
  8553. @item
  8554. Specify radius, omitting the strength (which will fall-back to the default
  8555. value):
  8556. @example
  8557. gradfun=radius=8
  8558. @end example
  8559. @end itemize
  8560. @section graphmonitor, agraphmonitor
  8561. Show various filtergraph stats.
  8562. With this filter one can debug complete filtergraph.
  8563. Especially issues with links filling with queued frames.
  8564. The filter accepts the following options:
  8565. @table @option
  8566. @item size, s
  8567. Set video output size. Default is @var{hd720}.
  8568. @item opacity, o
  8569. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8570. @item mode, m
  8571. Set output mode, can be @var{fulll} or @var{compact}.
  8572. In @var{compact} mode only filters with some queued frames have displayed stats.
  8573. @item flags, f
  8574. Set flags which enable which stats are shown in video.
  8575. Available values for flags are:
  8576. @table @samp
  8577. @item queue
  8578. Display number of queued frames in each link.
  8579. @item frame_count_in
  8580. Display number of frames taken from filter.
  8581. @item frame_count_out
  8582. Display number of frames given out from filter.
  8583. @item pts
  8584. Display current filtered frame pts.
  8585. @item time
  8586. Display current filtered frame time.
  8587. @item timebase
  8588. Display time base for filter link.
  8589. @item format
  8590. Display used format for filter link.
  8591. @item size
  8592. Display video size or number of audio channels in case of audio used by filter link.
  8593. @item rate
  8594. Display video frame rate or sample rate in case of audio used by filter link.
  8595. @end table
  8596. @item rate, r
  8597. Set upper limit for video rate of output stream, Default value is @var{25}.
  8598. This guarantee that output video frame rate will not be higher than this value.
  8599. @end table
  8600. @section greyedge
  8601. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8602. and corrects the scene colors accordingly.
  8603. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8604. The filter accepts the following options:
  8605. @table @option
  8606. @item difford
  8607. The order of differentiation to be applied on the scene. Must be chosen in the range
  8608. [0,2] and default value is 1.
  8609. @item minknorm
  8610. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8611. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8612. max value instead of calculating Minkowski distance.
  8613. @item sigma
  8614. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8615. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8616. can't be equal to 0 if @var{difford} is greater than 0.
  8617. @end table
  8618. @subsection Examples
  8619. @itemize
  8620. @item
  8621. Grey Edge:
  8622. @example
  8623. greyedge=difford=1:minknorm=5:sigma=2
  8624. @end example
  8625. @item
  8626. Max Edge:
  8627. @example
  8628. greyedge=difford=1:minknorm=0:sigma=2
  8629. @end example
  8630. @end itemize
  8631. @anchor{haldclut}
  8632. @section haldclut
  8633. Apply a Hald CLUT to a video stream.
  8634. First input is the video stream to process, and second one is the Hald CLUT.
  8635. The Hald CLUT input can be a simple picture or a complete video stream.
  8636. The filter accepts the following options:
  8637. @table @option
  8638. @item shortest
  8639. Force termination when the shortest input terminates. Default is @code{0}.
  8640. @item repeatlast
  8641. Continue applying the last CLUT after the end of the stream. A value of
  8642. @code{0} disable the filter after the last frame of the CLUT is reached.
  8643. Default is @code{1}.
  8644. @end table
  8645. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8646. filters share the same internals).
  8647. This filter also supports the @ref{framesync} options.
  8648. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8649. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8650. @subsection Workflow examples
  8651. @subsubsection Hald CLUT video stream
  8652. Generate an identity Hald CLUT stream altered with various effects:
  8653. @example
  8654. 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
  8655. @end example
  8656. Note: make sure you use a lossless codec.
  8657. Then use it with @code{haldclut} to apply it on some random stream:
  8658. @example
  8659. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8660. @end example
  8661. The Hald CLUT will be applied to the 10 first seconds (duration of
  8662. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8663. to the remaining frames of the @code{mandelbrot} stream.
  8664. @subsubsection Hald CLUT with preview
  8665. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8666. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8667. biggest possible square starting at the top left of the picture. The remaining
  8668. padding pixels (bottom or right) will be ignored. This area can be used to add
  8669. a preview of the Hald CLUT.
  8670. Typically, the following generated Hald CLUT will be supported by the
  8671. @code{haldclut} filter:
  8672. @example
  8673. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8674. pad=iw+320 [padded_clut];
  8675. smptebars=s=320x256, split [a][b];
  8676. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8677. [main][b] overlay=W-320" -frames:v 1 clut.png
  8678. @end example
  8679. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8680. bars are displayed on the right-top, and below the same color bars processed by
  8681. the color changes.
  8682. Then, the effect of this Hald CLUT can be visualized with:
  8683. @example
  8684. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8685. @end example
  8686. @section hflip
  8687. Flip the input video horizontally.
  8688. For example, to horizontally flip the input video with @command{ffmpeg}:
  8689. @example
  8690. ffmpeg -i in.avi -vf "hflip" out.avi
  8691. @end example
  8692. @section histeq
  8693. This filter applies a global color histogram equalization on a
  8694. per-frame basis.
  8695. It can be used to correct video that has a compressed range of pixel
  8696. intensities. The filter redistributes the pixel intensities to
  8697. equalize their distribution across the intensity range. It may be
  8698. viewed as an "automatically adjusting contrast filter". This filter is
  8699. useful only for correcting degraded or poorly captured source
  8700. video.
  8701. The filter accepts the following options:
  8702. @table @option
  8703. @item strength
  8704. Determine the amount of equalization to be applied. As the strength
  8705. is reduced, the distribution of pixel intensities more-and-more
  8706. approaches that of the input frame. The value must be a float number
  8707. in the range [0,1] and defaults to 0.200.
  8708. @item intensity
  8709. Set the maximum intensity that can generated and scale the output
  8710. values appropriately. The strength should be set as desired and then
  8711. the intensity can be limited if needed to avoid washing-out. The value
  8712. must be a float number in the range [0,1] and defaults to 0.210.
  8713. @item antibanding
  8714. Set the antibanding level. If enabled the filter will randomly vary
  8715. the luminance of output pixels by a small amount to avoid banding of
  8716. the histogram. Possible values are @code{none}, @code{weak} or
  8717. @code{strong}. It defaults to @code{none}.
  8718. @end table
  8719. @section histogram
  8720. Compute and draw a color distribution histogram for the input video.
  8721. The computed histogram is a representation of the color component
  8722. distribution in an image.
  8723. Standard histogram displays the color components distribution in an image.
  8724. Displays color graph for each color component. Shows distribution of
  8725. the Y, U, V, A or R, G, B components, depending on input format, in the
  8726. current frame. Below each graph a color component scale meter is shown.
  8727. The filter accepts the following options:
  8728. @table @option
  8729. @item level_height
  8730. Set height of level. Default value is @code{200}.
  8731. Allowed range is [50, 2048].
  8732. @item scale_height
  8733. Set height of color scale. Default value is @code{12}.
  8734. Allowed range is [0, 40].
  8735. @item display_mode
  8736. Set display mode.
  8737. It accepts the following values:
  8738. @table @samp
  8739. @item stack
  8740. Per color component graphs are placed below each other.
  8741. @item parade
  8742. Per color component graphs are placed side by side.
  8743. @item overlay
  8744. Presents information identical to that in the @code{parade}, except
  8745. that the graphs representing color components are superimposed directly
  8746. over one another.
  8747. @end table
  8748. Default is @code{stack}.
  8749. @item levels_mode
  8750. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8751. Default is @code{linear}.
  8752. @item components
  8753. Set what color components to display.
  8754. Default is @code{7}.
  8755. @item fgopacity
  8756. Set foreground opacity. Default is @code{0.7}.
  8757. @item bgopacity
  8758. Set background opacity. Default is @code{0.5}.
  8759. @end table
  8760. @subsection Examples
  8761. @itemize
  8762. @item
  8763. Calculate and draw histogram:
  8764. @example
  8765. ffplay -i input -vf histogram
  8766. @end example
  8767. @end itemize
  8768. @anchor{hqdn3d}
  8769. @section hqdn3d
  8770. This is a high precision/quality 3d denoise filter. It aims to reduce
  8771. image noise, producing smooth images and making still images really
  8772. still. It should enhance compressibility.
  8773. It accepts the following optional parameters:
  8774. @table @option
  8775. @item luma_spatial
  8776. A non-negative floating point number which specifies spatial luma strength.
  8777. It defaults to 4.0.
  8778. @item chroma_spatial
  8779. A non-negative floating point number which specifies spatial chroma strength.
  8780. It defaults to 3.0*@var{luma_spatial}/4.0.
  8781. @item luma_tmp
  8782. A floating point number which specifies luma temporal strength. It defaults to
  8783. 6.0*@var{luma_spatial}/4.0.
  8784. @item chroma_tmp
  8785. A floating point number which specifies chroma temporal strength. It defaults to
  8786. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8787. @end table
  8788. @anchor{hwdownload}
  8789. @section hwdownload
  8790. Download hardware frames to system memory.
  8791. The input must be in hardware frames, and the output a non-hardware format.
  8792. Not all formats will be supported on the output - it may be necessary to insert
  8793. an additional @option{format} filter immediately following in the graph to get
  8794. the output in a supported format.
  8795. @section hwmap
  8796. Map hardware frames to system memory or to another device.
  8797. This filter has several different modes of operation; which one is used depends
  8798. on the input and output formats:
  8799. @itemize
  8800. @item
  8801. Hardware frame input, normal frame output
  8802. Map the input frames to system memory and pass them to the output. If the
  8803. original hardware frame is later required (for example, after overlaying
  8804. something else on part of it), the @option{hwmap} filter can be used again
  8805. in the next mode to retrieve it.
  8806. @item
  8807. Normal frame input, hardware frame output
  8808. If the input is actually a software-mapped hardware frame, then unmap it -
  8809. that is, return the original hardware frame.
  8810. Otherwise, a device must be provided. Create new hardware surfaces on that
  8811. device for the output, then map them back to the software format at the input
  8812. and give those frames to the preceding filter. This will then act like the
  8813. @option{hwupload} filter, but may be able to avoid an additional copy when
  8814. the input is already in a compatible format.
  8815. @item
  8816. Hardware frame input and output
  8817. A device must be supplied for the output, either directly or with the
  8818. @option{derive_device} option. The input and output devices must be of
  8819. different types and compatible - the exact meaning of this is
  8820. system-dependent, but typically it means that they must refer to the same
  8821. underlying hardware context (for example, refer to the same graphics card).
  8822. If the input frames were originally created on the output device, then unmap
  8823. to retrieve the original frames.
  8824. Otherwise, map the frames to the output device - create new hardware frames
  8825. on the output corresponding to the frames on the input.
  8826. @end itemize
  8827. The following additional parameters are accepted:
  8828. @table @option
  8829. @item mode
  8830. Set the frame mapping mode. Some combination of:
  8831. @table @var
  8832. @item read
  8833. The mapped frame should be readable.
  8834. @item write
  8835. The mapped frame should be writeable.
  8836. @item overwrite
  8837. The mapping will always overwrite the entire frame.
  8838. This may improve performance in some cases, as the original contents of the
  8839. frame need not be loaded.
  8840. @item direct
  8841. The mapping must not involve any copying.
  8842. Indirect mappings to copies of frames are created in some cases where either
  8843. direct mapping is not possible or it would have unexpected properties.
  8844. Setting this flag ensures that the mapping is direct and will fail if that is
  8845. not possible.
  8846. @end table
  8847. Defaults to @var{read+write} if not specified.
  8848. @item derive_device @var{type}
  8849. Rather than using the device supplied at initialisation, instead derive a new
  8850. device of type @var{type} from the device the input frames exist on.
  8851. @item reverse
  8852. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8853. and map them back to the source. This may be necessary in some cases where
  8854. a mapping in one direction is required but only the opposite direction is
  8855. supported by the devices being used.
  8856. This option is dangerous - it may break the preceding filter in undefined
  8857. ways if there are any additional constraints on that filter's output.
  8858. Do not use it without fully understanding the implications of its use.
  8859. @end table
  8860. @anchor{hwupload}
  8861. @section hwupload
  8862. Upload system memory frames to hardware surfaces.
  8863. The device to upload to must be supplied when the filter is initialised. If
  8864. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8865. option.
  8866. @anchor{hwupload_cuda}
  8867. @section hwupload_cuda
  8868. Upload system memory frames to a CUDA device.
  8869. It accepts the following optional parameters:
  8870. @table @option
  8871. @item device
  8872. The number of the CUDA device to use
  8873. @end table
  8874. @section hqx
  8875. Apply a high-quality magnification filter designed for pixel art. This filter
  8876. was originally created by Maxim Stepin.
  8877. It accepts the following option:
  8878. @table @option
  8879. @item n
  8880. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8881. @code{hq3x} and @code{4} for @code{hq4x}.
  8882. Default is @code{3}.
  8883. @end table
  8884. @section hstack
  8885. Stack input videos horizontally.
  8886. All streams must be of same pixel format and of same height.
  8887. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8888. to create same output.
  8889. The filter accepts the following option:
  8890. @table @option
  8891. @item inputs
  8892. Set number of input streams. Default is 2.
  8893. @item shortest
  8894. If set to 1, force the output to terminate when the shortest input
  8895. terminates. Default value is 0.
  8896. @end table
  8897. @section hue
  8898. Modify the hue and/or the saturation of the input.
  8899. It accepts the following parameters:
  8900. @table @option
  8901. @item h
  8902. Specify the hue angle as a number of degrees. It accepts an expression,
  8903. and defaults to "0".
  8904. @item s
  8905. Specify the saturation in the [-10,10] range. It accepts an expression and
  8906. defaults to "1".
  8907. @item H
  8908. Specify the hue angle as a number of radians. It accepts an
  8909. expression, and defaults to "0".
  8910. @item b
  8911. Specify the brightness in the [-10,10] range. It accepts an expression and
  8912. defaults to "0".
  8913. @end table
  8914. @option{h} and @option{H} are mutually exclusive, and can't be
  8915. specified at the same time.
  8916. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8917. expressions containing the following constants:
  8918. @table @option
  8919. @item n
  8920. frame count of the input frame starting from 0
  8921. @item pts
  8922. presentation timestamp of the input frame expressed in time base units
  8923. @item r
  8924. frame rate of the input video, NAN if the input frame rate is unknown
  8925. @item t
  8926. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8927. @item tb
  8928. time base of the input video
  8929. @end table
  8930. @subsection Examples
  8931. @itemize
  8932. @item
  8933. Set the hue to 90 degrees and the saturation to 1.0:
  8934. @example
  8935. hue=h=90:s=1
  8936. @end example
  8937. @item
  8938. Same command but expressing the hue in radians:
  8939. @example
  8940. hue=H=PI/2:s=1
  8941. @end example
  8942. @item
  8943. Rotate hue and make the saturation swing between 0
  8944. and 2 over a period of 1 second:
  8945. @example
  8946. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8947. @end example
  8948. @item
  8949. Apply a 3 seconds saturation fade-in effect starting at 0:
  8950. @example
  8951. hue="s=min(t/3\,1)"
  8952. @end example
  8953. The general fade-in expression can be written as:
  8954. @example
  8955. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8956. @end example
  8957. @item
  8958. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8959. @example
  8960. hue="s=max(0\, min(1\, (8-t)/3))"
  8961. @end example
  8962. The general fade-out expression can be written as:
  8963. @example
  8964. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8965. @end example
  8966. @end itemize
  8967. @subsection Commands
  8968. This filter supports the following commands:
  8969. @table @option
  8970. @item b
  8971. @item s
  8972. @item h
  8973. @item H
  8974. Modify the hue and/or the saturation and/or brightness of the input video.
  8975. The command accepts the same syntax of the corresponding option.
  8976. If the specified expression is not valid, it is kept at its current
  8977. value.
  8978. @end table
  8979. @section hysteresis
  8980. Grow first stream into second stream by connecting components.
  8981. This makes it possible to build more robust edge masks.
  8982. This filter accepts the following options:
  8983. @table @option
  8984. @item planes
  8985. Set which planes will be processed as bitmap, unprocessed planes will be
  8986. copied from first stream.
  8987. By default value 0xf, all planes will be processed.
  8988. @item threshold
  8989. Set threshold which is used in filtering. If pixel component value is higher than
  8990. this value filter algorithm for connecting components is activated.
  8991. By default value is 0.
  8992. @end table
  8993. @section idet
  8994. Detect video interlacing type.
  8995. This filter tries to detect if the input frames are interlaced, progressive,
  8996. top or bottom field first. It will also try to detect fields that are
  8997. repeated between adjacent frames (a sign of telecine).
  8998. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8999. Multiple frame detection incorporates the classification history of previous frames.
  9000. The filter will log these metadata values:
  9001. @table @option
  9002. @item single.current_frame
  9003. Detected type of current frame using single-frame detection. One of:
  9004. ``tff'' (top field first), ``bff'' (bottom field first),
  9005. ``progressive'', or ``undetermined''
  9006. @item single.tff
  9007. Cumulative number of frames detected as top field first using single-frame detection.
  9008. @item multiple.tff
  9009. Cumulative number of frames detected as top field first using multiple-frame detection.
  9010. @item single.bff
  9011. Cumulative number of frames detected as bottom field first using single-frame detection.
  9012. @item multiple.current_frame
  9013. Detected type of current frame using multiple-frame detection. One of:
  9014. ``tff'' (top field first), ``bff'' (bottom field first),
  9015. ``progressive'', or ``undetermined''
  9016. @item multiple.bff
  9017. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9018. @item single.progressive
  9019. Cumulative number of frames detected as progressive using single-frame detection.
  9020. @item multiple.progressive
  9021. Cumulative number of frames detected as progressive using multiple-frame detection.
  9022. @item single.undetermined
  9023. Cumulative number of frames that could not be classified using single-frame detection.
  9024. @item multiple.undetermined
  9025. Cumulative number of frames that could not be classified using multiple-frame detection.
  9026. @item repeated.current_frame
  9027. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9028. @item repeated.neither
  9029. Cumulative number of frames with no repeated field.
  9030. @item repeated.top
  9031. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9032. @item repeated.bottom
  9033. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9034. @end table
  9035. The filter accepts the following options:
  9036. @table @option
  9037. @item intl_thres
  9038. Set interlacing threshold.
  9039. @item prog_thres
  9040. Set progressive threshold.
  9041. @item rep_thres
  9042. Threshold for repeated field detection.
  9043. @item half_life
  9044. Number of frames after which a given frame's contribution to the
  9045. statistics is halved (i.e., it contributes only 0.5 to its
  9046. classification). The default of 0 means that all frames seen are given
  9047. full weight of 1.0 forever.
  9048. @item analyze_interlaced_flag
  9049. When this is not 0 then idet will use the specified number of frames to determine
  9050. if the interlaced flag is accurate, it will not count undetermined frames.
  9051. If the flag is found to be accurate it will be used without any further
  9052. computations, if it is found to be inaccurate it will be cleared without any
  9053. further computations. This allows inserting the idet filter as a low computational
  9054. method to clean up the interlaced flag
  9055. @end table
  9056. @section il
  9057. Deinterleave or interleave fields.
  9058. This filter allows one to process interlaced images fields without
  9059. deinterlacing them. Deinterleaving splits the input frame into 2
  9060. fields (so called half pictures). Odd lines are moved to the top
  9061. half of the output image, even lines to the bottom half.
  9062. You can process (filter) them independently and then re-interleave them.
  9063. The filter accepts the following options:
  9064. @table @option
  9065. @item luma_mode, l
  9066. @item chroma_mode, c
  9067. @item alpha_mode, a
  9068. Available values for @var{luma_mode}, @var{chroma_mode} and
  9069. @var{alpha_mode} are:
  9070. @table @samp
  9071. @item none
  9072. Do nothing.
  9073. @item deinterleave, d
  9074. Deinterleave fields, placing one above the other.
  9075. @item interleave, i
  9076. Interleave fields. Reverse the effect of deinterleaving.
  9077. @end table
  9078. Default value is @code{none}.
  9079. @item luma_swap, ls
  9080. @item chroma_swap, cs
  9081. @item alpha_swap, as
  9082. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9083. @end table
  9084. @section inflate
  9085. Apply inflate effect to the video.
  9086. This filter replaces the pixel by the local(3x3) average by taking into account
  9087. only values higher than the pixel.
  9088. It accepts the following options:
  9089. @table @option
  9090. @item threshold0
  9091. @item threshold1
  9092. @item threshold2
  9093. @item threshold3
  9094. Limit the maximum change for each plane, default is 65535.
  9095. If 0, plane will remain unchanged.
  9096. @end table
  9097. @section interlace
  9098. Simple interlacing filter from progressive contents. This interleaves upper (or
  9099. lower) lines from odd frames with lower (or upper) lines from even frames,
  9100. halving the frame rate and preserving image height.
  9101. @example
  9102. Original Original New Frame
  9103. Frame 'j' Frame 'j+1' (tff)
  9104. ========== =========== ==================
  9105. Line 0 --------------------> Frame 'j' Line 0
  9106. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9107. Line 2 ---------------------> Frame 'j' Line 2
  9108. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9109. ... ... ...
  9110. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9111. @end example
  9112. It accepts the following optional parameters:
  9113. @table @option
  9114. @item scan
  9115. This determines whether the interlaced frame is taken from the even
  9116. (tff - default) or odd (bff) lines of the progressive frame.
  9117. @item lowpass
  9118. Vertical lowpass filter to avoid twitter interlacing and
  9119. reduce moire patterns.
  9120. @table @samp
  9121. @item 0, off
  9122. Disable vertical lowpass filter
  9123. @item 1, linear
  9124. Enable linear filter (default)
  9125. @item 2, complex
  9126. Enable complex filter. This will slightly less reduce twitter and moire
  9127. but better retain detail and subjective sharpness impression.
  9128. @end table
  9129. @end table
  9130. @section kerndeint
  9131. Deinterlace input video by applying Donald Graft's adaptive kernel
  9132. deinterling. Work on interlaced parts of a video to produce
  9133. progressive frames.
  9134. The description of the accepted parameters follows.
  9135. @table @option
  9136. @item thresh
  9137. Set the threshold which affects the filter's tolerance when
  9138. determining if a pixel line must be processed. It must be an integer
  9139. in the range [0,255] and defaults to 10. A value of 0 will result in
  9140. applying the process on every pixels.
  9141. @item map
  9142. Paint pixels exceeding the threshold value to white if set to 1.
  9143. Default is 0.
  9144. @item order
  9145. Set the fields order. Swap fields if set to 1, leave fields alone if
  9146. 0. Default is 0.
  9147. @item sharp
  9148. Enable additional sharpening if set to 1. Default is 0.
  9149. @item twoway
  9150. Enable twoway sharpening if set to 1. Default is 0.
  9151. @end table
  9152. @subsection Examples
  9153. @itemize
  9154. @item
  9155. Apply default values:
  9156. @example
  9157. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9158. @end example
  9159. @item
  9160. Enable additional sharpening:
  9161. @example
  9162. kerndeint=sharp=1
  9163. @end example
  9164. @item
  9165. Paint processed pixels in white:
  9166. @example
  9167. kerndeint=map=1
  9168. @end example
  9169. @end itemize
  9170. @section lagfun
  9171. Slowly update darker pixels.
  9172. This filter makes short flashes of light appear longer.
  9173. This filter accepts the following options:
  9174. @table @option
  9175. @item decay
  9176. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9177. @item planes
  9178. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9179. @end table
  9180. @section lenscorrection
  9181. Correct radial lens distortion
  9182. This filter can be used to correct for radial distortion as can result from the use
  9183. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9184. one can use tools available for example as part of opencv or simply trial-and-error.
  9185. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9186. and extract the k1 and k2 coefficients from the resulting matrix.
  9187. Note that effectively the same filter is available in the open-source tools Krita and
  9188. Digikam from the KDE project.
  9189. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9190. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9191. brightness distribution, so you may want to use both filters together in certain
  9192. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9193. be applied before or after lens correction.
  9194. @subsection Options
  9195. The filter accepts the following options:
  9196. @table @option
  9197. @item cx
  9198. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9199. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9200. width. Default is 0.5.
  9201. @item cy
  9202. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9203. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9204. height. Default is 0.5.
  9205. @item k1
  9206. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9207. no correction. Default is 0.
  9208. @item k2
  9209. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9210. 0 means no correction. Default is 0.
  9211. @end table
  9212. The formula that generates the correction is:
  9213. @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)
  9214. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9215. distances from the focal point in the source and target images, respectively.
  9216. @section lensfun
  9217. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9218. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9219. to apply the lens correction. The filter will load the lensfun database and
  9220. query it to find the corresponding camera and lens entries in the database. As
  9221. long as these entries can be found with the given options, the filter can
  9222. perform corrections on frames. Note that incomplete strings will result in the
  9223. filter choosing the best match with the given options, and the filter will
  9224. output the chosen camera and lens models (logged with level "info"). You must
  9225. provide the make, camera model, and lens model as they are required.
  9226. The filter accepts the following options:
  9227. @table @option
  9228. @item make
  9229. The make of the camera (for example, "Canon"). This option is required.
  9230. @item model
  9231. The model of the camera (for example, "Canon EOS 100D"). This option is
  9232. required.
  9233. @item lens_model
  9234. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9235. option is required.
  9236. @item mode
  9237. The type of correction to apply. The following values are valid options:
  9238. @table @samp
  9239. @item vignetting
  9240. Enables fixing lens vignetting.
  9241. @item geometry
  9242. Enables fixing lens geometry. This is the default.
  9243. @item subpixel
  9244. Enables fixing chromatic aberrations.
  9245. @item vig_geo
  9246. Enables fixing lens vignetting and lens geometry.
  9247. @item vig_subpixel
  9248. Enables fixing lens vignetting and chromatic aberrations.
  9249. @item distortion
  9250. Enables fixing both lens geometry and chromatic aberrations.
  9251. @item all
  9252. Enables all possible corrections.
  9253. @end table
  9254. @item focal_length
  9255. The focal length of the image/video (zoom; expected constant for video). For
  9256. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9257. range should be chosen when using that lens. Default 18.
  9258. @item aperture
  9259. The aperture of the image/video (expected constant for video). Note that
  9260. aperture is only used for vignetting correction. Default 3.5.
  9261. @item focus_distance
  9262. The focus distance of the image/video (expected constant for video). Note that
  9263. focus distance is only used for vignetting and only slightly affects the
  9264. vignetting correction process. If unknown, leave it at the default value (which
  9265. is 1000).
  9266. @item scale
  9267. The scale factor which is applied after transformation. After correction the
  9268. video is no longer necessarily rectangular. This parameter controls how much of
  9269. the resulting image is visible. The value 0 means that a value will be chosen
  9270. automatically such that there is little or no unmapped area in the output
  9271. image. 1.0 means that no additional scaling is done. Lower values may result
  9272. in more of the corrected image being visible, while higher values may avoid
  9273. unmapped areas in the output.
  9274. @item target_geometry
  9275. The target geometry of the output image/video. The following values are valid
  9276. options:
  9277. @table @samp
  9278. @item rectilinear (default)
  9279. @item fisheye
  9280. @item panoramic
  9281. @item equirectangular
  9282. @item fisheye_orthographic
  9283. @item fisheye_stereographic
  9284. @item fisheye_equisolid
  9285. @item fisheye_thoby
  9286. @end table
  9287. @item reverse
  9288. Apply the reverse of image correction (instead of correcting distortion, apply
  9289. it).
  9290. @item interpolation
  9291. The type of interpolation used when correcting distortion. The following values
  9292. are valid options:
  9293. @table @samp
  9294. @item nearest
  9295. @item linear (default)
  9296. @item lanczos
  9297. @end table
  9298. @end table
  9299. @subsection Examples
  9300. @itemize
  9301. @item
  9302. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9303. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9304. aperture of "8.0".
  9305. @example
  9306. 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
  9307. @end example
  9308. @item
  9309. Apply the same as before, but only for the first 5 seconds of video.
  9310. @example
  9311. 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
  9312. @end example
  9313. @end itemize
  9314. @section libvmaf
  9315. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9316. score between two input videos.
  9317. The obtained VMAF score is printed through the logging system.
  9318. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9319. After installing the library it can be enabled using:
  9320. @code{./configure --enable-libvmaf --enable-version3}.
  9321. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9322. The filter has following options:
  9323. @table @option
  9324. @item model_path
  9325. Set the model path which is to be used for SVM.
  9326. Default value: @code{"vmaf_v0.6.1.pkl"}
  9327. @item log_path
  9328. Set the file path to be used to store logs.
  9329. @item log_fmt
  9330. Set the format of the log file (xml or json).
  9331. @item enable_transform
  9332. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9333. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9334. Default value: @code{false}
  9335. @item phone_model
  9336. Invokes the phone model which will generate VMAF scores higher than in the
  9337. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9338. @item psnr
  9339. Enables computing psnr along with vmaf.
  9340. @item ssim
  9341. Enables computing ssim along with vmaf.
  9342. @item ms_ssim
  9343. Enables computing ms_ssim along with vmaf.
  9344. @item pool
  9345. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  9346. @item n_threads
  9347. Set number of threads to be used when computing vmaf.
  9348. @item n_subsample
  9349. Set interval for frame subsampling used when computing vmaf.
  9350. @item enable_conf_interval
  9351. Enables confidence interval.
  9352. @end table
  9353. This filter also supports the @ref{framesync} options.
  9354. On the below examples the input file @file{main.mpg} being processed is
  9355. compared with the reference file @file{ref.mpg}.
  9356. @example
  9357. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9358. @end example
  9359. Example with options:
  9360. @example
  9361. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9362. @end example
  9363. @section limiter
  9364. Limits the pixel components values to the specified range [min, max].
  9365. The filter accepts the following options:
  9366. @table @option
  9367. @item min
  9368. Lower bound. Defaults to the lowest allowed value for the input.
  9369. @item max
  9370. Upper bound. Defaults to the highest allowed value for the input.
  9371. @item planes
  9372. Specify which planes will be processed. Defaults to all available.
  9373. @end table
  9374. @section loop
  9375. Loop video frames.
  9376. The filter accepts the following options:
  9377. @table @option
  9378. @item loop
  9379. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9380. Default is 0.
  9381. @item size
  9382. Set maximal size in number of frames. Default is 0.
  9383. @item start
  9384. Set first frame of loop. Default is 0.
  9385. @end table
  9386. @subsection Examples
  9387. @itemize
  9388. @item
  9389. Loop single first frame infinitely:
  9390. @example
  9391. loop=loop=-1:size=1:start=0
  9392. @end example
  9393. @item
  9394. Loop single first frame 10 times:
  9395. @example
  9396. loop=loop=10:size=1:start=0
  9397. @end example
  9398. @item
  9399. Loop 10 first frames 5 times:
  9400. @example
  9401. loop=loop=5:size=10:start=0
  9402. @end example
  9403. @end itemize
  9404. @section lut1d
  9405. Apply a 1D LUT to an input video.
  9406. The filter accepts the following options:
  9407. @table @option
  9408. @item file
  9409. Set the 1D LUT file name.
  9410. Currently supported formats:
  9411. @table @samp
  9412. @item cube
  9413. Iridas
  9414. @item csp
  9415. cineSpace
  9416. @end table
  9417. @item interp
  9418. Select interpolation mode.
  9419. Available values are:
  9420. @table @samp
  9421. @item nearest
  9422. Use values from the nearest defined point.
  9423. @item linear
  9424. Interpolate values using the linear interpolation.
  9425. @item cosine
  9426. Interpolate values using the cosine interpolation.
  9427. @item cubic
  9428. Interpolate values using the cubic interpolation.
  9429. @item spline
  9430. Interpolate values using the spline interpolation.
  9431. @end table
  9432. @end table
  9433. @anchor{lut3d}
  9434. @section lut3d
  9435. Apply a 3D LUT to an input video.
  9436. The filter accepts the following options:
  9437. @table @option
  9438. @item file
  9439. Set the 3D LUT file name.
  9440. Currently supported formats:
  9441. @table @samp
  9442. @item 3dl
  9443. AfterEffects
  9444. @item cube
  9445. Iridas
  9446. @item dat
  9447. DaVinci
  9448. @item m3d
  9449. Pandora
  9450. @item csp
  9451. cineSpace
  9452. @end table
  9453. @item interp
  9454. Select interpolation mode.
  9455. Available values are:
  9456. @table @samp
  9457. @item nearest
  9458. Use values from the nearest defined point.
  9459. @item trilinear
  9460. Interpolate values using the 8 points defining a cube.
  9461. @item tetrahedral
  9462. Interpolate values using a tetrahedron.
  9463. @end table
  9464. @end table
  9465. @section lumakey
  9466. Turn certain luma values into transparency.
  9467. The filter accepts the following options:
  9468. @table @option
  9469. @item threshold
  9470. Set the luma which will be used as base for transparency.
  9471. Default value is @code{0}.
  9472. @item tolerance
  9473. Set the range of luma values to be keyed out.
  9474. Default value is @code{0}.
  9475. @item softness
  9476. Set the range of softness. Default value is @code{0}.
  9477. Use this to control gradual transition from zero to full transparency.
  9478. @end table
  9479. @section lut, lutrgb, lutyuv
  9480. Compute a look-up table for binding each pixel component input value
  9481. to an output value, and apply it to the input video.
  9482. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9483. to an RGB input video.
  9484. These filters accept the following parameters:
  9485. @table @option
  9486. @item c0
  9487. set first pixel component expression
  9488. @item c1
  9489. set second pixel component expression
  9490. @item c2
  9491. set third pixel component expression
  9492. @item c3
  9493. set fourth pixel component expression, corresponds to the alpha component
  9494. @item r
  9495. set red component expression
  9496. @item g
  9497. set green component expression
  9498. @item b
  9499. set blue component expression
  9500. @item a
  9501. alpha component expression
  9502. @item y
  9503. set Y/luminance component expression
  9504. @item u
  9505. set U/Cb component expression
  9506. @item v
  9507. set V/Cr component expression
  9508. @end table
  9509. Each of them specifies the expression to use for computing the lookup table for
  9510. the corresponding pixel component values.
  9511. The exact component associated to each of the @var{c*} options depends on the
  9512. format in input.
  9513. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9514. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9515. The expressions can contain the following constants and functions:
  9516. @table @option
  9517. @item w
  9518. @item h
  9519. The input width and height.
  9520. @item val
  9521. The input value for the pixel component.
  9522. @item clipval
  9523. The input value, clipped to the @var{minval}-@var{maxval} range.
  9524. @item maxval
  9525. The maximum value for the pixel component.
  9526. @item minval
  9527. The minimum value for the pixel component.
  9528. @item negval
  9529. The negated value for the pixel component value, clipped to the
  9530. @var{minval}-@var{maxval} range; it corresponds to the expression
  9531. "maxval-clipval+minval".
  9532. @item clip(val)
  9533. The computed value in @var{val}, clipped to the
  9534. @var{minval}-@var{maxval} range.
  9535. @item gammaval(gamma)
  9536. The computed gamma correction value of the pixel component value,
  9537. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9538. expression
  9539. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9540. @end table
  9541. All expressions default to "val".
  9542. @subsection Examples
  9543. @itemize
  9544. @item
  9545. Negate input video:
  9546. @example
  9547. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9548. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9549. @end example
  9550. The above is the same as:
  9551. @example
  9552. lutrgb="r=negval:g=negval:b=negval"
  9553. lutyuv="y=negval:u=negval:v=negval"
  9554. @end example
  9555. @item
  9556. Negate luminance:
  9557. @example
  9558. lutyuv=y=negval
  9559. @end example
  9560. @item
  9561. Remove chroma components, turning the video into a graytone image:
  9562. @example
  9563. lutyuv="u=128:v=128"
  9564. @end example
  9565. @item
  9566. Apply a luma burning effect:
  9567. @example
  9568. lutyuv="y=2*val"
  9569. @end example
  9570. @item
  9571. Remove green and blue components:
  9572. @example
  9573. lutrgb="g=0:b=0"
  9574. @end example
  9575. @item
  9576. Set a constant alpha channel value on input:
  9577. @example
  9578. format=rgba,lutrgb=a="maxval-minval/2"
  9579. @end example
  9580. @item
  9581. Correct luminance gamma by a factor of 0.5:
  9582. @example
  9583. lutyuv=y=gammaval(0.5)
  9584. @end example
  9585. @item
  9586. Discard least significant bits of luma:
  9587. @example
  9588. lutyuv=y='bitand(val, 128+64+32)'
  9589. @end example
  9590. @item
  9591. Technicolor like effect:
  9592. @example
  9593. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9594. @end example
  9595. @end itemize
  9596. @section lut2, tlut2
  9597. The @code{lut2} filter takes two input streams and outputs one
  9598. stream.
  9599. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9600. from one single stream.
  9601. This filter accepts the following parameters:
  9602. @table @option
  9603. @item c0
  9604. set first pixel component expression
  9605. @item c1
  9606. set second pixel component expression
  9607. @item c2
  9608. set third pixel component expression
  9609. @item c3
  9610. set fourth pixel component expression, corresponds to the alpha component
  9611. @item d
  9612. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9613. which means bit depth is automatically picked from first input format.
  9614. @end table
  9615. Each of them specifies the expression to use for computing the lookup table for
  9616. the corresponding pixel component values.
  9617. The exact component associated to each of the @var{c*} options depends on the
  9618. format in inputs.
  9619. The expressions can contain the following constants:
  9620. @table @option
  9621. @item w
  9622. @item h
  9623. The input width and height.
  9624. @item x
  9625. The first input value for the pixel component.
  9626. @item y
  9627. The second input value for the pixel component.
  9628. @item bdx
  9629. The first input video bit depth.
  9630. @item bdy
  9631. The second input video bit depth.
  9632. @end table
  9633. All expressions default to "x".
  9634. @subsection Examples
  9635. @itemize
  9636. @item
  9637. Highlight differences between two RGB video streams:
  9638. @example
  9639. 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)'
  9640. @end example
  9641. @item
  9642. Highlight differences between two YUV video streams:
  9643. @example
  9644. 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)'
  9645. @end example
  9646. @item
  9647. Show max difference between two video streams:
  9648. @example
  9649. 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)))'
  9650. @end example
  9651. @end itemize
  9652. @section maskedclamp
  9653. Clamp the first input stream with the second input and third input stream.
  9654. Returns the value of first stream to be between second input
  9655. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9656. This filter accepts the following options:
  9657. @table @option
  9658. @item undershoot
  9659. Default value is @code{0}.
  9660. @item overshoot
  9661. Default value is @code{0}.
  9662. @item planes
  9663. Set which planes will be processed as bitmap, unprocessed planes will be
  9664. copied from first stream.
  9665. By default value 0xf, all planes will be processed.
  9666. @end table
  9667. @section maskedmerge
  9668. Merge the first input stream with the second input stream using per pixel
  9669. weights in the third input stream.
  9670. A value of 0 in the third stream pixel component means that pixel component
  9671. from first stream is returned unchanged, while maximum value (eg. 255 for
  9672. 8-bit videos) means that pixel component from second stream is returned
  9673. unchanged. Intermediate values define the amount of merging between both
  9674. input stream's pixel components.
  9675. This filter accepts the following options:
  9676. @table @option
  9677. @item planes
  9678. Set which planes will be processed as bitmap, unprocessed planes will be
  9679. copied from first stream.
  9680. By default value 0xf, all planes will be processed.
  9681. @end table
  9682. @section maskfun
  9683. Create mask from input video.
  9684. For example it is useful to create motion masks after @code{tblend} filter.
  9685. This filter accepts the following options:
  9686. @table @option
  9687. @item low
  9688. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9689. @item high
  9690. Set high threshold. Any pixel component higher than this value will be set to max value
  9691. allowed for current pixel format.
  9692. @item planes
  9693. Set planes to filter, by default all available planes are filtered.
  9694. @item fill
  9695. Fill all frame pixels with this value.
  9696. @item sum
  9697. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9698. average, output frame will be completely filled with value set by @var{fill} option.
  9699. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9700. @end table
  9701. @section mcdeint
  9702. Apply motion-compensation deinterlacing.
  9703. It needs one field per frame as input and must thus be used together
  9704. with yadif=1/3 or equivalent.
  9705. This filter accepts the following options:
  9706. @table @option
  9707. @item mode
  9708. Set the deinterlacing mode.
  9709. It accepts one of the following values:
  9710. @table @samp
  9711. @item fast
  9712. @item medium
  9713. @item slow
  9714. use iterative motion estimation
  9715. @item extra_slow
  9716. like @samp{slow}, but use multiple reference frames.
  9717. @end table
  9718. Default value is @samp{fast}.
  9719. @item parity
  9720. Set the picture field parity assumed for the input video. It must be
  9721. one of the following values:
  9722. @table @samp
  9723. @item 0, tff
  9724. assume top field first
  9725. @item 1, bff
  9726. assume bottom field first
  9727. @end table
  9728. Default value is @samp{bff}.
  9729. @item qp
  9730. Set per-block quantization parameter (QP) used by the internal
  9731. encoder.
  9732. Higher values should result in a smoother motion vector field but less
  9733. optimal individual vectors. Default value is 1.
  9734. @end table
  9735. @section mergeplanes
  9736. Merge color channel components from several video streams.
  9737. The filter accepts up to 4 input streams, and merge selected input
  9738. planes to the output video.
  9739. This filter accepts the following options:
  9740. @table @option
  9741. @item mapping
  9742. Set input to output plane mapping. Default is @code{0}.
  9743. The mappings is specified as a bitmap. It should be specified as a
  9744. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9745. mapping for the first plane of the output stream. 'A' sets the number of
  9746. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9747. corresponding input to use (from 0 to 3). The rest of the mappings is
  9748. similar, 'Bb' describes the mapping for the output stream second
  9749. plane, 'Cc' describes the mapping for the output stream third plane and
  9750. 'Dd' describes the mapping for the output stream fourth plane.
  9751. @item format
  9752. Set output pixel format. Default is @code{yuva444p}.
  9753. @end table
  9754. @subsection Examples
  9755. @itemize
  9756. @item
  9757. Merge three gray video streams of same width and height into single video stream:
  9758. @example
  9759. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9760. @end example
  9761. @item
  9762. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9763. @example
  9764. [a0][a1]mergeplanes=0x00010210:yuva444p
  9765. @end example
  9766. @item
  9767. Swap Y and A plane in yuva444p stream:
  9768. @example
  9769. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9770. @end example
  9771. @item
  9772. Swap U and V plane in yuv420p stream:
  9773. @example
  9774. format=yuv420p,mergeplanes=0x000201:yuv420p
  9775. @end example
  9776. @item
  9777. Cast a rgb24 clip to yuv444p:
  9778. @example
  9779. format=rgb24,mergeplanes=0x000102:yuv444p
  9780. @end example
  9781. @end itemize
  9782. @section mestimate
  9783. Estimate and export motion vectors using block matching algorithms.
  9784. Motion vectors are stored in frame side data to be used by other filters.
  9785. This filter accepts the following options:
  9786. @table @option
  9787. @item method
  9788. Specify the motion estimation method. Accepts one of the following values:
  9789. @table @samp
  9790. @item esa
  9791. Exhaustive search algorithm.
  9792. @item tss
  9793. Three step search algorithm.
  9794. @item tdls
  9795. Two dimensional logarithmic search algorithm.
  9796. @item ntss
  9797. New three step search algorithm.
  9798. @item fss
  9799. Four step search algorithm.
  9800. @item ds
  9801. Diamond search algorithm.
  9802. @item hexbs
  9803. Hexagon-based search algorithm.
  9804. @item epzs
  9805. Enhanced predictive zonal search algorithm.
  9806. @item umh
  9807. Uneven multi-hexagon search algorithm.
  9808. @end table
  9809. Default value is @samp{esa}.
  9810. @item mb_size
  9811. Macroblock size. Default @code{16}.
  9812. @item search_param
  9813. Search parameter. Default @code{7}.
  9814. @end table
  9815. @section midequalizer
  9816. Apply Midway Image Equalization effect using two video streams.
  9817. Midway Image Equalization adjusts a pair of images to have the same
  9818. histogram, while maintaining their dynamics as much as possible. It's
  9819. useful for e.g. matching exposures from a pair of stereo cameras.
  9820. This filter has two inputs and one output, which must be of same pixel format, but
  9821. may be of different sizes. The output of filter is first input adjusted with
  9822. midway histogram of both inputs.
  9823. This filter accepts the following option:
  9824. @table @option
  9825. @item planes
  9826. Set which planes to process. Default is @code{15}, which is all available planes.
  9827. @end table
  9828. @section minterpolate
  9829. Convert the video to specified frame rate using motion interpolation.
  9830. This filter accepts the following options:
  9831. @table @option
  9832. @item fps
  9833. 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}.
  9834. @item mi_mode
  9835. Motion interpolation mode. Following values are accepted:
  9836. @table @samp
  9837. @item dup
  9838. Duplicate previous or next frame for interpolating new ones.
  9839. @item blend
  9840. Blend source frames. Interpolated frame is mean of previous and next frames.
  9841. @item mci
  9842. Motion compensated interpolation. Following options are effective when this mode is selected:
  9843. @table @samp
  9844. @item mc_mode
  9845. Motion compensation mode. Following values are accepted:
  9846. @table @samp
  9847. @item obmc
  9848. Overlapped block motion compensation.
  9849. @item aobmc
  9850. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9851. @end table
  9852. Default mode is @samp{obmc}.
  9853. @item me_mode
  9854. Motion estimation mode. Following values are accepted:
  9855. @table @samp
  9856. @item bidir
  9857. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9858. @item bilat
  9859. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9860. @end table
  9861. Default mode is @samp{bilat}.
  9862. @item me
  9863. The algorithm to be used for motion estimation. Following values are accepted:
  9864. @table @samp
  9865. @item esa
  9866. Exhaustive search algorithm.
  9867. @item tss
  9868. Three step search algorithm.
  9869. @item tdls
  9870. Two dimensional logarithmic search algorithm.
  9871. @item ntss
  9872. New three step search algorithm.
  9873. @item fss
  9874. Four step search algorithm.
  9875. @item ds
  9876. Diamond search algorithm.
  9877. @item hexbs
  9878. Hexagon-based search algorithm.
  9879. @item epzs
  9880. Enhanced predictive zonal search algorithm.
  9881. @item umh
  9882. Uneven multi-hexagon search algorithm.
  9883. @end table
  9884. Default algorithm is @samp{epzs}.
  9885. @item mb_size
  9886. Macroblock size. Default @code{16}.
  9887. @item search_param
  9888. Motion estimation search parameter. Default @code{32}.
  9889. @item vsbmc
  9890. 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).
  9891. @end table
  9892. @end table
  9893. @item scd
  9894. 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:
  9895. @table @samp
  9896. @item none
  9897. Disable scene change detection.
  9898. @item fdiff
  9899. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9900. @end table
  9901. Default method is @samp{fdiff}.
  9902. @item scd_threshold
  9903. Scene change detection threshold. Default is @code{5.0}.
  9904. @end table
  9905. @section mix
  9906. Mix several video input streams into one video stream.
  9907. A description of the accepted options follows.
  9908. @table @option
  9909. @item nb_inputs
  9910. The number of inputs. If unspecified, it defaults to 2.
  9911. @item weights
  9912. Specify weight of each input video stream as sequence.
  9913. Each weight is separated by space. If number of weights
  9914. is smaller than number of @var{frames} last specified
  9915. weight will be used for all remaining unset weights.
  9916. @item scale
  9917. Specify scale, if it is set it will be multiplied with sum
  9918. of each weight multiplied with pixel values to give final destination
  9919. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9920. @item duration
  9921. Specify how end of stream is determined.
  9922. @table @samp
  9923. @item longest
  9924. The duration of the longest input. (default)
  9925. @item shortest
  9926. The duration of the shortest input.
  9927. @item first
  9928. The duration of the first input.
  9929. @end table
  9930. @end table
  9931. @section mpdecimate
  9932. Drop frames that do not differ greatly from the previous frame in
  9933. order to reduce frame rate.
  9934. The main use of this filter is for very-low-bitrate encoding
  9935. (e.g. streaming over dialup modem), but it could in theory be used for
  9936. fixing movies that were inverse-telecined incorrectly.
  9937. A description of the accepted options follows.
  9938. @table @option
  9939. @item max
  9940. Set the maximum number of consecutive frames which can be dropped (if
  9941. positive), or the minimum interval between dropped frames (if
  9942. negative). If the value is 0, the frame is dropped disregarding the
  9943. number of previous sequentially dropped frames.
  9944. Default value is 0.
  9945. @item hi
  9946. @item lo
  9947. @item frac
  9948. Set the dropping threshold values.
  9949. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9950. represent actual pixel value differences, so a threshold of 64
  9951. corresponds to 1 unit of difference for each pixel, or the same spread
  9952. out differently over the block.
  9953. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9954. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9955. meaning the whole image) differ by more than a threshold of @option{lo}.
  9956. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9957. 64*5, and default value for @option{frac} is 0.33.
  9958. @end table
  9959. @section negate
  9960. Negate (invert) the input video.
  9961. It accepts the following option:
  9962. @table @option
  9963. @item negate_alpha
  9964. With value 1, it negates the alpha component, if present. Default value is 0.
  9965. @end table
  9966. @anchor{nlmeans}
  9967. @section nlmeans
  9968. Denoise frames using Non-Local Means algorithm.
  9969. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9970. context similarity is defined by comparing their surrounding patches of size
  9971. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9972. around the pixel.
  9973. Note that the research area defines centers for patches, which means some
  9974. patches will be made of pixels outside that research area.
  9975. The filter accepts the following options.
  9976. @table @option
  9977. @item s
  9978. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9979. @item p
  9980. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9981. @item pc
  9982. Same as @option{p} but for chroma planes.
  9983. The default value is @var{0} and means automatic.
  9984. @item r
  9985. Set research size. Default is 15. Must be odd number in range [0, 99].
  9986. @item rc
  9987. Same as @option{r} but for chroma planes.
  9988. The default value is @var{0} and means automatic.
  9989. @end table
  9990. @section nnedi
  9991. Deinterlace video using neural network edge directed interpolation.
  9992. This filter accepts the following options:
  9993. @table @option
  9994. @item weights
  9995. Mandatory option, without binary file filter can not work.
  9996. Currently file can be found here:
  9997. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9998. @item deint
  9999. Set which frames to deinterlace, by default it is @code{all}.
  10000. Can be @code{all} or @code{interlaced}.
  10001. @item field
  10002. Set mode of operation.
  10003. Can be one of the following:
  10004. @table @samp
  10005. @item af
  10006. Use frame flags, both fields.
  10007. @item a
  10008. Use frame flags, single field.
  10009. @item t
  10010. Use top field only.
  10011. @item b
  10012. Use bottom field only.
  10013. @item tf
  10014. Use both fields, top first.
  10015. @item bf
  10016. Use both fields, bottom first.
  10017. @end table
  10018. @item planes
  10019. Set which planes to process, by default filter process all frames.
  10020. @item nsize
  10021. Set size of local neighborhood around each pixel, used by the predictor neural
  10022. network.
  10023. Can be one of the following:
  10024. @table @samp
  10025. @item s8x6
  10026. @item s16x6
  10027. @item s32x6
  10028. @item s48x6
  10029. @item s8x4
  10030. @item s16x4
  10031. @item s32x4
  10032. @end table
  10033. @item nns
  10034. Set the number of neurons in predictor neural network.
  10035. Can be one of the following:
  10036. @table @samp
  10037. @item n16
  10038. @item n32
  10039. @item n64
  10040. @item n128
  10041. @item n256
  10042. @end table
  10043. @item qual
  10044. Controls the number of different neural network predictions that are blended
  10045. together to compute the final output value. Can be @code{fast}, default or
  10046. @code{slow}.
  10047. @item etype
  10048. Set which set of weights to use in the predictor.
  10049. Can be one of the following:
  10050. @table @samp
  10051. @item a
  10052. weights trained to minimize absolute error
  10053. @item s
  10054. weights trained to minimize squared error
  10055. @end table
  10056. @item pscrn
  10057. Controls whether or not the prescreener neural network is used to decide
  10058. which pixels should be processed by the predictor neural network and which
  10059. can be handled by simple cubic interpolation.
  10060. The prescreener is trained to know whether cubic interpolation will be
  10061. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10062. The computational complexity of the prescreener nn is much less than that of
  10063. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10064. using the prescreener generally results in much faster processing.
  10065. The prescreener is pretty accurate, so the difference between using it and not
  10066. using it is almost always unnoticeable.
  10067. Can be one of the following:
  10068. @table @samp
  10069. @item none
  10070. @item original
  10071. @item new
  10072. @end table
  10073. Default is @code{new}.
  10074. @item fapprox
  10075. Set various debugging flags.
  10076. @end table
  10077. @section noformat
  10078. Force libavfilter not to use any of the specified pixel formats for the
  10079. input to the next filter.
  10080. It accepts the following parameters:
  10081. @table @option
  10082. @item pix_fmts
  10083. A '|'-separated list of pixel format names, such as
  10084. pix_fmts=yuv420p|monow|rgb24".
  10085. @end table
  10086. @subsection Examples
  10087. @itemize
  10088. @item
  10089. Force libavfilter to use a format different from @var{yuv420p} for the
  10090. input to the vflip filter:
  10091. @example
  10092. noformat=pix_fmts=yuv420p,vflip
  10093. @end example
  10094. @item
  10095. Convert the input video to any of the formats not contained in the list:
  10096. @example
  10097. noformat=yuv420p|yuv444p|yuv410p
  10098. @end example
  10099. @end itemize
  10100. @section noise
  10101. Add noise on video input frame.
  10102. The filter accepts the following options:
  10103. @table @option
  10104. @item all_seed
  10105. @item c0_seed
  10106. @item c1_seed
  10107. @item c2_seed
  10108. @item c3_seed
  10109. Set noise seed for specific pixel component or all pixel components in case
  10110. of @var{all_seed}. Default value is @code{123457}.
  10111. @item all_strength, alls
  10112. @item c0_strength, c0s
  10113. @item c1_strength, c1s
  10114. @item c2_strength, c2s
  10115. @item c3_strength, c3s
  10116. Set noise strength for specific pixel component or all pixel components in case
  10117. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10118. @item all_flags, allf
  10119. @item c0_flags, c0f
  10120. @item c1_flags, c1f
  10121. @item c2_flags, c2f
  10122. @item c3_flags, c3f
  10123. Set pixel component flags or set flags for all components if @var{all_flags}.
  10124. Available values for component flags are:
  10125. @table @samp
  10126. @item a
  10127. averaged temporal noise (smoother)
  10128. @item p
  10129. mix random noise with a (semi)regular pattern
  10130. @item t
  10131. temporal noise (noise pattern changes between frames)
  10132. @item u
  10133. uniform noise (gaussian otherwise)
  10134. @end table
  10135. @end table
  10136. @subsection Examples
  10137. Add temporal and uniform noise to input video:
  10138. @example
  10139. noise=alls=20:allf=t+u
  10140. @end example
  10141. @section normalize
  10142. Normalize RGB video (aka histogram stretching, contrast stretching).
  10143. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10144. For each channel of each frame, the filter computes the input range and maps
  10145. it linearly to the user-specified output range. The output range defaults
  10146. to the full dynamic range from pure black to pure white.
  10147. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10148. changes in brightness) caused when small dark or bright objects enter or leave
  10149. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10150. video camera, and, like a video camera, it may cause a period of over- or
  10151. under-exposure of the video.
  10152. The R,G,B channels can be normalized independently, which may cause some
  10153. color shifting, or linked together as a single channel, which prevents
  10154. color shifting. Linked normalization preserves hue. Independent normalization
  10155. does not, so it can be used to remove some color casts. Independent and linked
  10156. normalization can be combined in any ratio.
  10157. The normalize filter accepts the following options:
  10158. @table @option
  10159. @item blackpt
  10160. @item whitept
  10161. Colors which define the output range. The minimum input value is mapped to
  10162. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10163. The defaults are black and white respectively. Specifying white for
  10164. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10165. normalized video. Shades of grey can be used to reduce the dynamic range
  10166. (contrast). Specifying saturated colors here can create some interesting
  10167. effects.
  10168. @item smoothing
  10169. The number of previous frames to use for temporal smoothing. The input range
  10170. of each channel is smoothed using a rolling average over the current frame
  10171. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10172. smoothing).
  10173. @item independence
  10174. Controls the ratio of independent (color shifting) channel normalization to
  10175. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10176. independent. Defaults to 1.0 (fully independent).
  10177. @item strength
  10178. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10179. expensive no-op. Defaults to 1.0 (full strength).
  10180. @end table
  10181. @subsection Examples
  10182. Stretch video contrast to use the full dynamic range, with no temporal
  10183. smoothing; may flicker depending on the source content:
  10184. @example
  10185. normalize=blackpt=black:whitept=white:smoothing=0
  10186. @end example
  10187. As above, but with 50 frames of temporal smoothing; flicker should be
  10188. reduced, depending on the source content:
  10189. @example
  10190. normalize=blackpt=black:whitept=white:smoothing=50
  10191. @end example
  10192. As above, but with hue-preserving linked channel normalization:
  10193. @example
  10194. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10195. @end example
  10196. As above, but with half strength:
  10197. @example
  10198. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10199. @end example
  10200. Map the darkest input color to red, the brightest input color to cyan:
  10201. @example
  10202. normalize=blackpt=red:whitept=cyan
  10203. @end example
  10204. @section null
  10205. Pass the video source unchanged to the output.
  10206. @section ocr
  10207. Optical Character Recognition
  10208. This filter uses Tesseract for optical character recognition. To enable
  10209. compilation of this filter, you need to configure FFmpeg with
  10210. @code{--enable-libtesseract}.
  10211. It accepts the following options:
  10212. @table @option
  10213. @item datapath
  10214. Set datapath to tesseract data. Default is to use whatever was
  10215. set at installation.
  10216. @item language
  10217. Set language, default is "eng".
  10218. @item whitelist
  10219. Set character whitelist.
  10220. @item blacklist
  10221. Set character blacklist.
  10222. @end table
  10223. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10224. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10225. @section ocv
  10226. Apply a video transform using libopencv.
  10227. To enable this filter, install the libopencv library and headers and
  10228. configure FFmpeg with @code{--enable-libopencv}.
  10229. It accepts the following parameters:
  10230. @table @option
  10231. @item filter_name
  10232. The name of the libopencv filter to apply.
  10233. @item filter_params
  10234. The parameters to pass to the libopencv filter. If not specified, the default
  10235. values are assumed.
  10236. @end table
  10237. Refer to the official libopencv documentation for more precise
  10238. information:
  10239. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10240. Several libopencv filters are supported; see the following subsections.
  10241. @anchor{dilate}
  10242. @subsection dilate
  10243. Dilate an image by using a specific structuring element.
  10244. It corresponds to the libopencv function @code{cvDilate}.
  10245. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10246. @var{struct_el} represents a structuring element, and has the syntax:
  10247. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10248. @var{cols} and @var{rows} represent the number of columns and rows of
  10249. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10250. point, and @var{shape} the shape for the structuring element. @var{shape}
  10251. must be "rect", "cross", "ellipse", or "custom".
  10252. If the value for @var{shape} is "custom", it must be followed by a
  10253. string of the form "=@var{filename}". The file with name
  10254. @var{filename} is assumed to represent a binary image, with each
  10255. printable character corresponding to a bright pixel. When a custom
  10256. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10257. or columns and rows of the read file are assumed instead.
  10258. The default value for @var{struct_el} is "3x3+0x0/rect".
  10259. @var{nb_iterations} specifies the number of times the transform is
  10260. applied to the image, and defaults to 1.
  10261. Some examples:
  10262. @example
  10263. # Use the default values
  10264. ocv=dilate
  10265. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10266. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10267. # Read the shape from the file diamond.shape, iterating two times.
  10268. # The file diamond.shape may contain a pattern of characters like this
  10269. # *
  10270. # ***
  10271. # *****
  10272. # ***
  10273. # *
  10274. # The specified columns and rows are ignored
  10275. # but the anchor point coordinates are not
  10276. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10277. @end example
  10278. @subsection erode
  10279. Erode an image by using a specific structuring element.
  10280. It corresponds to the libopencv function @code{cvErode}.
  10281. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10282. with the same syntax and semantics as the @ref{dilate} filter.
  10283. @subsection smooth
  10284. Smooth the input video.
  10285. The filter takes the following parameters:
  10286. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10287. @var{type} is the type of smooth filter to apply, and must be one of
  10288. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10289. or "bilateral". The default value is "gaussian".
  10290. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10291. depends on the smooth type. @var{param1} and
  10292. @var{param2} accept integer positive values or 0. @var{param3} and
  10293. @var{param4} accept floating point values.
  10294. The default value for @var{param1} is 3. The default value for the
  10295. other parameters is 0.
  10296. These parameters correspond to the parameters assigned to the
  10297. libopencv function @code{cvSmooth}.
  10298. @section oscilloscope
  10299. 2D Video Oscilloscope.
  10300. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10301. It accepts the following parameters:
  10302. @table @option
  10303. @item x
  10304. Set scope center x position.
  10305. @item y
  10306. Set scope center y position.
  10307. @item s
  10308. Set scope size, relative to frame diagonal.
  10309. @item t
  10310. Set scope tilt/rotation.
  10311. @item o
  10312. Set trace opacity.
  10313. @item tx
  10314. Set trace center x position.
  10315. @item ty
  10316. Set trace center y position.
  10317. @item tw
  10318. Set trace width, relative to width of frame.
  10319. @item th
  10320. Set trace height, relative to height of frame.
  10321. @item c
  10322. Set which components to trace. By default it traces first three components.
  10323. @item g
  10324. Draw trace grid. By default is enabled.
  10325. @item st
  10326. Draw some statistics. By default is enabled.
  10327. @item sc
  10328. Draw scope. By default is enabled.
  10329. @end table
  10330. @subsection Examples
  10331. @itemize
  10332. @item
  10333. Inspect full first row of video frame.
  10334. @example
  10335. oscilloscope=x=0.5:y=0:s=1
  10336. @end example
  10337. @item
  10338. Inspect full last row of video frame.
  10339. @example
  10340. oscilloscope=x=0.5:y=1:s=1
  10341. @end example
  10342. @item
  10343. Inspect full 5th line of video frame of height 1080.
  10344. @example
  10345. oscilloscope=x=0.5:y=5/1080:s=1
  10346. @end example
  10347. @item
  10348. Inspect full last column of video frame.
  10349. @example
  10350. oscilloscope=x=1:y=0.5:s=1:t=1
  10351. @end example
  10352. @end itemize
  10353. @anchor{overlay}
  10354. @section overlay
  10355. Overlay one video on top of another.
  10356. It takes two inputs and has one output. The first input is the "main"
  10357. video on which the second input is overlaid.
  10358. It accepts the following parameters:
  10359. A description of the accepted options follows.
  10360. @table @option
  10361. @item x
  10362. @item y
  10363. Set the expression for the x and y coordinates of the overlaid video
  10364. on the main video. Default value is "0" for both expressions. In case
  10365. the expression is invalid, it is set to a huge value (meaning that the
  10366. overlay will not be displayed within the output visible area).
  10367. @item eof_action
  10368. See @ref{framesync}.
  10369. @item eval
  10370. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10371. It accepts the following values:
  10372. @table @samp
  10373. @item init
  10374. only evaluate expressions once during the filter initialization or
  10375. when a command is processed
  10376. @item frame
  10377. evaluate expressions for each incoming frame
  10378. @end table
  10379. Default value is @samp{frame}.
  10380. @item shortest
  10381. See @ref{framesync}.
  10382. @item format
  10383. Set the format for the output video.
  10384. It accepts the following values:
  10385. @table @samp
  10386. @item yuv420
  10387. force YUV420 output
  10388. @item yuv422
  10389. force YUV422 output
  10390. @item yuv444
  10391. force YUV444 output
  10392. @item rgb
  10393. force packed RGB output
  10394. @item gbrp
  10395. force planar RGB output
  10396. @item auto
  10397. automatically pick format
  10398. @end table
  10399. Default value is @samp{yuv420}.
  10400. @item repeatlast
  10401. See @ref{framesync}.
  10402. @item alpha
  10403. Set format of alpha of the overlaid video, it can be @var{straight} or
  10404. @var{premultiplied}. Default is @var{straight}.
  10405. @end table
  10406. The @option{x}, and @option{y} expressions can contain the following
  10407. parameters.
  10408. @table @option
  10409. @item main_w, W
  10410. @item main_h, H
  10411. The main input width and height.
  10412. @item overlay_w, w
  10413. @item overlay_h, h
  10414. The overlay input width and height.
  10415. @item x
  10416. @item y
  10417. The computed values for @var{x} and @var{y}. They are evaluated for
  10418. each new frame.
  10419. @item hsub
  10420. @item vsub
  10421. horizontal and vertical chroma subsample values of the output
  10422. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10423. @var{vsub} is 1.
  10424. @item n
  10425. the number of input frame, starting from 0
  10426. @item pos
  10427. the position in the file of the input frame, NAN if unknown
  10428. @item t
  10429. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10430. @end table
  10431. This filter also supports the @ref{framesync} options.
  10432. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10433. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10434. when @option{eval} is set to @samp{init}.
  10435. Be aware that frames are taken from each input video in timestamp
  10436. order, hence, if their initial timestamps differ, it is a good idea
  10437. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10438. have them begin in the same zero timestamp, as the example for
  10439. the @var{movie} filter does.
  10440. You can chain together more overlays but you should test the
  10441. efficiency of such approach.
  10442. @subsection Commands
  10443. This filter supports the following commands:
  10444. @table @option
  10445. @item x
  10446. @item y
  10447. Modify the x and y of the overlay input.
  10448. The command accepts the same syntax of the corresponding option.
  10449. If the specified expression is not valid, it is kept at its current
  10450. value.
  10451. @end table
  10452. @subsection Examples
  10453. @itemize
  10454. @item
  10455. Draw the overlay at 10 pixels from the bottom right corner of the main
  10456. video:
  10457. @example
  10458. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10459. @end example
  10460. Using named options the example above becomes:
  10461. @example
  10462. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10463. @end example
  10464. @item
  10465. Insert a transparent PNG logo in the bottom left corner of the input,
  10466. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10467. @example
  10468. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10469. @end example
  10470. @item
  10471. Insert 2 different transparent PNG logos (second logo on bottom
  10472. right corner) using the @command{ffmpeg} tool:
  10473. @example
  10474. 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
  10475. @end example
  10476. @item
  10477. Add a transparent color layer on top of the main video; @code{WxH}
  10478. must specify the size of the main input to the overlay filter:
  10479. @example
  10480. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10481. @end example
  10482. @item
  10483. Play an original video and a filtered version (here with the deshake
  10484. filter) side by side using the @command{ffplay} tool:
  10485. @example
  10486. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10487. @end example
  10488. The above command is the same as:
  10489. @example
  10490. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10491. @end example
  10492. @item
  10493. Make a sliding overlay appearing from the left to the right top part of the
  10494. screen starting since time 2:
  10495. @example
  10496. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10497. @end example
  10498. @item
  10499. Compose output by putting two input videos side to side:
  10500. @example
  10501. ffmpeg -i left.avi -i right.avi -filter_complex "
  10502. nullsrc=size=200x100 [background];
  10503. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10504. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10505. [background][left] overlay=shortest=1 [background+left];
  10506. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10507. "
  10508. @end example
  10509. @item
  10510. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10511. @example
  10512. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10513. -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]'
  10514. masked.avi
  10515. @end example
  10516. @item
  10517. Chain several overlays in cascade:
  10518. @example
  10519. nullsrc=s=200x200 [bg];
  10520. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10521. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10522. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10523. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10524. [in3] null, [mid2] overlay=100:100 [out0]
  10525. @end example
  10526. @end itemize
  10527. @section owdenoise
  10528. Apply Overcomplete Wavelet denoiser.
  10529. The filter accepts the following options:
  10530. @table @option
  10531. @item depth
  10532. Set depth.
  10533. Larger depth values will denoise lower frequency components more, but
  10534. slow down filtering.
  10535. Must be an int in the range 8-16, default is @code{8}.
  10536. @item luma_strength, ls
  10537. Set luma strength.
  10538. Must be a double value in the range 0-1000, default is @code{1.0}.
  10539. @item chroma_strength, cs
  10540. Set chroma strength.
  10541. Must be a double value in the range 0-1000, default is @code{1.0}.
  10542. @end table
  10543. @anchor{pad}
  10544. @section pad
  10545. Add paddings to the input image, and place the original input at the
  10546. provided @var{x}, @var{y} coordinates.
  10547. It accepts the following parameters:
  10548. @table @option
  10549. @item width, w
  10550. @item height, h
  10551. Specify an expression for the size of the output image with the
  10552. paddings added. If the value for @var{width} or @var{height} is 0, the
  10553. corresponding input size is used for the output.
  10554. The @var{width} expression can reference the value set by the
  10555. @var{height} expression, and vice versa.
  10556. The default value of @var{width} and @var{height} is 0.
  10557. @item x
  10558. @item y
  10559. Specify the offsets to place the input image at within the padded area,
  10560. with respect to the top/left border of the output image.
  10561. The @var{x} expression can reference the value set by the @var{y}
  10562. expression, and vice versa.
  10563. The default value of @var{x} and @var{y} is 0.
  10564. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10565. so the input image is centered on the padded area.
  10566. @item color
  10567. Specify the color of the padded area. For the syntax of this option,
  10568. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10569. manual,ffmpeg-utils}.
  10570. The default value of @var{color} is "black".
  10571. @item eval
  10572. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10573. It accepts the following values:
  10574. @table @samp
  10575. @item init
  10576. Only evaluate expressions once during the filter initialization or when
  10577. a command is processed.
  10578. @item frame
  10579. Evaluate expressions for each incoming frame.
  10580. @end table
  10581. Default value is @samp{init}.
  10582. @item aspect
  10583. Pad to aspect instead to a resolution.
  10584. @end table
  10585. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10586. options are expressions containing the following constants:
  10587. @table @option
  10588. @item in_w
  10589. @item in_h
  10590. The input video width and height.
  10591. @item iw
  10592. @item ih
  10593. These are the same as @var{in_w} and @var{in_h}.
  10594. @item out_w
  10595. @item out_h
  10596. The output width and height (the size of the padded area), as
  10597. specified by the @var{width} and @var{height} expressions.
  10598. @item ow
  10599. @item oh
  10600. These are the same as @var{out_w} and @var{out_h}.
  10601. @item x
  10602. @item y
  10603. The x and y offsets as specified by the @var{x} and @var{y}
  10604. expressions, or NAN if not yet specified.
  10605. @item a
  10606. same as @var{iw} / @var{ih}
  10607. @item sar
  10608. input sample aspect ratio
  10609. @item dar
  10610. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10611. @item hsub
  10612. @item vsub
  10613. The horizontal and vertical chroma subsample values. For example for the
  10614. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10615. @end table
  10616. @subsection Examples
  10617. @itemize
  10618. @item
  10619. Add paddings with the color "violet" to the input video. The output video
  10620. size is 640x480, and the top-left corner of the input video is placed at
  10621. column 0, row 40
  10622. @example
  10623. pad=640:480:0:40:violet
  10624. @end example
  10625. The example above is equivalent to the following command:
  10626. @example
  10627. pad=width=640:height=480:x=0:y=40:color=violet
  10628. @end example
  10629. @item
  10630. Pad the input to get an output with dimensions increased by 3/2,
  10631. and put the input video at the center of the padded area:
  10632. @example
  10633. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10634. @end example
  10635. @item
  10636. Pad the input to get a squared output with size equal to the maximum
  10637. value between the input width and height, and put the input video at
  10638. the center of the padded area:
  10639. @example
  10640. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10641. @end example
  10642. @item
  10643. Pad the input to get a final w/h ratio of 16:9:
  10644. @example
  10645. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10646. @end example
  10647. @item
  10648. In case of anamorphic video, in order to set the output display aspect
  10649. correctly, it is necessary to use @var{sar} in the expression,
  10650. according to the relation:
  10651. @example
  10652. (ih * X / ih) * sar = output_dar
  10653. X = output_dar / sar
  10654. @end example
  10655. Thus the previous example needs to be modified to:
  10656. @example
  10657. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10658. @end example
  10659. @item
  10660. Double the output size and put the input video in the bottom-right
  10661. corner of the output padded area:
  10662. @example
  10663. pad="2*iw:2*ih:ow-iw:oh-ih"
  10664. @end example
  10665. @end itemize
  10666. @anchor{palettegen}
  10667. @section palettegen
  10668. Generate one palette for a whole video stream.
  10669. It accepts the following options:
  10670. @table @option
  10671. @item max_colors
  10672. Set the maximum number of colors to quantize in the palette.
  10673. Note: the palette will still contain 256 colors; the unused palette entries
  10674. will be black.
  10675. @item reserve_transparent
  10676. Create a palette of 255 colors maximum and reserve the last one for
  10677. transparency. Reserving the transparency color is useful for GIF optimization.
  10678. If not set, the maximum of colors in the palette will be 256. You probably want
  10679. to disable this option for a standalone image.
  10680. Set by default.
  10681. @item transparency_color
  10682. Set the color that will be used as background for transparency.
  10683. @item stats_mode
  10684. Set statistics mode.
  10685. It accepts the following values:
  10686. @table @samp
  10687. @item full
  10688. Compute full frame histograms.
  10689. @item diff
  10690. Compute histograms only for the part that differs from previous frame. This
  10691. might be relevant to give more importance to the moving part of your input if
  10692. the background is static.
  10693. @item single
  10694. Compute new histogram for each frame.
  10695. @end table
  10696. Default value is @var{full}.
  10697. @end table
  10698. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10699. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10700. color quantization of the palette. This information is also visible at
  10701. @var{info} logging level.
  10702. @subsection Examples
  10703. @itemize
  10704. @item
  10705. Generate a representative palette of a given video using @command{ffmpeg}:
  10706. @example
  10707. ffmpeg -i input.mkv -vf palettegen palette.png
  10708. @end example
  10709. @end itemize
  10710. @section paletteuse
  10711. Use a palette to downsample an input video stream.
  10712. The filter takes two inputs: one video stream and a palette. The palette must
  10713. be a 256 pixels image.
  10714. It accepts the following options:
  10715. @table @option
  10716. @item dither
  10717. Select dithering mode. Available algorithms are:
  10718. @table @samp
  10719. @item bayer
  10720. Ordered 8x8 bayer dithering (deterministic)
  10721. @item heckbert
  10722. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10723. Note: this dithering is sometimes considered "wrong" and is included as a
  10724. reference.
  10725. @item floyd_steinberg
  10726. Floyd and Steingberg dithering (error diffusion)
  10727. @item sierra2
  10728. Frankie Sierra dithering v2 (error diffusion)
  10729. @item sierra2_4a
  10730. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10731. @end table
  10732. Default is @var{sierra2_4a}.
  10733. @item bayer_scale
  10734. When @var{bayer} dithering is selected, this option defines the scale of the
  10735. pattern (how much the crosshatch pattern is visible). A low value means more
  10736. visible pattern for less banding, and higher value means less visible pattern
  10737. at the cost of more banding.
  10738. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10739. @item diff_mode
  10740. If set, define the zone to process
  10741. @table @samp
  10742. @item rectangle
  10743. Only the changing rectangle will be reprocessed. This is similar to GIF
  10744. cropping/offsetting compression mechanism. This option can be useful for speed
  10745. if only a part of the image is changing, and has use cases such as limiting the
  10746. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10747. moving scene (it leads to more deterministic output if the scene doesn't change
  10748. much, and as a result less moving noise and better GIF compression).
  10749. @end table
  10750. Default is @var{none}.
  10751. @item new
  10752. Take new palette for each output frame.
  10753. @item alpha_threshold
  10754. Sets the alpha threshold for transparency. Alpha values above this threshold
  10755. will be treated as completely opaque, and values below this threshold will be
  10756. treated as completely transparent.
  10757. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10758. @end table
  10759. @subsection Examples
  10760. @itemize
  10761. @item
  10762. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10763. using @command{ffmpeg}:
  10764. @example
  10765. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10766. @end example
  10767. @end itemize
  10768. @section perspective
  10769. Correct perspective of video not recorded perpendicular to the screen.
  10770. A description of the accepted parameters follows.
  10771. @table @option
  10772. @item x0
  10773. @item y0
  10774. @item x1
  10775. @item y1
  10776. @item x2
  10777. @item y2
  10778. @item x3
  10779. @item y3
  10780. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10781. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10782. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10783. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10784. then the corners of the source will be sent to the specified coordinates.
  10785. The expressions can use the following variables:
  10786. @table @option
  10787. @item W
  10788. @item H
  10789. the width and height of video frame.
  10790. @item in
  10791. Input frame count.
  10792. @item on
  10793. Output frame count.
  10794. @end table
  10795. @item interpolation
  10796. Set interpolation for perspective correction.
  10797. It accepts the following values:
  10798. @table @samp
  10799. @item linear
  10800. @item cubic
  10801. @end table
  10802. Default value is @samp{linear}.
  10803. @item sense
  10804. Set interpretation of coordinate options.
  10805. It accepts the following values:
  10806. @table @samp
  10807. @item 0, source
  10808. Send point in the source specified by the given coordinates to
  10809. the corners of the destination.
  10810. @item 1, destination
  10811. Send the corners of the source to the point in the destination specified
  10812. by the given coordinates.
  10813. Default value is @samp{source}.
  10814. @end table
  10815. @item eval
  10816. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10817. It accepts the following values:
  10818. @table @samp
  10819. @item init
  10820. only evaluate expressions once during the filter initialization or
  10821. when a command is processed
  10822. @item frame
  10823. evaluate expressions for each incoming frame
  10824. @end table
  10825. Default value is @samp{init}.
  10826. @end table
  10827. @section phase
  10828. Delay interlaced video by one field time so that the field order changes.
  10829. The intended use is to fix PAL movies that have been captured with the
  10830. opposite field order to the film-to-video transfer.
  10831. A description of the accepted parameters follows.
  10832. @table @option
  10833. @item mode
  10834. Set phase mode.
  10835. It accepts the following values:
  10836. @table @samp
  10837. @item t
  10838. Capture field order top-first, transfer bottom-first.
  10839. Filter will delay the bottom field.
  10840. @item b
  10841. Capture field order bottom-first, transfer top-first.
  10842. Filter will delay the top field.
  10843. @item p
  10844. Capture and transfer with the same field order. This mode only exists
  10845. for the documentation of the other options to refer to, but if you
  10846. actually select it, the filter will faithfully do nothing.
  10847. @item a
  10848. Capture field order determined automatically by field flags, transfer
  10849. opposite.
  10850. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10851. basis using field flags. If no field information is available,
  10852. then this works just like @samp{u}.
  10853. @item u
  10854. Capture unknown or varying, transfer opposite.
  10855. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10856. analyzing the images and selecting the alternative that produces best
  10857. match between the fields.
  10858. @item T
  10859. Capture top-first, transfer unknown or varying.
  10860. Filter selects among @samp{t} and @samp{p} using image analysis.
  10861. @item B
  10862. Capture bottom-first, transfer unknown or varying.
  10863. Filter selects among @samp{b} and @samp{p} using image analysis.
  10864. @item A
  10865. Capture determined by field flags, transfer unknown or varying.
  10866. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10867. image analysis. If no field information is available, then this works just
  10868. like @samp{U}. This is the default mode.
  10869. @item U
  10870. Both capture and transfer unknown or varying.
  10871. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10872. @end table
  10873. @end table
  10874. @section photosensitivity
  10875. Reduce various flashes in video, so to help users with epilepsy.
  10876. It accepts the following options:
  10877. @table @option
  10878. @item frames, f
  10879. Set how many frames to use when filtering. Default is 30.
  10880. @item threshold, t
  10881. Set detection threshold factor. Default is 1.
  10882. Lower is stricter.
  10883. @item skip
  10884. Set how many pixels to skip when sampling frames. Defalt is 1.
  10885. Allowed range is from 1 to 1024.
  10886. @item bypass
  10887. Leave frames unchanged. Default is disabled.
  10888. @end table
  10889. @section pixdesctest
  10890. Pixel format descriptor test filter, mainly useful for internal
  10891. testing. The output video should be equal to the input video.
  10892. For example:
  10893. @example
  10894. format=monow, pixdesctest
  10895. @end example
  10896. can be used to test the monowhite pixel format descriptor definition.
  10897. @section pixscope
  10898. Display sample values of color channels. Mainly useful for checking color
  10899. and levels. Minimum supported resolution is 640x480.
  10900. The filters accept the following options:
  10901. @table @option
  10902. @item x
  10903. Set scope X position, relative offset on X axis.
  10904. @item y
  10905. Set scope Y position, relative offset on Y axis.
  10906. @item w
  10907. Set scope width.
  10908. @item h
  10909. Set scope height.
  10910. @item o
  10911. Set window opacity. This window also holds statistics about pixel area.
  10912. @item wx
  10913. Set window X position, relative offset on X axis.
  10914. @item wy
  10915. Set window Y position, relative offset on Y axis.
  10916. @end table
  10917. @section pp
  10918. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10919. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10920. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10921. Each subfilter and some options have a short and a long name that can be used
  10922. interchangeably, i.e. dr/dering are the same.
  10923. The filters accept the following options:
  10924. @table @option
  10925. @item subfilters
  10926. Set postprocessing subfilters string.
  10927. @end table
  10928. All subfilters share common options to determine their scope:
  10929. @table @option
  10930. @item a/autoq
  10931. Honor the quality commands for this subfilter.
  10932. @item c/chrom
  10933. Do chrominance filtering, too (default).
  10934. @item y/nochrom
  10935. Do luminance filtering only (no chrominance).
  10936. @item n/noluma
  10937. Do chrominance filtering only (no luminance).
  10938. @end table
  10939. These options can be appended after the subfilter name, separated by a '|'.
  10940. Available subfilters are:
  10941. @table @option
  10942. @item hb/hdeblock[|difference[|flatness]]
  10943. Horizontal deblocking filter
  10944. @table @option
  10945. @item difference
  10946. Difference factor where higher values mean more deblocking (default: @code{32}).
  10947. @item flatness
  10948. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10949. @end table
  10950. @item vb/vdeblock[|difference[|flatness]]
  10951. Vertical deblocking filter
  10952. @table @option
  10953. @item difference
  10954. Difference factor where higher values mean more deblocking (default: @code{32}).
  10955. @item flatness
  10956. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10957. @end table
  10958. @item ha/hadeblock[|difference[|flatness]]
  10959. Accurate horizontal deblocking filter
  10960. @table @option
  10961. @item difference
  10962. Difference factor where higher values mean more deblocking (default: @code{32}).
  10963. @item flatness
  10964. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10965. @end table
  10966. @item va/vadeblock[|difference[|flatness]]
  10967. Accurate vertical deblocking filter
  10968. @table @option
  10969. @item difference
  10970. Difference factor where higher values mean more deblocking (default: @code{32}).
  10971. @item flatness
  10972. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10973. @end table
  10974. @end table
  10975. The horizontal and vertical deblocking filters share the difference and
  10976. flatness values so you cannot set different horizontal and vertical
  10977. thresholds.
  10978. @table @option
  10979. @item h1/x1hdeblock
  10980. Experimental horizontal deblocking filter
  10981. @item v1/x1vdeblock
  10982. Experimental vertical deblocking filter
  10983. @item dr/dering
  10984. Deringing filter
  10985. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10986. @table @option
  10987. @item threshold1
  10988. larger -> stronger filtering
  10989. @item threshold2
  10990. larger -> stronger filtering
  10991. @item threshold3
  10992. larger -> stronger filtering
  10993. @end table
  10994. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10995. @table @option
  10996. @item f/fullyrange
  10997. Stretch luminance to @code{0-255}.
  10998. @end table
  10999. @item lb/linblenddeint
  11000. Linear blend deinterlacing filter that deinterlaces the given block by
  11001. filtering all lines with a @code{(1 2 1)} filter.
  11002. @item li/linipoldeint
  11003. Linear interpolating deinterlacing filter that deinterlaces the given block by
  11004. linearly interpolating every second line.
  11005. @item ci/cubicipoldeint
  11006. Cubic interpolating deinterlacing filter deinterlaces the given block by
  11007. cubically interpolating every second line.
  11008. @item md/mediandeint
  11009. Median deinterlacing filter that deinterlaces the given block by applying a
  11010. median filter to every second line.
  11011. @item fd/ffmpegdeint
  11012. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  11013. second line with a @code{(-1 4 2 4 -1)} filter.
  11014. @item l5/lowpass5
  11015. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  11016. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  11017. @item fq/forceQuant[|quantizer]
  11018. Overrides the quantizer table from the input with the constant quantizer you
  11019. specify.
  11020. @table @option
  11021. @item quantizer
  11022. Quantizer to use
  11023. @end table
  11024. @item de/default
  11025. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  11026. @item fa/fast
  11027. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  11028. @item ac
  11029. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11030. @end table
  11031. @subsection Examples
  11032. @itemize
  11033. @item
  11034. Apply horizontal and vertical deblocking, deringing and automatic
  11035. brightness/contrast:
  11036. @example
  11037. pp=hb/vb/dr/al
  11038. @end example
  11039. @item
  11040. Apply default filters without brightness/contrast correction:
  11041. @example
  11042. pp=de/-al
  11043. @end example
  11044. @item
  11045. Apply default filters and temporal denoiser:
  11046. @example
  11047. pp=default/tmpnoise|1|2|3
  11048. @end example
  11049. @item
  11050. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11051. automatically depending on available CPU time:
  11052. @example
  11053. pp=hb|y/vb|a
  11054. @end example
  11055. @end itemize
  11056. @section pp7
  11057. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11058. similar to spp = 6 with 7 point DCT, where only the center sample is
  11059. used after IDCT.
  11060. The filter accepts the following options:
  11061. @table @option
  11062. @item qp
  11063. Force a constant quantization parameter. It accepts an integer in range
  11064. 0 to 63. If not set, the filter will use the QP from the video stream
  11065. (if available).
  11066. @item mode
  11067. Set thresholding mode. Available modes are:
  11068. @table @samp
  11069. @item hard
  11070. Set hard thresholding.
  11071. @item soft
  11072. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11073. @item medium
  11074. Set medium thresholding (good results, default).
  11075. @end table
  11076. @end table
  11077. @section premultiply
  11078. Apply alpha premultiply effect to input video stream using first plane
  11079. of second stream as alpha.
  11080. Both streams must have same dimensions and same pixel format.
  11081. The filter accepts the following option:
  11082. @table @option
  11083. @item planes
  11084. Set which planes will be processed, unprocessed planes will be copied.
  11085. By default value 0xf, all planes will be processed.
  11086. @item inplace
  11087. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11088. @end table
  11089. @section prewitt
  11090. Apply prewitt operator to input video stream.
  11091. The filter accepts the following option:
  11092. @table @option
  11093. @item planes
  11094. Set which planes will be processed, unprocessed planes will be copied.
  11095. By default value 0xf, all planes will be processed.
  11096. @item scale
  11097. Set value which will be multiplied with filtered result.
  11098. @item delta
  11099. Set value which will be added to filtered result.
  11100. @end table
  11101. @anchor{program_opencl}
  11102. @section program_opencl
  11103. Filter video using an OpenCL program.
  11104. @table @option
  11105. @item source
  11106. OpenCL program source file.
  11107. @item kernel
  11108. Kernel name in program.
  11109. @item inputs
  11110. Number of inputs to the filter. Defaults to 1.
  11111. @item size, s
  11112. Size of output frames. Defaults to the same as the first input.
  11113. @end table
  11114. The program source file must contain a kernel function with the given name,
  11115. which will be run once for each plane of the output. Each run on a plane
  11116. gets enqueued as a separate 2D global NDRange with one work-item for each
  11117. pixel to be generated. The global ID offset for each work-item is therefore
  11118. the coordinates of a pixel in the destination image.
  11119. The kernel function needs to take the following arguments:
  11120. @itemize
  11121. @item
  11122. Destination image, @var{__write_only image2d_t}.
  11123. This image will become the output; the kernel should write all of it.
  11124. @item
  11125. Frame index, @var{unsigned int}.
  11126. This is a counter starting from zero and increasing by one for each frame.
  11127. @item
  11128. Source images, @var{__read_only image2d_t}.
  11129. These are the most recent images on each input. The kernel may read from
  11130. them to generate the output, but they can't be written to.
  11131. @end itemize
  11132. Example programs:
  11133. @itemize
  11134. @item
  11135. Copy the input to the output (output must be the same size as the input).
  11136. @verbatim
  11137. __kernel void copy(__write_only image2d_t destination,
  11138. unsigned int index,
  11139. __read_only image2d_t source)
  11140. {
  11141. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  11142. int2 location = (int2)(get_global_id(0), get_global_id(1));
  11143. float4 value = read_imagef(source, sampler, location);
  11144. write_imagef(destination, location, value);
  11145. }
  11146. @end verbatim
  11147. @item
  11148. Apply a simple transformation, rotating the input by an amount increasing
  11149. with the index counter. Pixel values are linearly interpolated by the
  11150. sampler, and the output need not have the same dimensions as the input.
  11151. @verbatim
  11152. __kernel void rotate_image(__write_only image2d_t dst,
  11153. unsigned int index,
  11154. __read_only image2d_t src)
  11155. {
  11156. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11157. CLK_FILTER_LINEAR);
  11158. float angle = (float)index / 100.0f;
  11159. float2 dst_dim = convert_float2(get_image_dim(dst));
  11160. float2 src_dim = convert_float2(get_image_dim(src));
  11161. float2 dst_cen = dst_dim / 2.0f;
  11162. float2 src_cen = src_dim / 2.0f;
  11163. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11164. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  11165. float2 src_pos = {
  11166. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  11167. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  11168. };
  11169. src_pos = src_pos * src_dim / dst_dim;
  11170. float2 src_loc = src_pos + src_cen;
  11171. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  11172. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  11173. write_imagef(dst, dst_loc, 0.5f);
  11174. else
  11175. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  11176. }
  11177. @end verbatim
  11178. @item
  11179. Blend two inputs together, with the amount of each input used varying
  11180. with the index counter.
  11181. @verbatim
  11182. __kernel void blend_images(__write_only image2d_t dst,
  11183. unsigned int index,
  11184. __read_only image2d_t src1,
  11185. __read_only image2d_t src2)
  11186. {
  11187. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11188. CLK_FILTER_LINEAR);
  11189. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  11190. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11191. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  11192. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  11193. float4 val1 = read_imagef(src1, sampler, src1_loc);
  11194. float4 val2 = read_imagef(src2, sampler, src2_loc);
  11195. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  11196. }
  11197. @end verbatim
  11198. @end itemize
  11199. @section pseudocolor
  11200. Alter frame colors in video with pseudocolors.
  11201. This filter accepts the following options:
  11202. @table @option
  11203. @item c0
  11204. set pixel first component expression
  11205. @item c1
  11206. set pixel second component expression
  11207. @item c2
  11208. set pixel third component expression
  11209. @item c3
  11210. set pixel fourth component expression, corresponds to the alpha component
  11211. @item i
  11212. set component to use as base for altering colors
  11213. @end table
  11214. Each of them specifies the expression to use for computing the lookup table for
  11215. the corresponding pixel component values.
  11216. The expressions can contain the following constants and functions:
  11217. @table @option
  11218. @item w
  11219. @item h
  11220. The input width and height.
  11221. @item val
  11222. The input value for the pixel component.
  11223. @item ymin, umin, vmin, amin
  11224. The minimum allowed component value.
  11225. @item ymax, umax, vmax, amax
  11226. The maximum allowed component value.
  11227. @end table
  11228. All expressions default to "val".
  11229. @subsection Examples
  11230. @itemize
  11231. @item
  11232. Change too high luma values to gradient:
  11233. @example
  11234. 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'"
  11235. @end example
  11236. @end itemize
  11237. @section psnr
  11238. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11239. Ratio) between two input videos.
  11240. This filter takes in input two input videos, the first input is
  11241. considered the "main" source and is passed unchanged to the
  11242. output. The second input is used as a "reference" video for computing
  11243. the PSNR.
  11244. Both video inputs must have the same resolution and pixel format for
  11245. this filter to work correctly. Also it assumes that both inputs
  11246. have the same number of frames, which are compared one by one.
  11247. The obtained average PSNR is printed through the logging system.
  11248. The filter stores the accumulated MSE (mean squared error) of each
  11249. frame, and at the end of the processing it is averaged across all frames
  11250. equally, and the following formula is applied to obtain the PSNR:
  11251. @example
  11252. PSNR = 10*log10(MAX^2/MSE)
  11253. @end example
  11254. Where MAX is the average of the maximum values of each component of the
  11255. image.
  11256. The description of the accepted parameters follows.
  11257. @table @option
  11258. @item stats_file, f
  11259. If specified the filter will use the named file to save the PSNR of
  11260. each individual frame. When filename equals "-" the data is sent to
  11261. standard output.
  11262. @item stats_version
  11263. Specifies which version of the stats file format to use. Details of
  11264. each format are written below.
  11265. Default value is 1.
  11266. @item stats_add_max
  11267. Determines whether the max value is output to the stats log.
  11268. Default value is 0.
  11269. Requires stats_version >= 2. If this is set and stats_version < 2,
  11270. the filter will return an error.
  11271. @end table
  11272. This filter also supports the @ref{framesync} options.
  11273. The file printed if @var{stats_file} is selected, contains a sequence of
  11274. key/value pairs of the form @var{key}:@var{value} for each compared
  11275. couple of frames.
  11276. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11277. the list of per-frame-pair stats, with key value pairs following the frame
  11278. format with the following parameters:
  11279. @table @option
  11280. @item psnr_log_version
  11281. The version of the log file format. Will match @var{stats_version}.
  11282. @item fields
  11283. A comma separated list of the per-frame-pair parameters included in
  11284. the log.
  11285. @end table
  11286. A description of each shown per-frame-pair parameter follows:
  11287. @table @option
  11288. @item n
  11289. sequential number of the input frame, starting from 1
  11290. @item mse_avg
  11291. Mean Square Error pixel-by-pixel average difference of the compared
  11292. frames, averaged over all the image components.
  11293. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11294. Mean Square Error pixel-by-pixel average difference of the compared
  11295. frames for the component specified by the suffix.
  11296. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11297. Peak Signal to Noise ratio of the compared frames for the component
  11298. specified by the suffix.
  11299. @item max_avg, max_y, max_u, max_v
  11300. Maximum allowed value for each channel, and average over all
  11301. channels.
  11302. @end table
  11303. For example:
  11304. @example
  11305. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11306. [main][ref] psnr="stats_file=stats.log" [out]
  11307. @end example
  11308. On this example the input file being processed is compared with the
  11309. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11310. is stored in @file{stats.log}.
  11311. @anchor{pullup}
  11312. @section pullup
  11313. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11314. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11315. content.
  11316. The pullup filter is designed to take advantage of future context in making
  11317. its decisions. This filter is stateless in the sense that it does not lock
  11318. onto a pattern to follow, but it instead looks forward to the following
  11319. fields in order to identify matches and rebuild progressive frames.
  11320. To produce content with an even framerate, insert the fps filter after
  11321. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11322. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11323. The filter accepts the following options:
  11324. @table @option
  11325. @item jl
  11326. @item jr
  11327. @item jt
  11328. @item jb
  11329. These options set the amount of "junk" to ignore at the left, right, top, and
  11330. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11331. while top and bottom are in units of 2 lines.
  11332. The default is 8 pixels on each side.
  11333. @item sb
  11334. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11335. filter generating an occasional mismatched frame, but it may also cause an
  11336. excessive number of frames to be dropped during high motion sequences.
  11337. Conversely, setting it to -1 will make filter match fields more easily.
  11338. This may help processing of video where there is slight blurring between
  11339. the fields, but may also cause there to be interlaced frames in the output.
  11340. Default value is @code{0}.
  11341. @item mp
  11342. Set the metric plane to use. It accepts the following values:
  11343. @table @samp
  11344. @item l
  11345. Use luma plane.
  11346. @item u
  11347. Use chroma blue plane.
  11348. @item v
  11349. Use chroma red plane.
  11350. @end table
  11351. This option may be set to use chroma plane instead of the default luma plane
  11352. for doing filter's computations. This may improve accuracy on very clean
  11353. source material, but more likely will decrease accuracy, especially if there
  11354. is chroma noise (rainbow effect) or any grayscale video.
  11355. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11356. load and make pullup usable in realtime on slow machines.
  11357. @end table
  11358. For best results (without duplicated frames in the output file) it is
  11359. necessary to change the output frame rate. For example, to inverse
  11360. telecine NTSC input:
  11361. @example
  11362. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11363. @end example
  11364. @section qp
  11365. Change video quantization parameters (QP).
  11366. The filter accepts the following option:
  11367. @table @option
  11368. @item qp
  11369. Set expression for quantization parameter.
  11370. @end table
  11371. The expression is evaluated through the eval API and can contain, among others,
  11372. the following constants:
  11373. @table @var
  11374. @item known
  11375. 1 if index is not 129, 0 otherwise.
  11376. @item qp
  11377. Sequential index starting from -129 to 128.
  11378. @end table
  11379. @subsection Examples
  11380. @itemize
  11381. @item
  11382. Some equation like:
  11383. @example
  11384. qp=2+2*sin(PI*qp)
  11385. @end example
  11386. @end itemize
  11387. @section random
  11388. Flush video frames from internal cache of frames into a random order.
  11389. No frame is discarded.
  11390. Inspired by @ref{frei0r} nervous filter.
  11391. @table @option
  11392. @item frames
  11393. Set size in number of frames of internal cache, in range from @code{2} to
  11394. @code{512}. Default is @code{30}.
  11395. @item seed
  11396. Set seed for random number generator, must be an integer included between
  11397. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11398. less than @code{0}, the filter will try to use a good random seed on a
  11399. best effort basis.
  11400. @end table
  11401. @section readeia608
  11402. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11403. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11404. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11405. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11406. @table @option
  11407. @item lavfi.readeia608.X.cc
  11408. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11409. @item lavfi.readeia608.X.line
  11410. The number of the line on which the EIA-608 data was identified and read.
  11411. @end table
  11412. This filter accepts the following options:
  11413. @table @option
  11414. @item scan_min
  11415. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11416. @item scan_max
  11417. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11418. @item mac
  11419. Set minimal acceptable amplitude change for sync codes detection.
  11420. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  11421. @item spw
  11422. Set the ratio of width reserved for sync code detection.
  11423. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  11424. @item mhd
  11425. Set the max peaks height difference for sync code detection.
  11426. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11427. @item mpd
  11428. Set max peaks period difference for sync code detection.
  11429. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11430. @item msd
  11431. Set the first two max start code bits differences.
  11432. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  11433. @item bhd
  11434. Set the minimum ratio of bits height compared to 3rd start code bit.
  11435. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  11436. @item th_w
  11437. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  11438. @item th_b
  11439. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  11440. @item chp
  11441. Enable checking the parity bit. In the event of a parity error, the filter will output
  11442. @code{0x00} for that character. Default is false.
  11443. @item lp
  11444. Lowpass lines prior to further processing. Default is disabled.
  11445. @end table
  11446. @subsection Examples
  11447. @itemize
  11448. @item
  11449. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11450. @example
  11451. 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
  11452. @end example
  11453. @end itemize
  11454. @section readvitc
  11455. Read vertical interval timecode (VITC) information from the top lines of a
  11456. video frame.
  11457. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11458. timecode value, if a valid timecode has been detected. Further metadata key
  11459. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11460. timecode data has been found or not.
  11461. This filter accepts the following options:
  11462. @table @option
  11463. @item scan_max
  11464. Set the maximum number of lines to scan for VITC data. If the value is set to
  11465. @code{-1} the full video frame is scanned. Default is @code{45}.
  11466. @item thr_b
  11467. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11468. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11469. @item thr_w
  11470. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11471. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11472. @end table
  11473. @subsection Examples
  11474. @itemize
  11475. @item
  11476. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11477. draw @code{--:--:--:--} as a placeholder:
  11478. @example
  11479. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11480. @end example
  11481. @end itemize
  11482. @section remap
  11483. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11484. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11485. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11486. value for pixel will be used for destination pixel.
  11487. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11488. will have Xmap/Ymap video stream dimensions.
  11489. Xmap and Ymap input video streams are 16bit depth, single channel.
  11490. @table @option
  11491. @item format
  11492. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11493. Default is @code{color}.
  11494. @end table
  11495. @section removegrain
  11496. The removegrain filter is a spatial denoiser for progressive video.
  11497. @table @option
  11498. @item m0
  11499. Set mode for the first plane.
  11500. @item m1
  11501. Set mode for the second plane.
  11502. @item m2
  11503. Set mode for the third plane.
  11504. @item m3
  11505. Set mode for the fourth plane.
  11506. @end table
  11507. Range of mode is from 0 to 24. Description of each mode follows:
  11508. @table @var
  11509. @item 0
  11510. Leave input plane unchanged. Default.
  11511. @item 1
  11512. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11513. @item 2
  11514. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11515. @item 3
  11516. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11517. @item 4
  11518. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11519. This is equivalent to a median filter.
  11520. @item 5
  11521. Line-sensitive clipping giving the minimal change.
  11522. @item 6
  11523. Line-sensitive clipping, intermediate.
  11524. @item 7
  11525. Line-sensitive clipping, intermediate.
  11526. @item 8
  11527. Line-sensitive clipping, intermediate.
  11528. @item 9
  11529. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11530. @item 10
  11531. Replaces the target pixel with the closest neighbour.
  11532. @item 11
  11533. [1 2 1] horizontal and vertical kernel blur.
  11534. @item 12
  11535. Same as mode 11.
  11536. @item 13
  11537. Bob mode, interpolates top field from the line where the neighbours
  11538. pixels are the closest.
  11539. @item 14
  11540. Bob mode, interpolates bottom field from the line where the neighbours
  11541. pixels are the closest.
  11542. @item 15
  11543. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11544. interpolation formula.
  11545. @item 16
  11546. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11547. interpolation formula.
  11548. @item 17
  11549. Clips the pixel with the minimum and maximum of respectively the maximum and
  11550. minimum of each pair of opposite neighbour pixels.
  11551. @item 18
  11552. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11553. the current pixel is minimal.
  11554. @item 19
  11555. Replaces the pixel with the average of its 8 neighbours.
  11556. @item 20
  11557. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11558. @item 21
  11559. Clips pixels using the averages of opposite neighbour.
  11560. @item 22
  11561. Same as mode 21 but simpler and faster.
  11562. @item 23
  11563. Small edge and halo removal, but reputed useless.
  11564. @item 24
  11565. Similar as 23.
  11566. @end table
  11567. @section removelogo
  11568. Suppress a TV station logo, using an image file to determine which
  11569. pixels comprise the logo. It works by filling in the pixels that
  11570. comprise the logo with neighboring pixels.
  11571. The filter accepts the following options:
  11572. @table @option
  11573. @item filename, f
  11574. Set the filter bitmap file, which can be any image format supported by
  11575. libavformat. The width and height of the image file must match those of the
  11576. video stream being processed.
  11577. @end table
  11578. Pixels in the provided bitmap image with a value of zero are not
  11579. considered part of the logo, non-zero pixels are considered part of
  11580. the logo. If you use white (255) for the logo and black (0) for the
  11581. rest, you will be safe. For making the filter bitmap, it is
  11582. recommended to take a screen capture of a black frame with the logo
  11583. visible, and then using a threshold filter followed by the erode
  11584. filter once or twice.
  11585. If needed, little splotches can be fixed manually. Remember that if
  11586. logo pixels are not covered, the filter quality will be much
  11587. reduced. Marking too many pixels as part of the logo does not hurt as
  11588. much, but it will increase the amount of blurring needed to cover over
  11589. the image and will destroy more information than necessary, and extra
  11590. pixels will slow things down on a large logo.
  11591. @section repeatfields
  11592. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11593. fields based on its value.
  11594. @section reverse
  11595. Reverse a video clip.
  11596. Warning: This filter requires memory to buffer the entire clip, so trimming
  11597. is suggested.
  11598. @subsection Examples
  11599. @itemize
  11600. @item
  11601. Take the first 5 seconds of a clip, and reverse it.
  11602. @example
  11603. trim=end=5,reverse
  11604. @end example
  11605. @end itemize
  11606. @section rgbashift
  11607. Shift R/G/B/A pixels horizontally and/or vertically.
  11608. The filter accepts the following options:
  11609. @table @option
  11610. @item rh
  11611. Set amount to shift red horizontally.
  11612. @item rv
  11613. Set amount to shift red vertically.
  11614. @item gh
  11615. Set amount to shift green horizontally.
  11616. @item gv
  11617. Set amount to shift green vertically.
  11618. @item bh
  11619. Set amount to shift blue horizontally.
  11620. @item bv
  11621. Set amount to shift blue vertically.
  11622. @item ah
  11623. Set amount to shift alpha horizontally.
  11624. @item av
  11625. Set amount to shift alpha vertically.
  11626. @item edge
  11627. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11628. @end table
  11629. @section roberts
  11630. Apply roberts cross operator to input video stream.
  11631. The filter accepts the following option:
  11632. @table @option
  11633. @item planes
  11634. Set which planes will be processed, unprocessed planes will be copied.
  11635. By default value 0xf, all planes will be processed.
  11636. @item scale
  11637. Set value which will be multiplied with filtered result.
  11638. @item delta
  11639. Set value which will be added to filtered result.
  11640. @end table
  11641. @section rotate
  11642. Rotate video by an arbitrary angle expressed in radians.
  11643. The filter accepts the following options:
  11644. A description of the optional parameters follows.
  11645. @table @option
  11646. @item angle, a
  11647. Set an expression for the angle by which to rotate the input video
  11648. clockwise, expressed as a number of radians. A negative value will
  11649. result in a counter-clockwise rotation. By default it is set to "0".
  11650. This expression is evaluated for each frame.
  11651. @item out_w, ow
  11652. Set the output width expression, default value is "iw".
  11653. This expression is evaluated just once during configuration.
  11654. @item out_h, oh
  11655. Set the output height expression, default value is "ih".
  11656. This expression is evaluated just once during configuration.
  11657. @item bilinear
  11658. Enable bilinear interpolation if set to 1, a value of 0 disables
  11659. it. Default value is 1.
  11660. @item fillcolor, c
  11661. Set the color used to fill the output area not covered by the rotated
  11662. image. For the general syntax of this option, check the
  11663. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11664. If the special value "none" is selected then no
  11665. background is printed (useful for example if the background is never shown).
  11666. Default value is "black".
  11667. @end table
  11668. The expressions for the angle and the output size can contain the
  11669. following constants and functions:
  11670. @table @option
  11671. @item n
  11672. sequential number of the input frame, starting from 0. It is always NAN
  11673. before the first frame is filtered.
  11674. @item t
  11675. time in seconds of the input frame, it is set to 0 when the filter is
  11676. configured. It is always NAN before the first frame is filtered.
  11677. @item hsub
  11678. @item vsub
  11679. horizontal and vertical chroma subsample values. For example for the
  11680. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11681. @item in_w, iw
  11682. @item in_h, ih
  11683. the input video width and height
  11684. @item out_w, ow
  11685. @item out_h, oh
  11686. the output width and height, that is the size of the padded area as
  11687. specified by the @var{width} and @var{height} expressions
  11688. @item rotw(a)
  11689. @item roth(a)
  11690. the minimal width/height required for completely containing the input
  11691. video rotated by @var{a} radians.
  11692. These are only available when computing the @option{out_w} and
  11693. @option{out_h} expressions.
  11694. @end table
  11695. @subsection Examples
  11696. @itemize
  11697. @item
  11698. Rotate the input by PI/6 radians clockwise:
  11699. @example
  11700. rotate=PI/6
  11701. @end example
  11702. @item
  11703. Rotate the input by PI/6 radians counter-clockwise:
  11704. @example
  11705. rotate=-PI/6
  11706. @end example
  11707. @item
  11708. Rotate the input by 45 degrees clockwise:
  11709. @example
  11710. rotate=45*PI/180
  11711. @end example
  11712. @item
  11713. Apply a constant rotation with period T, starting from an angle of PI/3:
  11714. @example
  11715. rotate=PI/3+2*PI*t/T
  11716. @end example
  11717. @item
  11718. Make the input video rotation oscillating with a period of T
  11719. seconds and an amplitude of A radians:
  11720. @example
  11721. rotate=A*sin(2*PI/T*t)
  11722. @end example
  11723. @item
  11724. Rotate the video, output size is chosen so that the whole rotating
  11725. input video is always completely contained in the output:
  11726. @example
  11727. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11728. @end example
  11729. @item
  11730. Rotate the video, reduce the output size so that no background is ever
  11731. shown:
  11732. @example
  11733. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11734. @end example
  11735. @end itemize
  11736. @subsection Commands
  11737. The filter supports the following commands:
  11738. @table @option
  11739. @item a, angle
  11740. Set the angle expression.
  11741. The command accepts the same syntax of the corresponding option.
  11742. If the specified expression is not valid, it is kept at its current
  11743. value.
  11744. @end table
  11745. @section sab
  11746. Apply Shape Adaptive Blur.
  11747. The filter accepts the following options:
  11748. @table @option
  11749. @item luma_radius, lr
  11750. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11751. value is 1.0. A greater value will result in a more blurred image, and
  11752. in slower processing.
  11753. @item luma_pre_filter_radius, lpfr
  11754. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11755. value is 1.0.
  11756. @item luma_strength, ls
  11757. Set luma maximum difference between pixels to still be considered, must
  11758. be a value in the 0.1-100.0 range, default value is 1.0.
  11759. @item chroma_radius, cr
  11760. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11761. greater value will result in a more blurred image, and in slower
  11762. processing.
  11763. @item chroma_pre_filter_radius, cpfr
  11764. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11765. @item chroma_strength, cs
  11766. Set chroma maximum difference between pixels to still be considered,
  11767. must be a value in the -0.9-100.0 range.
  11768. @end table
  11769. Each chroma option value, if not explicitly specified, is set to the
  11770. corresponding luma option value.
  11771. @anchor{scale}
  11772. @section scale
  11773. Scale (resize) the input video, using the libswscale library.
  11774. The scale filter forces the output display aspect ratio to be the same
  11775. of the input, by changing the output sample aspect ratio.
  11776. If the input image format is different from the format requested by
  11777. the next filter, the scale filter will convert the input to the
  11778. requested format.
  11779. @subsection Options
  11780. The filter accepts the following options, or any of the options
  11781. supported by the libswscale scaler.
  11782. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11783. the complete list of scaler options.
  11784. @table @option
  11785. @item width, w
  11786. @item height, h
  11787. Set the output video dimension expression. Default value is the input
  11788. dimension.
  11789. If the @var{width} or @var{w} value is 0, the input width is used for
  11790. the output. If the @var{height} or @var{h} value is 0, the input height
  11791. is used for the output.
  11792. If one and only one of the values is -n with n >= 1, the scale filter
  11793. will use a value that maintains the aspect ratio of the input image,
  11794. calculated from the other specified dimension. After that it will,
  11795. however, make sure that the calculated dimension is divisible by n and
  11796. adjust the value if necessary.
  11797. If both values are -n with n >= 1, the behavior will be identical to
  11798. both values being set to 0 as previously detailed.
  11799. See below for the list of accepted constants for use in the dimension
  11800. expression.
  11801. @item eval
  11802. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11803. @table @samp
  11804. @item init
  11805. Only evaluate expressions once during the filter initialization or when a command is processed.
  11806. @item frame
  11807. Evaluate expressions for each incoming frame.
  11808. @end table
  11809. Default value is @samp{init}.
  11810. @item interl
  11811. Set the interlacing mode. It accepts the following values:
  11812. @table @samp
  11813. @item 1
  11814. Force interlaced aware scaling.
  11815. @item 0
  11816. Do not apply interlaced scaling.
  11817. @item -1
  11818. Select interlaced aware scaling depending on whether the source frames
  11819. are flagged as interlaced or not.
  11820. @end table
  11821. Default value is @samp{0}.
  11822. @item flags
  11823. Set libswscale scaling flags. See
  11824. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11825. complete list of values. If not explicitly specified the filter applies
  11826. the default flags.
  11827. @item param0, param1
  11828. Set libswscale input parameters for scaling algorithms that need them. See
  11829. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11830. complete documentation. If not explicitly specified the filter applies
  11831. empty parameters.
  11832. @item size, s
  11833. Set the video size. For the syntax of this option, check the
  11834. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11835. @item in_color_matrix
  11836. @item out_color_matrix
  11837. Set in/output YCbCr color space type.
  11838. This allows the autodetected value to be overridden as well as allows forcing
  11839. a specific value used for the output and encoder.
  11840. If not specified, the color space type depends on the pixel format.
  11841. Possible values:
  11842. @table @samp
  11843. @item auto
  11844. Choose automatically.
  11845. @item bt709
  11846. Format conforming to International Telecommunication Union (ITU)
  11847. Recommendation BT.709.
  11848. @item fcc
  11849. Set color space conforming to the United States Federal Communications
  11850. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11851. @item bt601
  11852. @item bt470
  11853. @item smpte170m
  11854. Set color space conforming to:
  11855. @itemize
  11856. @item
  11857. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11858. @item
  11859. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11860. @item
  11861. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11862. @end itemize
  11863. @item smpte240m
  11864. Set color space conforming to SMPTE ST 240:1999.
  11865. @item bt2020
  11866. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  11867. @end table
  11868. @item in_range
  11869. @item out_range
  11870. Set in/output YCbCr sample range.
  11871. This allows the autodetected value to be overridden as well as allows forcing
  11872. a specific value used for the output and encoder. If not specified, the
  11873. range depends on the pixel format. Possible values:
  11874. @table @samp
  11875. @item auto/unknown
  11876. Choose automatically.
  11877. @item jpeg/full/pc
  11878. Set full range (0-255 in case of 8-bit luma).
  11879. @item mpeg/limited/tv
  11880. Set "MPEG" range (16-235 in case of 8-bit luma).
  11881. @end table
  11882. @item force_original_aspect_ratio
  11883. Enable decreasing or increasing output video width or height if necessary to
  11884. keep the original aspect ratio. Possible values:
  11885. @table @samp
  11886. @item disable
  11887. Scale the video as specified and disable this feature.
  11888. @item decrease
  11889. The output video dimensions will automatically be decreased if needed.
  11890. @item increase
  11891. The output video dimensions will automatically be increased if needed.
  11892. @end table
  11893. One useful instance of this option is that when you know a specific device's
  11894. maximum allowed resolution, you can use this to limit the output video to
  11895. that, while retaining the aspect ratio. For example, device A allows
  11896. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11897. decrease) and specifying 1280x720 to the command line makes the output
  11898. 1280x533.
  11899. Please note that this is a different thing than specifying -1 for @option{w}
  11900. or @option{h}, you still need to specify the output resolution for this option
  11901. to work.
  11902. @item force_divisible_by
  11903. Ensures that both the output dimensions, width and height, are divisible by the
  11904. given integer when used together with @option{force_original_aspect_ratio}. This
  11905. works similar to using @code{-n} in the @option{w} and @option{h} options.
  11906. This option respects the value set for @option{force_original_aspect_ratio},
  11907. increasing or decreasing the resolution accordingly. The video's aspect ratio
  11908. may be slightly modified.
  11909. This option can be handy if you need to have a video fit within or exceed
  11910. a defined resolution using @option{force_original_aspect_ratio} but also have
  11911. encoder restrictions on width or height divisibility.
  11912. @end table
  11913. The values of the @option{w} and @option{h} options are expressions
  11914. containing the following constants:
  11915. @table @var
  11916. @item in_w
  11917. @item in_h
  11918. The input width and height
  11919. @item iw
  11920. @item ih
  11921. These are the same as @var{in_w} and @var{in_h}.
  11922. @item out_w
  11923. @item out_h
  11924. The output (scaled) width and height
  11925. @item ow
  11926. @item oh
  11927. These are the same as @var{out_w} and @var{out_h}
  11928. @item a
  11929. The same as @var{iw} / @var{ih}
  11930. @item sar
  11931. input sample aspect ratio
  11932. @item dar
  11933. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11934. @item hsub
  11935. @item vsub
  11936. horizontal and vertical input chroma subsample values. For example for the
  11937. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11938. @item ohsub
  11939. @item ovsub
  11940. horizontal and vertical output chroma subsample values. For example for the
  11941. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11942. @end table
  11943. @subsection Examples
  11944. @itemize
  11945. @item
  11946. Scale the input video to a size of 200x100
  11947. @example
  11948. scale=w=200:h=100
  11949. @end example
  11950. This is equivalent to:
  11951. @example
  11952. scale=200:100
  11953. @end example
  11954. or:
  11955. @example
  11956. scale=200x100
  11957. @end example
  11958. @item
  11959. Specify a size abbreviation for the output size:
  11960. @example
  11961. scale=qcif
  11962. @end example
  11963. which can also be written as:
  11964. @example
  11965. scale=size=qcif
  11966. @end example
  11967. @item
  11968. Scale the input to 2x:
  11969. @example
  11970. scale=w=2*iw:h=2*ih
  11971. @end example
  11972. @item
  11973. The above is the same as:
  11974. @example
  11975. scale=2*in_w:2*in_h
  11976. @end example
  11977. @item
  11978. Scale the input to 2x with forced interlaced scaling:
  11979. @example
  11980. scale=2*iw:2*ih:interl=1
  11981. @end example
  11982. @item
  11983. Scale the input to half size:
  11984. @example
  11985. scale=w=iw/2:h=ih/2
  11986. @end example
  11987. @item
  11988. Increase the width, and set the height to the same size:
  11989. @example
  11990. scale=3/2*iw:ow
  11991. @end example
  11992. @item
  11993. Seek Greek harmony:
  11994. @example
  11995. scale=iw:1/PHI*iw
  11996. scale=ih*PHI:ih
  11997. @end example
  11998. @item
  11999. Increase the height, and set the width to 3/2 of the height:
  12000. @example
  12001. scale=w=3/2*oh:h=3/5*ih
  12002. @end example
  12003. @item
  12004. Increase the size, making the size a multiple of the chroma
  12005. subsample values:
  12006. @example
  12007. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12008. @end example
  12009. @item
  12010. Increase the width to a maximum of 500 pixels,
  12011. keeping the same aspect ratio as the input:
  12012. @example
  12013. scale=w='min(500\, iw*3/2):h=-1'
  12014. @end example
  12015. @item
  12016. Make pixels square by combining scale and setsar:
  12017. @example
  12018. scale='trunc(ih*dar):ih',setsar=1/1
  12019. @end example
  12020. @item
  12021. Make pixels square by combining scale and setsar,
  12022. making sure the resulting resolution is even (required by some codecs):
  12023. @example
  12024. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12025. @end example
  12026. @end itemize
  12027. @subsection Commands
  12028. This filter supports the following commands:
  12029. @table @option
  12030. @item width, w
  12031. @item height, h
  12032. Set the output video dimension expression.
  12033. The command accepts the same syntax of the corresponding option.
  12034. If the specified expression is not valid, it is kept at its current
  12035. value.
  12036. @end table
  12037. @section scale_npp
  12038. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12039. format conversion on CUDA video frames. Setting the output width and height
  12040. works in the same way as for the @var{scale} filter.
  12041. The following additional options are accepted:
  12042. @table @option
  12043. @item format
  12044. The pixel format of the output CUDA frames. If set to the string "same" (the
  12045. default), the input format will be kept. Note that automatic format negotiation
  12046. and conversion is not yet supported for hardware frames
  12047. @item interp_algo
  12048. The interpolation algorithm used for resizing. One of the following:
  12049. @table @option
  12050. @item nn
  12051. Nearest neighbour.
  12052. @item linear
  12053. @item cubic
  12054. @item cubic2p_bspline
  12055. 2-parameter cubic (B=1, C=0)
  12056. @item cubic2p_catmullrom
  12057. 2-parameter cubic (B=0, C=1/2)
  12058. @item cubic2p_b05c03
  12059. 2-parameter cubic (B=1/2, C=3/10)
  12060. @item super
  12061. Supersampling
  12062. @item lanczos
  12063. @end table
  12064. @end table
  12065. @section scale2ref
  12066. Scale (resize) the input video, based on a reference video.
  12067. See the scale filter for available options, scale2ref supports the same but
  12068. uses the reference video instead of the main input as basis. scale2ref also
  12069. supports the following additional constants for the @option{w} and
  12070. @option{h} options:
  12071. @table @var
  12072. @item main_w
  12073. @item main_h
  12074. The main input video's width and height
  12075. @item main_a
  12076. The same as @var{main_w} / @var{main_h}
  12077. @item main_sar
  12078. The main input video's sample aspect ratio
  12079. @item main_dar, mdar
  12080. The main input video's display aspect ratio. Calculated from
  12081. @code{(main_w / main_h) * main_sar}.
  12082. @item main_hsub
  12083. @item main_vsub
  12084. The main input video's horizontal and vertical chroma subsample values.
  12085. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12086. is 1.
  12087. @end table
  12088. @subsection Examples
  12089. @itemize
  12090. @item
  12091. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12092. @example
  12093. 'scale2ref[b][a];[a][b]overlay'
  12094. @end example
  12095. @item
  12096. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12097. @example
  12098. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12099. @end example
  12100. @end itemize
  12101. @section scroll
  12102. Scroll input video horizontally and/or vertically by constant speed.
  12103. The filter accepts the following options:
  12104. @table @option
  12105. @item horizontal, h
  12106. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12107. Negative values changes scrolling direction.
  12108. @item vertical, v
  12109. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12110. Negative values changes scrolling direction.
  12111. @item hpos
  12112. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12113. @item vpos
  12114. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12115. @end table
  12116. @subsection Commands
  12117. This filter supports the following @ref{commands}:
  12118. @table @option
  12119. @item horizontal, h
  12120. Set the horizontal scrolling speed.
  12121. @item vertical, v
  12122. Set the vertical scrolling speed.
  12123. @end table
  12124. @anchor{selectivecolor}
  12125. @section selectivecolor
  12126. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12127. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12128. by the "purity" of the color (that is, how saturated it already is).
  12129. This filter is similar to the Adobe Photoshop Selective Color tool.
  12130. The filter accepts the following options:
  12131. @table @option
  12132. @item correction_method
  12133. Select color correction method.
  12134. Available values are:
  12135. @table @samp
  12136. @item absolute
  12137. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12138. component value).
  12139. @item relative
  12140. Specified adjustments are relative to the original component value.
  12141. @end table
  12142. Default is @code{absolute}.
  12143. @item reds
  12144. Adjustments for red pixels (pixels where the red component is the maximum)
  12145. @item yellows
  12146. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12147. @item greens
  12148. Adjustments for green pixels (pixels where the green component is the maximum)
  12149. @item cyans
  12150. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12151. @item blues
  12152. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12153. @item magentas
  12154. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12155. @item whites
  12156. Adjustments for white pixels (pixels where all components are greater than 128)
  12157. @item neutrals
  12158. Adjustments for all pixels except pure black and pure white
  12159. @item blacks
  12160. Adjustments for black pixels (pixels where all components are lesser than 128)
  12161. @item psfile
  12162. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12163. @end table
  12164. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12165. 4 space separated floating point adjustment values in the [-1,1] range,
  12166. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12167. pixels of its range.
  12168. @subsection Examples
  12169. @itemize
  12170. @item
  12171. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12172. increase magenta by 27% in blue areas:
  12173. @example
  12174. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12175. @end example
  12176. @item
  12177. Use a Photoshop selective color preset:
  12178. @example
  12179. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12180. @end example
  12181. @end itemize
  12182. @anchor{separatefields}
  12183. @section separatefields
  12184. The @code{separatefields} takes a frame-based video input and splits
  12185. each frame into its components fields, producing a new half height clip
  12186. with twice the frame rate and twice the frame count.
  12187. This filter use field-dominance information in frame to decide which
  12188. of each pair of fields to place first in the output.
  12189. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12190. @section setdar, setsar
  12191. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12192. output video.
  12193. This is done by changing the specified Sample (aka Pixel) Aspect
  12194. Ratio, according to the following equation:
  12195. @example
  12196. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12197. @end example
  12198. Keep in mind that the @code{setdar} filter does not modify the pixel
  12199. dimensions of the video frame. Also, the display aspect ratio set by
  12200. this filter may be changed by later filters in the filterchain,
  12201. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12202. applied.
  12203. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12204. the filter output video.
  12205. Note that as a consequence of the application of this filter, the
  12206. output display aspect ratio will change according to the equation
  12207. above.
  12208. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12209. filter may be changed by later filters in the filterchain, e.g. if
  12210. another "setsar" or a "setdar" filter is applied.
  12211. It accepts the following parameters:
  12212. @table @option
  12213. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12214. Set the aspect ratio used by the filter.
  12215. The parameter can be a floating point number string, an expression, or
  12216. a string of the form @var{num}:@var{den}, where @var{num} and
  12217. @var{den} are the numerator and denominator of the aspect ratio. If
  12218. the parameter is not specified, it is assumed the value "0".
  12219. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12220. should be escaped.
  12221. @item max
  12222. Set the maximum integer value to use for expressing numerator and
  12223. denominator when reducing the expressed aspect ratio to a rational.
  12224. Default value is @code{100}.
  12225. @end table
  12226. The parameter @var{sar} is an expression containing
  12227. the following constants:
  12228. @table @option
  12229. @item E, PI, PHI
  12230. These are approximated values for the mathematical constants e
  12231. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12232. @item w, h
  12233. The input width and height.
  12234. @item a
  12235. These are the same as @var{w} / @var{h}.
  12236. @item sar
  12237. The input sample aspect ratio.
  12238. @item dar
  12239. The input display aspect ratio. It is the same as
  12240. (@var{w} / @var{h}) * @var{sar}.
  12241. @item hsub, vsub
  12242. Horizontal and vertical chroma subsample values. For example, for the
  12243. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12244. @end table
  12245. @subsection Examples
  12246. @itemize
  12247. @item
  12248. To change the display aspect ratio to 16:9, specify one of the following:
  12249. @example
  12250. setdar=dar=1.77777
  12251. setdar=dar=16/9
  12252. @end example
  12253. @item
  12254. To change the sample aspect ratio to 10:11, specify:
  12255. @example
  12256. setsar=sar=10/11
  12257. @end example
  12258. @item
  12259. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12260. 1000 in the aspect ratio reduction, use the command:
  12261. @example
  12262. setdar=ratio=16/9:max=1000
  12263. @end example
  12264. @end itemize
  12265. @anchor{setfield}
  12266. @section setfield
  12267. Force field for the output video frame.
  12268. The @code{setfield} filter marks the interlace type field for the
  12269. output frames. It does not change the input frame, but only sets the
  12270. corresponding property, which affects how the frame is treated by
  12271. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12272. The filter accepts the following options:
  12273. @table @option
  12274. @item mode
  12275. Available values are:
  12276. @table @samp
  12277. @item auto
  12278. Keep the same field property.
  12279. @item bff
  12280. Mark the frame as bottom-field-first.
  12281. @item tff
  12282. Mark the frame as top-field-first.
  12283. @item prog
  12284. Mark the frame as progressive.
  12285. @end table
  12286. @end table
  12287. @anchor{setparams}
  12288. @section setparams
  12289. Force frame parameter for the output video frame.
  12290. The @code{setparams} filter marks interlace and color range for the
  12291. output frames. It does not change the input frame, but only sets the
  12292. corresponding property, which affects how the frame is treated by
  12293. filters/encoders.
  12294. @table @option
  12295. @item field_mode
  12296. Available values are:
  12297. @table @samp
  12298. @item auto
  12299. Keep the same field property (default).
  12300. @item bff
  12301. Mark the frame as bottom-field-first.
  12302. @item tff
  12303. Mark the frame as top-field-first.
  12304. @item prog
  12305. Mark the frame as progressive.
  12306. @end table
  12307. @item range
  12308. Available values are:
  12309. @table @samp
  12310. @item auto
  12311. Keep the same color range property (default).
  12312. @item unspecified, unknown
  12313. Mark the frame as unspecified color range.
  12314. @item limited, tv, mpeg
  12315. Mark the frame as limited range.
  12316. @item full, pc, jpeg
  12317. Mark the frame as full range.
  12318. @end table
  12319. @item color_primaries
  12320. Set the color primaries.
  12321. Available values are:
  12322. @table @samp
  12323. @item auto
  12324. Keep the same color primaries property (default).
  12325. @item bt709
  12326. @item unknown
  12327. @item bt470m
  12328. @item bt470bg
  12329. @item smpte170m
  12330. @item smpte240m
  12331. @item film
  12332. @item bt2020
  12333. @item smpte428
  12334. @item smpte431
  12335. @item smpte432
  12336. @item jedec-p22
  12337. @end table
  12338. @item color_trc
  12339. Set the color transfer.
  12340. Available values are:
  12341. @table @samp
  12342. @item auto
  12343. Keep the same color trc property (default).
  12344. @item bt709
  12345. @item unknown
  12346. @item bt470m
  12347. @item bt470bg
  12348. @item smpte170m
  12349. @item smpte240m
  12350. @item linear
  12351. @item log100
  12352. @item log316
  12353. @item iec61966-2-4
  12354. @item bt1361e
  12355. @item iec61966-2-1
  12356. @item bt2020-10
  12357. @item bt2020-12
  12358. @item smpte2084
  12359. @item smpte428
  12360. @item arib-std-b67
  12361. @end table
  12362. @item colorspace
  12363. Set the colorspace.
  12364. Available values are:
  12365. @table @samp
  12366. @item auto
  12367. Keep the same colorspace property (default).
  12368. @item gbr
  12369. @item bt709
  12370. @item unknown
  12371. @item fcc
  12372. @item bt470bg
  12373. @item smpte170m
  12374. @item smpte240m
  12375. @item ycgco
  12376. @item bt2020nc
  12377. @item bt2020c
  12378. @item smpte2085
  12379. @item chroma-derived-nc
  12380. @item chroma-derived-c
  12381. @item ictcp
  12382. @end table
  12383. @end table
  12384. @section showinfo
  12385. Show a line containing various information for each input video frame.
  12386. The input video is not modified.
  12387. This filter supports the following options:
  12388. @table @option
  12389. @item checksum
  12390. Calculate checksums of each plane. By default enabled.
  12391. @end table
  12392. The shown line contains a sequence of key/value pairs of the form
  12393. @var{key}:@var{value}.
  12394. The following values are shown in the output:
  12395. @table @option
  12396. @item n
  12397. The (sequential) number of the input frame, starting from 0.
  12398. @item pts
  12399. The Presentation TimeStamp of the input frame, expressed as a number of
  12400. time base units. The time base unit depends on the filter input pad.
  12401. @item pts_time
  12402. The Presentation TimeStamp of the input frame, expressed as a number of
  12403. seconds.
  12404. @item pos
  12405. The position of the frame in the input stream, or -1 if this information is
  12406. unavailable and/or meaningless (for example in case of synthetic video).
  12407. @item fmt
  12408. The pixel format name.
  12409. @item sar
  12410. The sample aspect ratio of the input frame, expressed in the form
  12411. @var{num}/@var{den}.
  12412. @item s
  12413. The size of the input frame. For the syntax of this option, check the
  12414. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12415. @item i
  12416. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12417. for bottom field first).
  12418. @item iskey
  12419. This is 1 if the frame is a key frame, 0 otherwise.
  12420. @item type
  12421. The picture type of the input frame ("I" for an I-frame, "P" for a
  12422. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12423. Also refer to the documentation of the @code{AVPictureType} enum and of
  12424. the @code{av_get_picture_type_char} function defined in
  12425. @file{libavutil/avutil.h}.
  12426. @item checksum
  12427. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12428. @item plane_checksum
  12429. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12430. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12431. @end table
  12432. @section showpalette
  12433. Displays the 256 colors palette of each frame. This filter is only relevant for
  12434. @var{pal8} pixel format frames.
  12435. It accepts the following option:
  12436. @table @option
  12437. @item s
  12438. Set the size of the box used to represent one palette color entry. Default is
  12439. @code{30} (for a @code{30x30} pixel box).
  12440. @end table
  12441. @section shuffleframes
  12442. Reorder and/or duplicate and/or drop video frames.
  12443. It accepts the following parameters:
  12444. @table @option
  12445. @item mapping
  12446. Set the destination indexes of input frames.
  12447. This is space or '|' separated list of indexes that maps input frames to output
  12448. frames. Number of indexes also sets maximal value that each index may have.
  12449. '-1' index have special meaning and that is to drop frame.
  12450. @end table
  12451. The first frame has the index 0. The default is to keep the input unchanged.
  12452. @subsection Examples
  12453. @itemize
  12454. @item
  12455. Swap second and third frame of every three frames of the input:
  12456. @example
  12457. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12458. @end example
  12459. @item
  12460. Swap 10th and 1st frame of every ten frames of the input:
  12461. @example
  12462. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12463. @end example
  12464. @end itemize
  12465. @section shuffleplanes
  12466. Reorder and/or duplicate video planes.
  12467. It accepts the following parameters:
  12468. @table @option
  12469. @item map0
  12470. The index of the input plane to be used as the first output plane.
  12471. @item map1
  12472. The index of the input plane to be used as the second output plane.
  12473. @item map2
  12474. The index of the input plane to be used as the third output plane.
  12475. @item map3
  12476. The index of the input plane to be used as the fourth output plane.
  12477. @end table
  12478. The first plane has the index 0. The default is to keep the input unchanged.
  12479. @subsection Examples
  12480. @itemize
  12481. @item
  12482. Swap the second and third planes of the input:
  12483. @example
  12484. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12485. @end example
  12486. @end itemize
  12487. @anchor{signalstats}
  12488. @section signalstats
  12489. Evaluate various visual metrics that assist in determining issues associated
  12490. with the digitization of analog video media.
  12491. By default the filter will log these metadata values:
  12492. @table @option
  12493. @item YMIN
  12494. Display the minimal Y value contained within the input frame. Expressed in
  12495. range of [0-255].
  12496. @item YLOW
  12497. Display the Y value at the 10% percentile within the input frame. Expressed in
  12498. range of [0-255].
  12499. @item YAVG
  12500. Display the average Y value within the input frame. Expressed in range of
  12501. [0-255].
  12502. @item YHIGH
  12503. Display the Y value at the 90% percentile within the input frame. Expressed in
  12504. range of [0-255].
  12505. @item YMAX
  12506. Display the maximum Y value contained within the input frame. Expressed in
  12507. range of [0-255].
  12508. @item UMIN
  12509. Display the minimal U value contained within the input frame. Expressed in
  12510. range of [0-255].
  12511. @item ULOW
  12512. Display the U value at the 10% percentile within the input frame. Expressed in
  12513. range of [0-255].
  12514. @item UAVG
  12515. Display the average U value within the input frame. Expressed in range of
  12516. [0-255].
  12517. @item UHIGH
  12518. Display the U value at the 90% percentile within the input frame. Expressed in
  12519. range of [0-255].
  12520. @item UMAX
  12521. Display the maximum U value contained within the input frame. Expressed in
  12522. range of [0-255].
  12523. @item VMIN
  12524. Display the minimal V value contained within the input frame. Expressed in
  12525. range of [0-255].
  12526. @item VLOW
  12527. Display the V value at the 10% percentile within the input frame. Expressed in
  12528. range of [0-255].
  12529. @item VAVG
  12530. Display the average V value within the input frame. Expressed in range of
  12531. [0-255].
  12532. @item VHIGH
  12533. Display the V value at the 90% percentile within the input frame. Expressed in
  12534. range of [0-255].
  12535. @item VMAX
  12536. Display the maximum V value contained within the input frame. Expressed in
  12537. range of [0-255].
  12538. @item SATMIN
  12539. Display the minimal saturation value contained within the input frame.
  12540. Expressed in range of [0-~181.02].
  12541. @item SATLOW
  12542. Display the saturation value at the 10% percentile within the input frame.
  12543. Expressed in range of [0-~181.02].
  12544. @item SATAVG
  12545. Display the average saturation value within the input frame. Expressed in range
  12546. of [0-~181.02].
  12547. @item SATHIGH
  12548. Display the saturation value at the 90% percentile within the input frame.
  12549. Expressed in range of [0-~181.02].
  12550. @item SATMAX
  12551. Display the maximum saturation value contained within the input frame.
  12552. Expressed in range of [0-~181.02].
  12553. @item HUEMED
  12554. Display the median value for hue within the input frame. Expressed in range of
  12555. [0-360].
  12556. @item HUEAVG
  12557. Display the average value for hue within the input frame. Expressed in range of
  12558. [0-360].
  12559. @item YDIF
  12560. Display the average of sample value difference between all values of the Y
  12561. plane in the current frame and corresponding values of the previous input frame.
  12562. Expressed in range of [0-255].
  12563. @item UDIF
  12564. Display the average of sample value difference between all values of the U
  12565. plane in the current frame and corresponding values of the previous input frame.
  12566. Expressed in range of [0-255].
  12567. @item VDIF
  12568. Display the average of sample value difference between all values of the V
  12569. plane in the current frame and corresponding values of the previous input frame.
  12570. Expressed in range of [0-255].
  12571. @item YBITDEPTH
  12572. Display bit depth of Y plane in current frame.
  12573. Expressed in range of [0-16].
  12574. @item UBITDEPTH
  12575. Display bit depth of U plane in current frame.
  12576. Expressed in range of [0-16].
  12577. @item VBITDEPTH
  12578. Display bit depth of V plane in current frame.
  12579. Expressed in range of [0-16].
  12580. @end table
  12581. The filter accepts the following options:
  12582. @table @option
  12583. @item stat
  12584. @item out
  12585. @option{stat} specify an additional form of image analysis.
  12586. @option{out} output video with the specified type of pixel highlighted.
  12587. Both options accept the following values:
  12588. @table @samp
  12589. @item tout
  12590. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12591. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12592. include the results of video dropouts, head clogs, or tape tracking issues.
  12593. @item vrep
  12594. Identify @var{vertical line repetition}. Vertical line repetition includes
  12595. similar rows of pixels within a frame. In born-digital video vertical line
  12596. repetition is common, but this pattern is uncommon in video digitized from an
  12597. analog source. When it occurs in video that results from the digitization of an
  12598. analog source it can indicate concealment from a dropout compensator.
  12599. @item brng
  12600. Identify pixels that fall outside of legal broadcast range.
  12601. @end table
  12602. @item color, c
  12603. Set the highlight color for the @option{out} option. The default color is
  12604. yellow.
  12605. @end table
  12606. @subsection Examples
  12607. @itemize
  12608. @item
  12609. Output data of various video metrics:
  12610. @example
  12611. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12612. @end example
  12613. @item
  12614. Output specific data about the minimum and maximum values of the Y plane per frame:
  12615. @example
  12616. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12617. @end example
  12618. @item
  12619. Playback video while highlighting pixels that are outside of broadcast range in red.
  12620. @example
  12621. ffplay example.mov -vf signalstats="out=brng:color=red"
  12622. @end example
  12623. @item
  12624. Playback video with signalstats metadata drawn over the frame.
  12625. @example
  12626. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12627. @end example
  12628. The contents of signalstat_drawtext.txt used in the command are:
  12629. @example
  12630. time %@{pts:hms@}
  12631. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12632. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12633. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12634. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12635. @end example
  12636. @end itemize
  12637. @anchor{signature}
  12638. @section signature
  12639. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12640. input. In this case the matching between the inputs can be calculated additionally.
  12641. The filter always passes through the first input. The signature of each stream can
  12642. be written into a file.
  12643. It accepts the following options:
  12644. @table @option
  12645. @item detectmode
  12646. Enable or disable the matching process.
  12647. Available values are:
  12648. @table @samp
  12649. @item off
  12650. Disable the calculation of a matching (default).
  12651. @item full
  12652. Calculate the matching for the whole video and output whether the whole video
  12653. matches or only parts.
  12654. @item fast
  12655. Calculate only until a matching is found or the video ends. Should be faster in
  12656. some cases.
  12657. @end table
  12658. @item nb_inputs
  12659. Set the number of inputs. The option value must be a non negative integer.
  12660. Default value is 1.
  12661. @item filename
  12662. Set the path to which the output is written. If there is more than one input,
  12663. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12664. integer), that will be replaced with the input number. If no filename is
  12665. specified, no output will be written. This is the default.
  12666. @item format
  12667. Choose the output format.
  12668. Available values are:
  12669. @table @samp
  12670. @item binary
  12671. Use the specified binary representation (default).
  12672. @item xml
  12673. Use the specified xml representation.
  12674. @end table
  12675. @item th_d
  12676. Set threshold to detect one word as similar. The option value must be an integer
  12677. greater than zero. The default value is 9000.
  12678. @item th_dc
  12679. Set threshold to detect all words as similar. The option value must be an integer
  12680. greater than zero. The default value is 60000.
  12681. @item th_xh
  12682. Set threshold to detect frames as similar. The option value must be an integer
  12683. greater than zero. The default value is 116.
  12684. @item th_di
  12685. Set the minimum length of a sequence in frames to recognize it as matching
  12686. sequence. The option value must be a non negative integer value.
  12687. The default value is 0.
  12688. @item th_it
  12689. Set the minimum relation, that matching frames to all frames must have.
  12690. The option value must be a double value between 0 and 1. The default value is 0.5.
  12691. @end table
  12692. @subsection Examples
  12693. @itemize
  12694. @item
  12695. To calculate the signature of an input video and store it in signature.bin:
  12696. @example
  12697. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12698. @end example
  12699. @item
  12700. To detect whether two videos match and store the signatures in XML format in
  12701. signature0.xml and signature1.xml:
  12702. @example
  12703. 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 -
  12704. @end example
  12705. @end itemize
  12706. @anchor{smartblur}
  12707. @section smartblur
  12708. Blur the input video without impacting the outlines.
  12709. It accepts the following options:
  12710. @table @option
  12711. @item luma_radius, lr
  12712. Set the luma radius. The option value must be a float number in
  12713. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12714. used to blur the image (slower if larger). Default value is 1.0.
  12715. @item luma_strength, ls
  12716. Set the luma strength. The option value must be a float number
  12717. in the range [-1.0,1.0] that configures the blurring. A value included
  12718. in [0.0,1.0] will blur the image whereas a value included in
  12719. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12720. @item luma_threshold, lt
  12721. Set the luma threshold used as a coefficient to determine
  12722. whether a pixel should be blurred or not. The option value must be an
  12723. integer in the range [-30,30]. A value of 0 will filter all the image,
  12724. a value included in [0,30] will filter flat areas and a value included
  12725. in [-30,0] will filter edges. Default value is 0.
  12726. @item chroma_radius, cr
  12727. Set the chroma radius. The option value must be a float number in
  12728. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12729. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12730. @item chroma_strength, cs
  12731. Set the chroma strength. The option value must be a float number
  12732. in the range [-1.0,1.0] that configures the blurring. A value included
  12733. in [0.0,1.0] will blur the image whereas a value included in
  12734. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12735. @item chroma_threshold, ct
  12736. Set the chroma threshold used as a coefficient to determine
  12737. whether a pixel should be blurred or not. The option value must be an
  12738. integer in the range [-30,30]. A value of 0 will filter all the image,
  12739. a value included in [0,30] will filter flat areas and a value included
  12740. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12741. @end table
  12742. If a chroma option is not explicitly set, the corresponding luma value
  12743. is set.
  12744. @section sobel
  12745. Apply sobel operator to input video stream.
  12746. The filter accepts the following option:
  12747. @table @option
  12748. @item planes
  12749. Set which planes will be processed, unprocessed planes will be copied.
  12750. By default value 0xf, all planes will be processed.
  12751. @item scale
  12752. Set value which will be multiplied with filtered result.
  12753. @item delta
  12754. Set value which will be added to filtered result.
  12755. @end table
  12756. @anchor{spp}
  12757. @section spp
  12758. Apply a simple postprocessing filter that compresses and decompresses the image
  12759. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12760. and average the results.
  12761. The filter accepts the following options:
  12762. @table @option
  12763. @item quality
  12764. Set quality. This option defines the number of levels for averaging. It accepts
  12765. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12766. effect. A value of @code{6} means the higher quality. For each increment of
  12767. that value the speed drops by a factor of approximately 2. Default value is
  12768. @code{3}.
  12769. @item qp
  12770. Force a constant quantization parameter. If not set, the filter will use the QP
  12771. from the video stream (if available).
  12772. @item mode
  12773. Set thresholding mode. Available modes are:
  12774. @table @samp
  12775. @item hard
  12776. Set hard thresholding (default).
  12777. @item soft
  12778. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12779. @end table
  12780. @item use_bframe_qp
  12781. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12782. option may cause flicker since the B-Frames have often larger QP. Default is
  12783. @code{0} (not enabled).
  12784. @end table
  12785. @section sr
  12786. Scale the input by applying one of the super-resolution methods based on
  12787. convolutional neural networks. Supported models:
  12788. @itemize
  12789. @item
  12790. Super-Resolution Convolutional Neural Network model (SRCNN).
  12791. See @url{https://arxiv.org/abs/1501.00092}.
  12792. @item
  12793. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12794. See @url{https://arxiv.org/abs/1609.05158}.
  12795. @end itemize
  12796. Training scripts as well as scripts for model file (.pb) saving can be found at
  12797. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  12798. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12799. Native model files (.model) can be generated from TensorFlow model
  12800. files (.pb) by using tools/python/convert.py
  12801. The filter accepts the following options:
  12802. @table @option
  12803. @item dnn_backend
  12804. Specify which DNN backend to use for model loading and execution. This option accepts
  12805. the following values:
  12806. @table @samp
  12807. @item native
  12808. Native implementation of DNN loading and execution.
  12809. @item tensorflow
  12810. TensorFlow backend. To enable this backend you
  12811. need to install the TensorFlow for C library (see
  12812. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12813. @code{--enable-libtensorflow}
  12814. @end table
  12815. Default value is @samp{native}.
  12816. @item model
  12817. Set path to model file specifying network architecture and its parameters.
  12818. Note that different backends use different file formats. TensorFlow backend
  12819. can load files for both formats, while native backend can load files for only
  12820. its format.
  12821. @item scale_factor
  12822. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12823. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12824. input upscaled using bicubic upscaling with proper scale factor.
  12825. @end table
  12826. @section ssim
  12827. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12828. This filter takes in input two input videos, the first input is
  12829. considered the "main" source and is passed unchanged to the
  12830. output. The second input is used as a "reference" video for computing
  12831. the SSIM.
  12832. Both video inputs must have the same resolution and pixel format for
  12833. this filter to work correctly. Also it assumes that both inputs
  12834. have the same number of frames, which are compared one by one.
  12835. The filter stores the calculated SSIM of each frame.
  12836. The description of the accepted parameters follows.
  12837. @table @option
  12838. @item stats_file, f
  12839. If specified the filter will use the named file to save the SSIM of
  12840. each individual frame. When filename equals "-" the data is sent to
  12841. standard output.
  12842. @end table
  12843. The file printed if @var{stats_file} is selected, contains a sequence of
  12844. key/value pairs of the form @var{key}:@var{value} for each compared
  12845. couple of frames.
  12846. A description of each shown parameter follows:
  12847. @table @option
  12848. @item n
  12849. sequential number of the input frame, starting from 1
  12850. @item Y, U, V, R, G, B
  12851. SSIM of the compared frames for the component specified by the suffix.
  12852. @item All
  12853. SSIM of the compared frames for the whole frame.
  12854. @item dB
  12855. Same as above but in dB representation.
  12856. @end table
  12857. This filter also supports the @ref{framesync} options.
  12858. For example:
  12859. @example
  12860. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12861. [main][ref] ssim="stats_file=stats.log" [out]
  12862. @end example
  12863. On this example the input file being processed is compared with the
  12864. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12865. is stored in @file{stats.log}.
  12866. Another example with both psnr and ssim at same time:
  12867. @example
  12868. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12869. @end example
  12870. @section stereo3d
  12871. Convert between different stereoscopic image formats.
  12872. The filters accept the following options:
  12873. @table @option
  12874. @item in
  12875. Set stereoscopic image format of input.
  12876. Available values for input image formats are:
  12877. @table @samp
  12878. @item sbsl
  12879. side by side parallel (left eye left, right eye right)
  12880. @item sbsr
  12881. side by side crosseye (right eye left, left eye right)
  12882. @item sbs2l
  12883. side by side parallel with half width resolution
  12884. (left eye left, right eye right)
  12885. @item sbs2r
  12886. side by side crosseye with half width resolution
  12887. (right eye left, left eye right)
  12888. @item abl
  12889. @item tbl
  12890. above-below (left eye above, right eye below)
  12891. @item abr
  12892. @item tbr
  12893. above-below (right eye above, left eye below)
  12894. @item ab2l
  12895. @item tb2l
  12896. above-below with half height resolution
  12897. (left eye above, right eye below)
  12898. @item ab2r
  12899. @item tb2r
  12900. above-below with half height resolution
  12901. (right eye above, left eye below)
  12902. @item al
  12903. alternating frames (left eye first, right eye second)
  12904. @item ar
  12905. alternating frames (right eye first, left eye second)
  12906. @item irl
  12907. interleaved rows (left eye has top row, right eye starts on next row)
  12908. @item irr
  12909. interleaved rows (right eye has top row, left eye starts on next row)
  12910. @item icl
  12911. interleaved columns, left eye first
  12912. @item icr
  12913. interleaved columns, right eye first
  12914. Default value is @samp{sbsl}.
  12915. @end table
  12916. @item out
  12917. Set stereoscopic image format of output.
  12918. @table @samp
  12919. @item sbsl
  12920. side by side parallel (left eye left, right eye right)
  12921. @item sbsr
  12922. side by side crosseye (right eye left, left eye right)
  12923. @item sbs2l
  12924. side by side parallel with half width resolution
  12925. (left eye left, right eye right)
  12926. @item sbs2r
  12927. side by side crosseye with half width resolution
  12928. (right eye left, left eye right)
  12929. @item abl
  12930. @item tbl
  12931. above-below (left eye above, right eye below)
  12932. @item abr
  12933. @item tbr
  12934. above-below (right eye above, left eye below)
  12935. @item ab2l
  12936. @item tb2l
  12937. above-below with half height resolution
  12938. (left eye above, right eye below)
  12939. @item ab2r
  12940. @item tb2r
  12941. above-below with half height resolution
  12942. (right eye above, left eye below)
  12943. @item al
  12944. alternating frames (left eye first, right eye second)
  12945. @item ar
  12946. alternating frames (right eye first, left eye second)
  12947. @item irl
  12948. interleaved rows (left eye has top row, right eye starts on next row)
  12949. @item irr
  12950. interleaved rows (right eye has top row, left eye starts on next row)
  12951. @item arbg
  12952. anaglyph red/blue gray
  12953. (red filter on left eye, blue filter on right eye)
  12954. @item argg
  12955. anaglyph red/green gray
  12956. (red filter on left eye, green filter on right eye)
  12957. @item arcg
  12958. anaglyph red/cyan gray
  12959. (red filter on left eye, cyan filter on right eye)
  12960. @item arch
  12961. anaglyph red/cyan half colored
  12962. (red filter on left eye, cyan filter on right eye)
  12963. @item arcc
  12964. anaglyph red/cyan color
  12965. (red filter on left eye, cyan filter on right eye)
  12966. @item arcd
  12967. anaglyph red/cyan color optimized with the least squares projection of dubois
  12968. (red filter on left eye, cyan filter on right eye)
  12969. @item agmg
  12970. anaglyph green/magenta gray
  12971. (green filter on left eye, magenta filter on right eye)
  12972. @item agmh
  12973. anaglyph green/magenta half colored
  12974. (green filter on left eye, magenta filter on right eye)
  12975. @item agmc
  12976. anaglyph green/magenta colored
  12977. (green filter on left eye, magenta filter on right eye)
  12978. @item agmd
  12979. anaglyph green/magenta color optimized with the least squares projection of dubois
  12980. (green filter on left eye, magenta filter on right eye)
  12981. @item aybg
  12982. anaglyph yellow/blue gray
  12983. (yellow filter on left eye, blue filter on right eye)
  12984. @item aybh
  12985. anaglyph yellow/blue half colored
  12986. (yellow filter on left eye, blue filter on right eye)
  12987. @item aybc
  12988. anaglyph yellow/blue colored
  12989. (yellow filter on left eye, blue filter on right eye)
  12990. @item aybd
  12991. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12992. (yellow filter on left eye, blue filter on right eye)
  12993. @item ml
  12994. mono output (left eye only)
  12995. @item mr
  12996. mono output (right eye only)
  12997. @item chl
  12998. checkerboard, left eye first
  12999. @item chr
  13000. checkerboard, right eye first
  13001. @item icl
  13002. interleaved columns, left eye first
  13003. @item icr
  13004. interleaved columns, right eye first
  13005. @item hdmi
  13006. HDMI frame pack
  13007. @end table
  13008. Default value is @samp{arcd}.
  13009. @end table
  13010. @subsection Examples
  13011. @itemize
  13012. @item
  13013. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  13014. @example
  13015. stereo3d=sbsl:aybd
  13016. @end example
  13017. @item
  13018. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  13019. @example
  13020. stereo3d=abl:sbsr
  13021. @end example
  13022. @end itemize
  13023. @section streamselect, astreamselect
  13024. Select video or audio streams.
  13025. The filter accepts the following options:
  13026. @table @option
  13027. @item inputs
  13028. Set number of inputs. Default is 2.
  13029. @item map
  13030. Set input indexes to remap to outputs.
  13031. @end table
  13032. @subsection Commands
  13033. The @code{streamselect} and @code{astreamselect} filter supports the following
  13034. commands:
  13035. @table @option
  13036. @item map
  13037. Set input indexes to remap to outputs.
  13038. @end table
  13039. @subsection Examples
  13040. @itemize
  13041. @item
  13042. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13043. @example
  13044. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13045. @end example
  13046. @item
  13047. Same as above, but for audio:
  13048. @example
  13049. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13050. @end example
  13051. @end itemize
  13052. @anchor{subtitles}
  13053. @section subtitles
  13054. Draw subtitles on top of input video using the libass library.
  13055. To enable compilation of this filter you need to configure FFmpeg with
  13056. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13057. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13058. Alpha) subtitles format.
  13059. The filter accepts the following options:
  13060. @table @option
  13061. @item filename, f
  13062. Set the filename of the subtitle file to read. It must be specified.
  13063. @item original_size
  13064. Specify the size of the original video, the video for which the ASS file
  13065. was composed. For the syntax of this option, check the
  13066. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13067. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13068. correctly scale the fonts if the aspect ratio has been changed.
  13069. @item fontsdir
  13070. Set a directory path containing fonts that can be used by the filter.
  13071. These fonts will be used in addition to whatever the font provider uses.
  13072. @item alpha
  13073. Process alpha channel, by default alpha channel is untouched.
  13074. @item charenc
  13075. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13076. useful if not UTF-8.
  13077. @item stream_index, si
  13078. Set subtitles stream index. @code{subtitles} filter only.
  13079. @item force_style
  13080. Override default style or script info parameters of the subtitles. It accepts a
  13081. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13082. @end table
  13083. If the first key is not specified, it is assumed that the first value
  13084. specifies the @option{filename}.
  13085. For example, to render the file @file{sub.srt} on top of the input
  13086. video, use the command:
  13087. @example
  13088. subtitles=sub.srt
  13089. @end example
  13090. which is equivalent to:
  13091. @example
  13092. subtitles=filename=sub.srt
  13093. @end example
  13094. To render the default subtitles stream from file @file{video.mkv}, use:
  13095. @example
  13096. subtitles=video.mkv
  13097. @end example
  13098. To render the second subtitles stream from that file, use:
  13099. @example
  13100. subtitles=video.mkv:si=1
  13101. @end example
  13102. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13103. @code{DejaVu Serif}, use:
  13104. @example
  13105. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13106. @end example
  13107. @section super2xsai
  13108. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13109. Interpolate) pixel art scaling algorithm.
  13110. Useful for enlarging pixel art images without reducing sharpness.
  13111. @section swaprect
  13112. Swap two rectangular objects in video.
  13113. This filter accepts the following options:
  13114. @table @option
  13115. @item w
  13116. Set object width.
  13117. @item h
  13118. Set object height.
  13119. @item x1
  13120. Set 1st rect x coordinate.
  13121. @item y1
  13122. Set 1st rect y coordinate.
  13123. @item x2
  13124. Set 2nd rect x coordinate.
  13125. @item y2
  13126. Set 2nd rect y coordinate.
  13127. All expressions are evaluated once for each frame.
  13128. @end table
  13129. The all options are expressions containing the following constants:
  13130. @table @option
  13131. @item w
  13132. @item h
  13133. The input width and height.
  13134. @item a
  13135. same as @var{w} / @var{h}
  13136. @item sar
  13137. input sample aspect ratio
  13138. @item dar
  13139. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13140. @item n
  13141. The number of the input frame, starting from 0.
  13142. @item t
  13143. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13144. @item pos
  13145. the position in the file of the input frame, NAN if unknown
  13146. @end table
  13147. @section swapuv
  13148. Swap U & V plane.
  13149. @section telecine
  13150. Apply telecine process to the video.
  13151. This filter accepts the following options:
  13152. @table @option
  13153. @item first_field
  13154. @table @samp
  13155. @item top, t
  13156. top field first
  13157. @item bottom, b
  13158. bottom field first
  13159. The default value is @code{top}.
  13160. @end table
  13161. @item pattern
  13162. A string of numbers representing the pulldown pattern you wish to apply.
  13163. The default value is @code{23}.
  13164. @end table
  13165. @example
  13166. Some typical patterns:
  13167. NTSC output (30i):
  13168. 27.5p: 32222
  13169. 24p: 23 (classic)
  13170. 24p: 2332 (preferred)
  13171. 20p: 33
  13172. 18p: 334
  13173. 16p: 3444
  13174. PAL output (25i):
  13175. 27.5p: 12222
  13176. 24p: 222222222223 ("Euro pulldown")
  13177. 16.67p: 33
  13178. 16p: 33333334
  13179. @end example
  13180. @section threshold
  13181. Apply threshold effect to video stream.
  13182. This filter needs four video streams to perform thresholding.
  13183. First stream is stream we are filtering.
  13184. Second stream is holding threshold values, third stream is holding min values,
  13185. and last, fourth stream is holding max values.
  13186. The filter accepts the following option:
  13187. @table @option
  13188. @item planes
  13189. Set which planes will be processed, unprocessed planes will be copied.
  13190. By default value 0xf, all planes will be processed.
  13191. @end table
  13192. For example if first stream pixel's component value is less then threshold value
  13193. of pixel component from 2nd threshold stream, third stream value will picked,
  13194. otherwise fourth stream pixel component value will be picked.
  13195. Using color source filter one can perform various types of thresholding:
  13196. @subsection Examples
  13197. @itemize
  13198. @item
  13199. Binary threshold, using gray color as threshold:
  13200. @example
  13201. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13202. @end example
  13203. @item
  13204. Inverted binary threshold, using gray color as threshold:
  13205. @example
  13206. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13207. @end example
  13208. @item
  13209. Truncate binary threshold, using gray color as threshold:
  13210. @example
  13211. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13212. @end example
  13213. @item
  13214. Threshold to zero, using gray color as threshold:
  13215. @example
  13216. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13217. @end example
  13218. @item
  13219. Inverted threshold to zero, using gray color as threshold:
  13220. @example
  13221. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13222. @end example
  13223. @end itemize
  13224. @section thumbnail
  13225. Select the most representative frame in a given sequence of consecutive frames.
  13226. The filter accepts the following options:
  13227. @table @option
  13228. @item n
  13229. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13230. will pick one of them, and then handle the next batch of @var{n} frames until
  13231. the end. Default is @code{100}.
  13232. @end table
  13233. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13234. value will result in a higher memory usage, so a high value is not recommended.
  13235. @subsection Examples
  13236. @itemize
  13237. @item
  13238. Extract one picture each 50 frames:
  13239. @example
  13240. thumbnail=50
  13241. @end example
  13242. @item
  13243. Complete example of a thumbnail creation with @command{ffmpeg}:
  13244. @example
  13245. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13246. @end example
  13247. @end itemize
  13248. @section tile
  13249. Tile several successive frames together.
  13250. The filter accepts the following options:
  13251. @table @option
  13252. @item layout
  13253. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13254. this option, check the
  13255. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13256. @item nb_frames
  13257. Set the maximum number of frames to render in the given area. It must be less
  13258. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13259. the area will be used.
  13260. @item margin
  13261. Set the outer border margin in pixels.
  13262. @item padding
  13263. Set the inner border thickness (i.e. the number of pixels between frames). For
  13264. more advanced padding options (such as having different values for the edges),
  13265. refer to the pad video filter.
  13266. @item color
  13267. Specify the color of the unused area. For the syntax of this option, check the
  13268. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13269. The default value of @var{color} is "black".
  13270. @item overlap
  13271. Set the number of frames to overlap when tiling several successive frames together.
  13272. The value must be between @code{0} and @var{nb_frames - 1}.
  13273. @item init_padding
  13274. Set the number of frames to initially be empty before displaying first output frame.
  13275. This controls how soon will one get first output frame.
  13276. The value must be between @code{0} and @var{nb_frames - 1}.
  13277. @end table
  13278. @subsection Examples
  13279. @itemize
  13280. @item
  13281. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13282. @example
  13283. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13284. @end example
  13285. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13286. duplicating each output frame to accommodate the originally detected frame
  13287. rate.
  13288. @item
  13289. Display @code{5} pictures in an area of @code{3x2} frames,
  13290. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13291. mixed flat and named options:
  13292. @example
  13293. tile=3x2:nb_frames=5:padding=7:margin=2
  13294. @end example
  13295. @end itemize
  13296. @section tinterlace
  13297. Perform various types of temporal field interlacing.
  13298. Frames are counted starting from 1, so the first input frame is
  13299. considered odd.
  13300. The filter accepts the following options:
  13301. @table @option
  13302. @item mode
  13303. Specify the mode of the interlacing. This option can also be specified
  13304. as a value alone. See below for a list of values for this option.
  13305. Available values are:
  13306. @table @samp
  13307. @item merge, 0
  13308. Move odd frames into the upper field, even into the lower field,
  13309. generating a double height frame at half frame rate.
  13310. @example
  13311. ------> time
  13312. Input:
  13313. Frame 1 Frame 2 Frame 3 Frame 4
  13314. 11111 22222 33333 44444
  13315. 11111 22222 33333 44444
  13316. 11111 22222 33333 44444
  13317. 11111 22222 33333 44444
  13318. Output:
  13319. 11111 33333
  13320. 22222 44444
  13321. 11111 33333
  13322. 22222 44444
  13323. 11111 33333
  13324. 22222 44444
  13325. 11111 33333
  13326. 22222 44444
  13327. @end example
  13328. @item drop_even, 1
  13329. Only output odd frames, even frames are dropped, generating a frame with
  13330. unchanged height at half frame rate.
  13331. @example
  13332. ------> time
  13333. Input:
  13334. Frame 1 Frame 2 Frame 3 Frame 4
  13335. 11111 22222 33333 44444
  13336. 11111 22222 33333 44444
  13337. 11111 22222 33333 44444
  13338. 11111 22222 33333 44444
  13339. Output:
  13340. 11111 33333
  13341. 11111 33333
  13342. 11111 33333
  13343. 11111 33333
  13344. @end example
  13345. @item drop_odd, 2
  13346. Only output even frames, odd frames are dropped, generating a frame with
  13347. unchanged height at half frame rate.
  13348. @example
  13349. ------> time
  13350. Input:
  13351. Frame 1 Frame 2 Frame 3 Frame 4
  13352. 11111 22222 33333 44444
  13353. 11111 22222 33333 44444
  13354. 11111 22222 33333 44444
  13355. 11111 22222 33333 44444
  13356. Output:
  13357. 22222 44444
  13358. 22222 44444
  13359. 22222 44444
  13360. 22222 44444
  13361. @end example
  13362. @item pad, 3
  13363. Expand each frame to full height, but pad alternate lines with black,
  13364. generating a frame with double height at the same input frame rate.
  13365. @example
  13366. ------> time
  13367. Input:
  13368. Frame 1 Frame 2 Frame 3 Frame 4
  13369. 11111 22222 33333 44444
  13370. 11111 22222 33333 44444
  13371. 11111 22222 33333 44444
  13372. 11111 22222 33333 44444
  13373. Output:
  13374. 11111 ..... 33333 .....
  13375. ..... 22222 ..... 44444
  13376. 11111 ..... 33333 .....
  13377. ..... 22222 ..... 44444
  13378. 11111 ..... 33333 .....
  13379. ..... 22222 ..... 44444
  13380. 11111 ..... 33333 .....
  13381. ..... 22222 ..... 44444
  13382. @end example
  13383. @item interleave_top, 4
  13384. Interleave the upper field from odd frames with the lower field from
  13385. even frames, generating a frame with unchanged height at half frame rate.
  13386. @example
  13387. ------> time
  13388. Input:
  13389. Frame 1 Frame 2 Frame 3 Frame 4
  13390. 11111<- 22222 33333<- 44444
  13391. 11111 22222<- 33333 44444<-
  13392. 11111<- 22222 33333<- 44444
  13393. 11111 22222<- 33333 44444<-
  13394. Output:
  13395. 11111 33333
  13396. 22222 44444
  13397. 11111 33333
  13398. 22222 44444
  13399. @end example
  13400. @item interleave_bottom, 5
  13401. Interleave the lower field from odd frames with the upper field from
  13402. even frames, generating a frame with unchanged height at half frame rate.
  13403. @example
  13404. ------> time
  13405. Input:
  13406. Frame 1 Frame 2 Frame 3 Frame 4
  13407. 11111 22222<- 33333 44444<-
  13408. 11111<- 22222 33333<- 44444
  13409. 11111 22222<- 33333 44444<-
  13410. 11111<- 22222 33333<- 44444
  13411. Output:
  13412. 22222 44444
  13413. 11111 33333
  13414. 22222 44444
  13415. 11111 33333
  13416. @end example
  13417. @item interlacex2, 6
  13418. Double frame rate with unchanged height. Frames are inserted each
  13419. containing the second temporal field from the previous input frame and
  13420. the first temporal field from the next input frame. This mode relies on
  13421. the top_field_first flag. Useful for interlaced video displays with no
  13422. field synchronisation.
  13423. @example
  13424. ------> time
  13425. Input:
  13426. Frame 1 Frame 2 Frame 3 Frame 4
  13427. 11111 22222 33333 44444
  13428. 11111 22222 33333 44444
  13429. 11111 22222 33333 44444
  13430. 11111 22222 33333 44444
  13431. Output:
  13432. 11111 22222 22222 33333 33333 44444 44444
  13433. 11111 11111 22222 22222 33333 33333 44444
  13434. 11111 22222 22222 33333 33333 44444 44444
  13435. 11111 11111 22222 22222 33333 33333 44444
  13436. @end example
  13437. @item mergex2, 7
  13438. Move odd frames into the upper field, even into the lower field,
  13439. generating a double height frame at same frame rate.
  13440. @example
  13441. ------> time
  13442. Input:
  13443. Frame 1 Frame 2 Frame 3 Frame 4
  13444. 11111 22222 33333 44444
  13445. 11111 22222 33333 44444
  13446. 11111 22222 33333 44444
  13447. 11111 22222 33333 44444
  13448. Output:
  13449. 11111 33333 33333 55555
  13450. 22222 22222 44444 44444
  13451. 11111 33333 33333 55555
  13452. 22222 22222 44444 44444
  13453. 11111 33333 33333 55555
  13454. 22222 22222 44444 44444
  13455. 11111 33333 33333 55555
  13456. 22222 22222 44444 44444
  13457. @end example
  13458. @end table
  13459. Numeric values are deprecated but are accepted for backward
  13460. compatibility reasons.
  13461. Default mode is @code{merge}.
  13462. @item flags
  13463. Specify flags influencing the filter process.
  13464. Available value for @var{flags} is:
  13465. @table @option
  13466. @item low_pass_filter, vlpf
  13467. Enable linear vertical low-pass filtering in the filter.
  13468. Vertical low-pass filtering is required when creating an interlaced
  13469. destination from a progressive source which contains high-frequency
  13470. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13471. patterning.
  13472. @item complex_filter, cvlpf
  13473. Enable complex vertical low-pass filtering.
  13474. This will slightly less reduce interlace 'twitter' and Moire
  13475. patterning but better retain detail and subjective sharpness impression.
  13476. @end table
  13477. Vertical low-pass filtering can only be enabled for @option{mode}
  13478. @var{interleave_top} and @var{interleave_bottom}.
  13479. @end table
  13480. @section tmix
  13481. Mix successive video frames.
  13482. A description of the accepted options follows.
  13483. @table @option
  13484. @item frames
  13485. The number of successive frames to mix. If unspecified, it defaults to 3.
  13486. @item weights
  13487. Specify weight of each input video frame.
  13488. Each weight is separated by space. If number of weights is smaller than
  13489. number of @var{frames} last specified weight will be used for all remaining
  13490. unset weights.
  13491. @item scale
  13492. Specify scale, if it is set it will be multiplied with sum
  13493. of each weight multiplied with pixel values to give final destination
  13494. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13495. @end table
  13496. @subsection Examples
  13497. @itemize
  13498. @item
  13499. Average 7 successive frames:
  13500. @example
  13501. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13502. @end example
  13503. @item
  13504. Apply simple temporal convolution:
  13505. @example
  13506. tmix=frames=3:weights="-1 3 -1"
  13507. @end example
  13508. @item
  13509. Similar as above but only showing temporal differences:
  13510. @example
  13511. tmix=frames=3:weights="-1 2 -1":scale=1
  13512. @end example
  13513. @end itemize
  13514. @anchor{tonemap}
  13515. @section tonemap
  13516. Tone map colors from different dynamic ranges.
  13517. This filter expects data in single precision floating point, as it needs to
  13518. operate on (and can output) out-of-range values. Another filter, such as
  13519. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13520. The tonemapping algorithms implemented only work on linear light, so input
  13521. data should be linearized beforehand (and possibly correctly tagged).
  13522. @example
  13523. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13524. @end example
  13525. @subsection Options
  13526. The filter accepts the following options.
  13527. @table @option
  13528. @item tonemap
  13529. Set the tone map algorithm to use.
  13530. Possible values are:
  13531. @table @var
  13532. @item none
  13533. Do not apply any tone map, only desaturate overbright pixels.
  13534. @item clip
  13535. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13536. in-range values, while distorting out-of-range values.
  13537. @item linear
  13538. Stretch the entire reference gamut to a linear multiple of the display.
  13539. @item gamma
  13540. Fit a logarithmic transfer between the tone curves.
  13541. @item reinhard
  13542. Preserve overall image brightness with a simple curve, using nonlinear
  13543. contrast, which results in flattening details and degrading color accuracy.
  13544. @item hable
  13545. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13546. of slightly darkening everything. Use it when detail preservation is more
  13547. important than color and brightness accuracy.
  13548. @item mobius
  13549. Smoothly map out-of-range values, while retaining contrast and colors for
  13550. in-range material as much as possible. Use it when color accuracy is more
  13551. important than detail preservation.
  13552. @end table
  13553. Default is none.
  13554. @item param
  13555. Tune the tone mapping algorithm.
  13556. This affects the following algorithms:
  13557. @table @var
  13558. @item none
  13559. Ignored.
  13560. @item linear
  13561. Specifies the scale factor to use while stretching.
  13562. Default to 1.0.
  13563. @item gamma
  13564. Specifies the exponent of the function.
  13565. Default to 1.8.
  13566. @item clip
  13567. Specify an extra linear coefficient to multiply into the signal before clipping.
  13568. Default to 1.0.
  13569. @item reinhard
  13570. Specify the local contrast coefficient at the display peak.
  13571. Default to 0.5, which means that in-gamut values will be about half as bright
  13572. as when clipping.
  13573. @item hable
  13574. Ignored.
  13575. @item mobius
  13576. Specify the transition point from linear to mobius transform. Every value
  13577. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13578. more accurate the result will be, at the cost of losing bright details.
  13579. Default to 0.3, which due to the steep initial slope still preserves in-range
  13580. colors fairly accurately.
  13581. @end table
  13582. @item desat
  13583. Apply desaturation for highlights that exceed this level of brightness. The
  13584. higher the parameter, the more color information will be preserved. This
  13585. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13586. (smoothly) turning into white instead. This makes images feel more natural,
  13587. at the cost of reducing information about out-of-range colors.
  13588. The default of 2.0 is somewhat conservative and will mostly just apply to
  13589. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13590. This option works only if the input frame has a supported color tag.
  13591. @item peak
  13592. Override signal/nominal/reference peak with this value. Useful when the
  13593. embedded peak information in display metadata is not reliable or when tone
  13594. mapping from a lower range to a higher range.
  13595. @end table
  13596. @section tpad
  13597. Temporarily pad video frames.
  13598. The filter accepts the following options:
  13599. @table @option
  13600. @item start
  13601. Specify number of delay frames before input video stream.
  13602. @item stop
  13603. Specify number of padding frames after input video stream.
  13604. Set to -1 to pad indefinitely.
  13605. @item start_mode
  13606. Set kind of frames added to beginning of stream.
  13607. Can be either @var{add} or @var{clone}.
  13608. With @var{add} frames of solid-color are added.
  13609. With @var{clone} frames are clones of first frame.
  13610. @item stop_mode
  13611. Set kind of frames added to end of stream.
  13612. Can be either @var{add} or @var{clone}.
  13613. With @var{add} frames of solid-color are added.
  13614. With @var{clone} frames are clones of last frame.
  13615. @item start_duration, stop_duration
  13616. Specify the duration of the start/stop delay. See
  13617. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13618. for the accepted syntax.
  13619. These options override @var{start} and @var{stop}.
  13620. @item color
  13621. Specify the color of the padded area. For the syntax of this option,
  13622. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13623. manual,ffmpeg-utils}.
  13624. The default value of @var{color} is "black".
  13625. @end table
  13626. @anchor{transpose}
  13627. @section transpose
  13628. Transpose rows with columns in the input video and optionally flip it.
  13629. It accepts the following parameters:
  13630. @table @option
  13631. @item dir
  13632. Specify the transposition direction.
  13633. Can assume the following values:
  13634. @table @samp
  13635. @item 0, 4, cclock_flip
  13636. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13637. @example
  13638. L.R L.l
  13639. . . -> . .
  13640. l.r R.r
  13641. @end example
  13642. @item 1, 5, clock
  13643. Rotate by 90 degrees clockwise, that is:
  13644. @example
  13645. L.R l.L
  13646. . . -> . .
  13647. l.r r.R
  13648. @end example
  13649. @item 2, 6, cclock
  13650. Rotate by 90 degrees counterclockwise, that is:
  13651. @example
  13652. L.R R.r
  13653. . . -> . .
  13654. l.r L.l
  13655. @end example
  13656. @item 3, 7, clock_flip
  13657. Rotate by 90 degrees clockwise and vertically flip, that is:
  13658. @example
  13659. L.R r.R
  13660. . . -> . .
  13661. l.r l.L
  13662. @end example
  13663. @end table
  13664. For values between 4-7, the transposition is only done if the input
  13665. video geometry is portrait and not landscape. These values are
  13666. deprecated, the @code{passthrough} option should be used instead.
  13667. Numerical values are deprecated, and should be dropped in favor of
  13668. symbolic constants.
  13669. @item passthrough
  13670. Do not apply the transposition if the input geometry matches the one
  13671. specified by the specified value. It accepts the following values:
  13672. @table @samp
  13673. @item none
  13674. Always apply transposition.
  13675. @item portrait
  13676. Preserve portrait geometry (when @var{height} >= @var{width}).
  13677. @item landscape
  13678. Preserve landscape geometry (when @var{width} >= @var{height}).
  13679. @end table
  13680. Default value is @code{none}.
  13681. @end table
  13682. For example to rotate by 90 degrees clockwise and preserve portrait
  13683. layout:
  13684. @example
  13685. transpose=dir=1:passthrough=portrait
  13686. @end example
  13687. The command above can also be specified as:
  13688. @example
  13689. transpose=1:portrait
  13690. @end example
  13691. @section transpose_npp
  13692. Transpose rows with columns in the input video and optionally flip it.
  13693. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13694. It accepts the following parameters:
  13695. @table @option
  13696. @item dir
  13697. Specify the transposition direction.
  13698. Can assume the following values:
  13699. @table @samp
  13700. @item cclock_flip
  13701. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13702. @item clock
  13703. Rotate by 90 degrees clockwise.
  13704. @item cclock
  13705. Rotate by 90 degrees counterclockwise.
  13706. @item clock_flip
  13707. Rotate by 90 degrees clockwise and vertically flip.
  13708. @end table
  13709. @item passthrough
  13710. Do not apply the transposition if the input geometry matches the one
  13711. specified by the specified value. It accepts the following values:
  13712. @table @samp
  13713. @item none
  13714. Always apply transposition. (default)
  13715. @item portrait
  13716. Preserve portrait geometry (when @var{height} >= @var{width}).
  13717. @item landscape
  13718. Preserve landscape geometry (when @var{width} >= @var{height}).
  13719. @end table
  13720. @end table
  13721. @section trim
  13722. Trim the input so that the output contains one continuous subpart of the input.
  13723. It accepts the following parameters:
  13724. @table @option
  13725. @item start
  13726. Specify the time of the start of the kept section, i.e. the frame with the
  13727. timestamp @var{start} will be the first frame in the output.
  13728. @item end
  13729. Specify the time of the first frame that will be dropped, i.e. the frame
  13730. immediately preceding the one with the timestamp @var{end} will be the last
  13731. frame in the output.
  13732. @item start_pts
  13733. This is the same as @var{start}, except this option sets the start timestamp
  13734. in timebase units instead of seconds.
  13735. @item end_pts
  13736. This is the same as @var{end}, except this option sets the end timestamp
  13737. in timebase units instead of seconds.
  13738. @item duration
  13739. The maximum duration of the output in seconds.
  13740. @item start_frame
  13741. The number of the first frame that should be passed to the output.
  13742. @item end_frame
  13743. The number of the first frame that should be dropped.
  13744. @end table
  13745. @option{start}, @option{end}, and @option{duration} are expressed as time
  13746. duration specifications; see
  13747. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13748. for the accepted syntax.
  13749. Note that the first two sets of the start/end options and the @option{duration}
  13750. option look at the frame timestamp, while the _frame variants simply count the
  13751. frames that pass through the filter. Also note that this filter does not modify
  13752. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13753. setpts filter after the trim filter.
  13754. If multiple start or end options are set, this filter tries to be greedy and
  13755. keep all the frames that match at least one of the specified constraints. To keep
  13756. only the part that matches all the constraints at once, chain multiple trim
  13757. filters.
  13758. The defaults are such that all the input is kept. So it is possible to set e.g.
  13759. just the end values to keep everything before the specified time.
  13760. Examples:
  13761. @itemize
  13762. @item
  13763. Drop everything except the second minute of input:
  13764. @example
  13765. ffmpeg -i INPUT -vf trim=60:120
  13766. @end example
  13767. @item
  13768. Keep only the first second:
  13769. @example
  13770. ffmpeg -i INPUT -vf trim=duration=1
  13771. @end example
  13772. @end itemize
  13773. @section unpremultiply
  13774. Apply alpha unpremultiply effect to input video stream using first plane
  13775. of second stream as alpha.
  13776. Both streams must have same dimensions and same pixel format.
  13777. The filter accepts the following option:
  13778. @table @option
  13779. @item planes
  13780. Set which planes will be processed, unprocessed planes will be copied.
  13781. By default value 0xf, all planes will be processed.
  13782. If the format has 1 or 2 components, then luma is bit 0.
  13783. If the format has 3 or 4 components:
  13784. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13785. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13786. If present, the alpha channel is always the last bit.
  13787. @item inplace
  13788. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13789. @end table
  13790. @anchor{unsharp}
  13791. @section unsharp
  13792. Sharpen or blur the input video.
  13793. It accepts the following parameters:
  13794. @table @option
  13795. @item luma_msize_x, lx
  13796. Set the luma matrix horizontal size. It must be an odd integer between
  13797. 3 and 23. The default value is 5.
  13798. @item luma_msize_y, ly
  13799. Set the luma matrix vertical size. It must be an odd integer between 3
  13800. and 23. The default value is 5.
  13801. @item luma_amount, la
  13802. Set the luma effect strength. It must be a floating point number, reasonable
  13803. values lay between -1.5 and 1.5.
  13804. Negative values will blur the input video, while positive values will
  13805. sharpen it, a value of zero will disable the effect.
  13806. Default value is 1.0.
  13807. @item chroma_msize_x, cx
  13808. Set the chroma matrix horizontal size. It must be an odd integer
  13809. between 3 and 23. The default value is 5.
  13810. @item chroma_msize_y, cy
  13811. Set the chroma matrix vertical size. It must be an odd integer
  13812. between 3 and 23. The default value is 5.
  13813. @item chroma_amount, ca
  13814. Set the chroma effect strength. It must be a floating point number, reasonable
  13815. values lay between -1.5 and 1.5.
  13816. Negative values will blur the input video, while positive values will
  13817. sharpen it, a value of zero will disable the effect.
  13818. Default value is 0.0.
  13819. @end table
  13820. All parameters are optional and default to the equivalent of the
  13821. string '5:5:1.0:5:5:0.0'.
  13822. @subsection Examples
  13823. @itemize
  13824. @item
  13825. Apply strong luma sharpen effect:
  13826. @example
  13827. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13828. @end example
  13829. @item
  13830. Apply a strong blur of both luma and chroma parameters:
  13831. @example
  13832. unsharp=7:7:-2:7:7:-2
  13833. @end example
  13834. @end itemize
  13835. @section uspp
  13836. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13837. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13838. shifts and average the results.
  13839. The way this differs from the behavior of spp is that uspp actually encodes &
  13840. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13841. DCT similar to MJPEG.
  13842. The filter accepts the following options:
  13843. @table @option
  13844. @item quality
  13845. Set quality. This option defines the number of levels for averaging. It accepts
  13846. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13847. effect. A value of @code{8} means the higher quality. For each increment of
  13848. that value the speed drops by a factor of approximately 2. Default value is
  13849. @code{3}.
  13850. @item qp
  13851. Force a constant quantization parameter. If not set, the filter will use the QP
  13852. from the video stream (if available).
  13853. @end table
  13854. @section v360
  13855. Convert 360 videos between various formats.
  13856. The filter accepts the following options:
  13857. @table @option
  13858. @item input
  13859. @item output
  13860. Set format of the input/output video.
  13861. Available formats:
  13862. @table @samp
  13863. @item e
  13864. @item equirect
  13865. Equirectangular projection.
  13866. @item c3x2
  13867. @item c6x1
  13868. @item c1x6
  13869. Cubemap with 3x2/6x1/1x6 layout.
  13870. Format specific options:
  13871. @table @option
  13872. @item in_pad
  13873. @item out_pad
  13874. Set padding proportion for the input/output cubemap. Values in decimals.
  13875. Example values:
  13876. @table @samp
  13877. @item 0
  13878. No padding.
  13879. @item 0.01
  13880. 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)
  13881. @end table
  13882. Default value is @b{@samp{0}}.
  13883. @item fin_pad
  13884. @item fout_pad
  13885. Set fixed padding for the input/output cubemap. Values in pixels.
  13886. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  13887. @item in_forder
  13888. @item out_forder
  13889. Set order of faces for the input/output cubemap. Choose one direction for each position.
  13890. Designation of directions:
  13891. @table @samp
  13892. @item r
  13893. right
  13894. @item l
  13895. left
  13896. @item u
  13897. up
  13898. @item d
  13899. down
  13900. @item f
  13901. forward
  13902. @item b
  13903. back
  13904. @end table
  13905. Default value is @b{@samp{rludfb}}.
  13906. @item in_frot
  13907. @item out_frot
  13908. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  13909. Designation of angles:
  13910. @table @samp
  13911. @item 0
  13912. 0 degrees clockwise
  13913. @item 1
  13914. 90 degrees clockwise
  13915. @item 2
  13916. 180 degrees clockwise
  13917. @item 3
  13918. 270 degrees clockwise
  13919. @end table
  13920. Default value is @b{@samp{000000}}.
  13921. @end table
  13922. @item eac
  13923. Equi-Angular Cubemap.
  13924. @item flat
  13925. @item gnomonic
  13926. @item rectilinear
  13927. Regular video. @i{(output only)}
  13928. Format specific options:
  13929. @table @option
  13930. @item h_fov
  13931. @item v_fov
  13932. @item d_fov
  13933. Set horizontal/vertical/diagonal field of view. Values in degrees.
  13934. If diagonal field of view is set it overrides horizontal and vertical field of view.
  13935. @end table
  13936. @item dfisheye
  13937. Dual fisheye.
  13938. Format specific options:
  13939. @table @option
  13940. @item in_pad
  13941. @item out_pad
  13942. Set padding proportion. Values in decimals.
  13943. Example values:
  13944. @table @samp
  13945. @item 0
  13946. No padding.
  13947. @item 0.01
  13948. 1% padding.
  13949. @end table
  13950. Default value is @b{@samp{0}}.
  13951. @end table
  13952. @item barrel
  13953. @item fb
  13954. Facebook's 360 format.
  13955. @item sg
  13956. Stereographic format.
  13957. Format specific options:
  13958. @table @option
  13959. @item h_fov
  13960. @item v_fov
  13961. @item d_fov
  13962. Set horizontal/vertical/diagonal field of view. Values in degrees.
  13963. If diagonal field of view is set it overrides horizontal and vertical field of view.
  13964. @end table
  13965. @item mercator
  13966. Mercator format.
  13967. @item ball
  13968. Ball format, gives significant distortion toward the back.
  13969. @item hammer
  13970. Hammer-Aitoff map projection format.
  13971. @item sinusoidal
  13972. Sinusoidal map projection format.
  13973. @end table
  13974. @item interp
  13975. Set interpolation method.@*
  13976. @i{Note: more complex interpolation methods require much more memory to run.}
  13977. Available methods:
  13978. @table @samp
  13979. @item near
  13980. @item nearest
  13981. Nearest neighbour.
  13982. @item line
  13983. @item linear
  13984. Bilinear interpolation.
  13985. @item cube
  13986. @item cubic
  13987. Bicubic interpolation.
  13988. @item lanc
  13989. @item lanczos
  13990. Lanczos interpolation.
  13991. @end table
  13992. Default value is @b{@samp{line}}.
  13993. @item w
  13994. @item h
  13995. Set the output video resolution.
  13996. Default resolution depends on formats.
  13997. @item in_stereo
  13998. @item out_stereo
  13999. Set the input/output stereo format.
  14000. @table @samp
  14001. @item 2d
  14002. 2D mono
  14003. @item sbs
  14004. Side by side
  14005. @item tb
  14006. Top bottom
  14007. @end table
  14008. Default value is @b{@samp{2d}} for input and output format.
  14009. @item yaw
  14010. @item pitch
  14011. @item roll
  14012. Set rotation for the output video. Values in degrees.
  14013. @item rorder
  14014. Set rotation order for the output video. Choose one item for each position.
  14015. @table @samp
  14016. @item y, Y
  14017. yaw
  14018. @item p, P
  14019. pitch
  14020. @item r, R
  14021. roll
  14022. @end table
  14023. Default value is @b{@samp{ypr}}.
  14024. @item h_flip
  14025. @item v_flip
  14026. @item d_flip
  14027. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  14028. @item ih_flip
  14029. @item iv_flip
  14030. Set if input video is flipped horizontally/vertically. Boolean values.
  14031. @item in_trans
  14032. Set if input video is transposed. Boolean value, by default disabled.
  14033. @item out_trans
  14034. Set if output video needs to be transposed. Boolean value, by default disabled.
  14035. @end table
  14036. @subsection Examples
  14037. @itemize
  14038. @item
  14039. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  14040. @example
  14041. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  14042. @end example
  14043. @item
  14044. Extract back view of Equi-Angular Cubemap:
  14045. @example
  14046. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  14047. @end example
  14048. @item
  14049. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  14050. @example
  14051. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  14052. @end example
  14053. @end itemize
  14054. @section vaguedenoiser
  14055. Apply a wavelet based denoiser.
  14056. It transforms each frame from the video input into the wavelet domain,
  14057. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  14058. the obtained coefficients. It does an inverse wavelet transform after.
  14059. Due to wavelet properties, it should give a nice smoothed result, and
  14060. reduced noise, without blurring picture features.
  14061. This filter accepts the following options:
  14062. @table @option
  14063. @item threshold
  14064. The filtering strength. The higher, the more filtered the video will be.
  14065. Hard thresholding can use a higher threshold than soft thresholding
  14066. before the video looks overfiltered. Default value is 2.
  14067. @item method
  14068. The filtering method the filter will use.
  14069. It accepts the following values:
  14070. @table @samp
  14071. @item hard
  14072. All values under the threshold will be zeroed.
  14073. @item soft
  14074. All values under the threshold will be zeroed. All values above will be
  14075. reduced by the threshold.
  14076. @item garrote
  14077. Scales or nullifies coefficients - intermediary between (more) soft and
  14078. (less) hard thresholding.
  14079. @end table
  14080. Default is garrote.
  14081. @item nsteps
  14082. Number of times, the wavelet will decompose the picture. Picture can't
  14083. be decomposed beyond a particular point (typically, 8 for a 640x480
  14084. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  14085. @item percent
  14086. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  14087. @item planes
  14088. A list of the planes to process. By default all planes are processed.
  14089. @end table
  14090. @section vectorscope
  14091. Display 2 color component values in the two dimensional graph (which is called
  14092. a vectorscope).
  14093. This filter accepts the following options:
  14094. @table @option
  14095. @item mode, m
  14096. Set vectorscope mode.
  14097. It accepts the following values:
  14098. @table @samp
  14099. @item gray
  14100. Gray values are displayed on graph, higher brightness means more pixels have
  14101. same component color value on location in graph. This is the default mode.
  14102. @item color
  14103. Gray values are displayed on graph. Surrounding pixels values which are not
  14104. present in video frame are drawn in gradient of 2 color components which are
  14105. set by option @code{x} and @code{y}. The 3rd color component is static.
  14106. @item color2
  14107. Actual color components values present in video frame are displayed on graph.
  14108. @item color3
  14109. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  14110. on graph increases value of another color component, which is luminance by
  14111. default values of @code{x} and @code{y}.
  14112. @item color4
  14113. Actual colors present in video frame are displayed on graph. If two different
  14114. colors map to same position on graph then color with higher value of component
  14115. not present in graph is picked.
  14116. @item color5
  14117. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  14118. component picked from radial gradient.
  14119. @end table
  14120. @item x
  14121. Set which color component will be represented on X-axis. Default is @code{1}.
  14122. @item y
  14123. Set which color component will be represented on Y-axis. Default is @code{2}.
  14124. @item intensity, i
  14125. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  14126. of color component which represents frequency of (X, Y) location in graph.
  14127. @item envelope, e
  14128. @table @samp
  14129. @item none
  14130. No envelope, this is default.
  14131. @item instant
  14132. Instant envelope, even darkest single pixel will be clearly highlighted.
  14133. @item peak
  14134. Hold maximum and minimum values presented in graph over time. This way you
  14135. can still spot out of range values without constantly looking at vectorscope.
  14136. @item peak+instant
  14137. Peak and instant envelope combined together.
  14138. @end table
  14139. @item graticule, g
  14140. Set what kind of graticule to draw.
  14141. @table @samp
  14142. @item none
  14143. @item green
  14144. @item color
  14145. @end table
  14146. @item opacity, o
  14147. Set graticule opacity.
  14148. @item flags, f
  14149. Set graticule flags.
  14150. @table @samp
  14151. @item white
  14152. Draw graticule for white point.
  14153. @item black
  14154. Draw graticule for black point.
  14155. @item name
  14156. Draw color points short names.
  14157. @end table
  14158. @item bgopacity, b
  14159. Set background opacity.
  14160. @item lthreshold, l
  14161. Set low threshold for color component not represented on X or Y axis.
  14162. Values lower than this value will be ignored. Default is 0.
  14163. Note this value is multiplied with actual max possible value one pixel component
  14164. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  14165. is 0.1 * 255 = 25.
  14166. @item hthreshold, h
  14167. Set high threshold for color component not represented on X or Y axis.
  14168. Values higher than this value will be ignored. Default is 1.
  14169. Note this value is multiplied with actual max possible value one pixel component
  14170. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  14171. is 0.9 * 255 = 230.
  14172. @item colorspace, c
  14173. Set what kind of colorspace to use when drawing graticule.
  14174. @table @samp
  14175. @item auto
  14176. @item 601
  14177. @item 709
  14178. @end table
  14179. Default is auto.
  14180. @end table
  14181. @anchor{vidstabdetect}
  14182. @section vidstabdetect
  14183. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  14184. @ref{vidstabtransform} for pass 2.
  14185. This filter generates a file with relative translation and rotation
  14186. transform information about subsequent frames, which is then used by
  14187. the @ref{vidstabtransform} filter.
  14188. To enable compilation of this filter you need to configure FFmpeg with
  14189. @code{--enable-libvidstab}.
  14190. This filter accepts the following options:
  14191. @table @option
  14192. @item result
  14193. Set the path to the file used to write the transforms information.
  14194. Default value is @file{transforms.trf}.
  14195. @item shakiness
  14196. Set how shaky the video is and how quick the camera is. It accepts an
  14197. integer in the range 1-10, a value of 1 means little shakiness, a
  14198. value of 10 means strong shakiness. Default value is 5.
  14199. @item accuracy
  14200. Set the accuracy of the detection process. It must be a value in the
  14201. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  14202. accuracy. Default value is 15.
  14203. @item stepsize
  14204. Set stepsize of the search process. The region around minimum is
  14205. scanned with 1 pixel resolution. Default value is 6.
  14206. @item mincontrast
  14207. Set minimum contrast. Below this value a local measurement field is
  14208. discarded. Must be a floating point value in the range 0-1. Default
  14209. value is 0.3.
  14210. @item tripod
  14211. Set reference frame number for tripod mode.
  14212. If enabled, the motion of the frames is compared to a reference frame
  14213. in the filtered stream, identified by the specified number. The idea
  14214. is to compensate all movements in a more-or-less static scene and keep
  14215. the camera view absolutely still.
  14216. If set to 0, it is disabled. The frames are counted starting from 1.
  14217. @item show
  14218. Show fields and transforms in the resulting frames. It accepts an
  14219. integer in the range 0-2. Default value is 0, which disables any
  14220. visualization.
  14221. @end table
  14222. @subsection Examples
  14223. @itemize
  14224. @item
  14225. Use default values:
  14226. @example
  14227. vidstabdetect
  14228. @end example
  14229. @item
  14230. Analyze strongly shaky movie and put the results in file
  14231. @file{mytransforms.trf}:
  14232. @example
  14233. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  14234. @end example
  14235. @item
  14236. Visualize the result of internal transformations in the resulting
  14237. video:
  14238. @example
  14239. vidstabdetect=show=1
  14240. @end example
  14241. @item
  14242. Analyze a video with medium shakiness using @command{ffmpeg}:
  14243. @example
  14244. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  14245. @end example
  14246. @end itemize
  14247. @anchor{vidstabtransform}
  14248. @section vidstabtransform
  14249. Video stabilization/deshaking: pass 2 of 2,
  14250. see @ref{vidstabdetect} for pass 1.
  14251. Read a file with transform information for each frame and
  14252. apply/compensate them. Together with the @ref{vidstabdetect}
  14253. filter this can be used to deshake videos. See also
  14254. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  14255. the @ref{unsharp} filter, see below.
  14256. To enable compilation of this filter you need to configure FFmpeg with
  14257. @code{--enable-libvidstab}.
  14258. @subsection Options
  14259. @table @option
  14260. @item input
  14261. Set path to the file used to read the transforms. Default value is
  14262. @file{transforms.trf}.
  14263. @item smoothing
  14264. Set the number of frames (value*2 + 1) used for lowpass filtering the
  14265. camera movements. Default value is 10.
  14266. For example a number of 10 means that 21 frames are used (10 in the
  14267. past and 10 in the future) to smoothen the motion in the video. A
  14268. larger value leads to a smoother video, but limits the acceleration of
  14269. the camera (pan/tilt movements). 0 is a special case where a static
  14270. camera is simulated.
  14271. @item optalgo
  14272. Set the camera path optimization algorithm.
  14273. Accepted values are:
  14274. @table @samp
  14275. @item gauss
  14276. gaussian kernel low-pass filter on camera motion (default)
  14277. @item avg
  14278. averaging on transformations
  14279. @end table
  14280. @item maxshift
  14281. Set maximal number of pixels to translate frames. Default value is -1,
  14282. meaning no limit.
  14283. @item maxangle
  14284. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  14285. value is -1, meaning no limit.
  14286. @item crop
  14287. Specify how to deal with borders that may be visible due to movement
  14288. compensation.
  14289. Available values are:
  14290. @table @samp
  14291. @item keep
  14292. keep image information from previous frame (default)
  14293. @item black
  14294. fill the border black
  14295. @end table
  14296. @item invert
  14297. Invert transforms if set to 1. Default value is 0.
  14298. @item relative
  14299. Consider transforms as relative to previous frame if set to 1,
  14300. absolute if set to 0. Default value is 0.
  14301. @item zoom
  14302. Set percentage to zoom. A positive value will result in a zoom-in
  14303. effect, a negative value in a zoom-out effect. Default value is 0 (no
  14304. zoom).
  14305. @item optzoom
  14306. Set optimal zooming to avoid borders.
  14307. Accepted values are:
  14308. @table @samp
  14309. @item 0
  14310. disabled
  14311. @item 1
  14312. optimal static zoom value is determined (only very strong movements
  14313. will lead to visible borders) (default)
  14314. @item 2
  14315. optimal adaptive zoom value is determined (no borders will be
  14316. visible), see @option{zoomspeed}
  14317. @end table
  14318. Note that the value given at zoom is added to the one calculated here.
  14319. @item zoomspeed
  14320. Set percent to zoom maximally each frame (enabled when
  14321. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  14322. 0.25.
  14323. @item interpol
  14324. Specify type of interpolation.
  14325. Available values are:
  14326. @table @samp
  14327. @item no
  14328. no interpolation
  14329. @item linear
  14330. linear only horizontal
  14331. @item bilinear
  14332. linear in both directions (default)
  14333. @item bicubic
  14334. cubic in both directions (slow)
  14335. @end table
  14336. @item tripod
  14337. Enable virtual tripod mode if set to 1, which is equivalent to
  14338. @code{relative=0:smoothing=0}. Default value is 0.
  14339. Use also @code{tripod} option of @ref{vidstabdetect}.
  14340. @item debug
  14341. Increase log verbosity if set to 1. Also the detected global motions
  14342. are written to the temporary file @file{global_motions.trf}. Default
  14343. value is 0.
  14344. @end table
  14345. @subsection Examples
  14346. @itemize
  14347. @item
  14348. Use @command{ffmpeg} for a typical stabilization with default values:
  14349. @example
  14350. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  14351. @end example
  14352. Note the use of the @ref{unsharp} filter which is always recommended.
  14353. @item
  14354. Zoom in a bit more and load transform data from a given file:
  14355. @example
  14356. vidstabtransform=zoom=5:input="mytransforms.trf"
  14357. @end example
  14358. @item
  14359. Smoothen the video even more:
  14360. @example
  14361. vidstabtransform=smoothing=30
  14362. @end example
  14363. @end itemize
  14364. @section vflip
  14365. Flip the input video vertically.
  14366. For example, to vertically flip a video with @command{ffmpeg}:
  14367. @example
  14368. ffmpeg -i in.avi -vf "vflip" out.avi
  14369. @end example
  14370. @section vfrdet
  14371. Detect variable frame rate video.
  14372. This filter tries to detect if the input is variable or constant frame rate.
  14373. At end it will output number of frames detected as having variable delta pts,
  14374. and ones with constant delta pts.
  14375. If there was frames with variable delta, than it will also show min and max delta
  14376. encountered.
  14377. @section vibrance
  14378. Boost or alter saturation.
  14379. The filter accepts the following options:
  14380. @table @option
  14381. @item intensity
  14382. Set strength of boost if positive value or strength of alter if negative value.
  14383. Default is 0. Allowed range is from -2 to 2.
  14384. @item rbal
  14385. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  14386. @item gbal
  14387. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  14388. @item bbal
  14389. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  14390. @item rlum
  14391. Set the red luma coefficient.
  14392. @item glum
  14393. Set the green luma coefficient.
  14394. @item blum
  14395. Set the blue luma coefficient.
  14396. @item alternate
  14397. If @code{intensity} is negative and this is set to 1, colors will change,
  14398. otherwise colors will be less saturated, more towards gray.
  14399. @end table
  14400. @anchor{vignette}
  14401. @section vignette
  14402. Make or reverse a natural vignetting effect.
  14403. The filter accepts the following options:
  14404. @table @option
  14405. @item angle, a
  14406. Set lens angle expression as a number of radians.
  14407. The value is clipped in the @code{[0,PI/2]} range.
  14408. Default value: @code{"PI/5"}
  14409. @item x0
  14410. @item y0
  14411. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  14412. by default.
  14413. @item mode
  14414. Set forward/backward mode.
  14415. Available modes are:
  14416. @table @samp
  14417. @item forward
  14418. The larger the distance from the central point, the darker the image becomes.
  14419. @item backward
  14420. The larger the distance from the central point, the brighter the image becomes.
  14421. This can be used to reverse a vignette effect, though there is no automatic
  14422. detection to extract the lens @option{angle} and other settings (yet). It can
  14423. also be used to create a burning effect.
  14424. @end table
  14425. Default value is @samp{forward}.
  14426. @item eval
  14427. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  14428. It accepts the following values:
  14429. @table @samp
  14430. @item init
  14431. Evaluate expressions only once during the filter initialization.
  14432. @item frame
  14433. Evaluate expressions for each incoming frame. This is way slower than the
  14434. @samp{init} mode since it requires all the scalers to be re-computed, but it
  14435. allows advanced dynamic expressions.
  14436. @end table
  14437. Default value is @samp{init}.
  14438. @item dither
  14439. Set dithering to reduce the circular banding effects. Default is @code{1}
  14440. (enabled).
  14441. @item aspect
  14442. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  14443. Setting this value to the SAR of the input will make a rectangular vignetting
  14444. following the dimensions of the video.
  14445. Default is @code{1/1}.
  14446. @end table
  14447. @subsection Expressions
  14448. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  14449. following parameters.
  14450. @table @option
  14451. @item w
  14452. @item h
  14453. input width and height
  14454. @item n
  14455. the number of input frame, starting from 0
  14456. @item pts
  14457. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  14458. @var{TB} units, NAN if undefined
  14459. @item r
  14460. frame rate of the input video, NAN if the input frame rate is unknown
  14461. @item t
  14462. the PTS (Presentation TimeStamp) of the filtered video frame,
  14463. expressed in seconds, NAN if undefined
  14464. @item tb
  14465. time base of the input video
  14466. @end table
  14467. @subsection Examples
  14468. @itemize
  14469. @item
  14470. Apply simple strong vignetting effect:
  14471. @example
  14472. vignette=PI/4
  14473. @end example
  14474. @item
  14475. Make a flickering vignetting:
  14476. @example
  14477. vignette='PI/4+random(1)*PI/50':eval=frame
  14478. @end example
  14479. @end itemize
  14480. @section vmafmotion
  14481. Obtain the average vmaf motion score of a video.
  14482. It is one of the component filters of VMAF.
  14483. The obtained average motion score is printed through the logging system.
  14484. In the below example the input file @file{ref.mpg} is being processed and score
  14485. is computed.
  14486. @example
  14487. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  14488. @end example
  14489. @section vstack
  14490. Stack input videos vertically.
  14491. All streams must be of same pixel format and of same width.
  14492. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  14493. to create same output.
  14494. The filter accepts the following options:
  14495. @table @option
  14496. @item inputs
  14497. Set number of input streams. Default is 2.
  14498. @item shortest
  14499. If set to 1, force the output to terminate when the shortest input
  14500. terminates. Default value is 0.
  14501. @end table
  14502. @section w3fdif
  14503. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  14504. Deinterlacing Filter").
  14505. Based on the process described by Martin Weston for BBC R&D, and
  14506. implemented based on the de-interlace algorithm written by Jim
  14507. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  14508. uses filter coefficients calculated by BBC R&D.
  14509. This filter uses field-dominance information in frame to decide which
  14510. of each pair of fields to place first in the output.
  14511. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  14512. There are two sets of filter coefficients, so called "simple"
  14513. and "complex". Which set of filter coefficients is used can
  14514. be set by passing an optional parameter:
  14515. @table @option
  14516. @item filter
  14517. Set the interlacing filter coefficients. Accepts one of the following values:
  14518. @table @samp
  14519. @item simple
  14520. Simple filter coefficient set.
  14521. @item complex
  14522. More-complex filter coefficient set.
  14523. @end table
  14524. Default value is @samp{complex}.
  14525. @item deint
  14526. Specify which frames to deinterlace. Accepts one of the following values:
  14527. @table @samp
  14528. @item all
  14529. Deinterlace all frames,
  14530. @item interlaced
  14531. Only deinterlace frames marked as interlaced.
  14532. @end table
  14533. Default value is @samp{all}.
  14534. @end table
  14535. @section waveform
  14536. Video waveform monitor.
  14537. The waveform monitor plots color component intensity. By default luminance
  14538. only. Each column of the waveform corresponds to a column of pixels in the
  14539. source video.
  14540. It accepts the following options:
  14541. @table @option
  14542. @item mode, m
  14543. Can be either @code{row}, or @code{column}. Default is @code{column}.
  14544. In row mode, the graph on the left side represents color component value 0 and
  14545. the right side represents value = 255. In column mode, the top side represents
  14546. color component value = 0 and bottom side represents value = 255.
  14547. @item intensity, i
  14548. Set intensity. Smaller values are useful to find out how many values of the same
  14549. luminance are distributed across input rows/columns.
  14550. Default value is @code{0.04}. Allowed range is [0, 1].
  14551. @item mirror, r
  14552. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  14553. In mirrored mode, higher values will be represented on the left
  14554. side for @code{row} mode and at the top for @code{column} mode. Default is
  14555. @code{1} (mirrored).
  14556. @item display, d
  14557. Set display mode.
  14558. It accepts the following values:
  14559. @table @samp
  14560. @item overlay
  14561. Presents information identical to that in the @code{parade}, except
  14562. that the graphs representing color components are superimposed directly
  14563. over one another.
  14564. This display mode makes it easier to spot relative differences or similarities
  14565. in overlapping areas of the color components that are supposed to be identical,
  14566. such as neutral whites, grays, or blacks.
  14567. @item stack
  14568. Display separate graph for the color components side by side in
  14569. @code{row} mode or one below the other in @code{column} mode.
  14570. @item parade
  14571. Display separate graph for the color components side by side in
  14572. @code{column} mode or one below the other in @code{row} mode.
  14573. Using this display mode makes it easy to spot color casts in the highlights
  14574. and shadows of an image, by comparing the contours of the top and the bottom
  14575. graphs of each waveform. Since whites, grays, and blacks are characterized
  14576. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  14577. should display three waveforms of roughly equal width/height. If not, the
  14578. correction is easy to perform by making level adjustments the three waveforms.
  14579. @end table
  14580. Default is @code{stack}.
  14581. @item components, c
  14582. Set which color components to display. Default is 1, which means only luminance
  14583. or red color component if input is in RGB colorspace. If is set for example to
  14584. 7 it will display all 3 (if) available color components.
  14585. @item envelope, e
  14586. @table @samp
  14587. @item none
  14588. No envelope, this is default.
  14589. @item instant
  14590. Instant envelope, minimum and maximum values presented in graph will be easily
  14591. visible even with small @code{step} value.
  14592. @item peak
  14593. Hold minimum and maximum values presented in graph across time. This way you
  14594. can still spot out of range values without constantly looking at waveforms.
  14595. @item peak+instant
  14596. Peak and instant envelope combined together.
  14597. @end table
  14598. @item filter, f
  14599. @table @samp
  14600. @item lowpass
  14601. No filtering, this is default.
  14602. @item flat
  14603. Luma and chroma combined together.
  14604. @item aflat
  14605. Similar as above, but shows difference between blue and red chroma.
  14606. @item xflat
  14607. Similar as above, but use different colors.
  14608. @item yflat
  14609. Similar as above, but again with different colors.
  14610. @item chroma
  14611. Displays only chroma.
  14612. @item color
  14613. Displays actual color value on waveform.
  14614. @item acolor
  14615. Similar as above, but with luma showing frequency of chroma values.
  14616. @end table
  14617. @item graticule, g
  14618. Set which graticule to display.
  14619. @table @samp
  14620. @item none
  14621. Do not display graticule.
  14622. @item green
  14623. Display green graticule showing legal broadcast ranges.
  14624. @item orange
  14625. Display orange graticule showing legal broadcast ranges.
  14626. @item invert
  14627. Display invert graticule showing legal broadcast ranges.
  14628. @end table
  14629. @item opacity, o
  14630. Set graticule opacity.
  14631. @item flags, fl
  14632. Set graticule flags.
  14633. @table @samp
  14634. @item numbers
  14635. Draw numbers above lines. By default enabled.
  14636. @item dots
  14637. Draw dots instead of lines.
  14638. @end table
  14639. @item scale, s
  14640. Set scale used for displaying graticule.
  14641. @table @samp
  14642. @item digital
  14643. @item millivolts
  14644. @item ire
  14645. @end table
  14646. Default is digital.
  14647. @item bgopacity, b
  14648. Set background opacity.
  14649. @end table
  14650. @section weave, doubleweave
  14651. The @code{weave} takes a field-based video input and join
  14652. each two sequential fields into single frame, producing a new double
  14653. height clip with half the frame rate and half the frame count.
  14654. The @code{doubleweave} works same as @code{weave} but without
  14655. halving frame rate and frame count.
  14656. It accepts the following option:
  14657. @table @option
  14658. @item first_field
  14659. Set first field. Available values are:
  14660. @table @samp
  14661. @item top, t
  14662. Set the frame as top-field-first.
  14663. @item bottom, b
  14664. Set the frame as bottom-field-first.
  14665. @end table
  14666. @end table
  14667. @subsection Examples
  14668. @itemize
  14669. @item
  14670. Interlace video using @ref{select} and @ref{separatefields} filter:
  14671. @example
  14672. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  14673. @end example
  14674. @end itemize
  14675. @section xbr
  14676. Apply the xBR high-quality magnification filter which is designed for pixel
  14677. art. It follows a set of edge-detection rules, see
  14678. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  14679. It accepts the following option:
  14680. @table @option
  14681. @item n
  14682. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  14683. @code{3xBR} and @code{4} for @code{4xBR}.
  14684. Default is @code{3}.
  14685. @end table
  14686. @section xmedian
  14687. Pick median pixels from several input videos.
  14688. The filter accepts the following options:
  14689. @table @option
  14690. @item inputs
  14691. Set number of inputs.
  14692. Default is 3. Allowed range is from 3 to 255.
  14693. If number of inputs is even number, than result will be mean value between two median values.
  14694. @item planes
  14695. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14696. @end table
  14697. @section xstack
  14698. Stack video inputs into custom layout.
  14699. All streams must be of same pixel format.
  14700. The filter accepts the following options:
  14701. @table @option
  14702. @item inputs
  14703. Set number of input streams. Default is 2.
  14704. @item layout
  14705. Specify layout of inputs.
  14706. This option requires the desired layout configuration to be explicitly set by the user.
  14707. This sets position of each video input in output. Each input
  14708. is separated by '|'.
  14709. The first number represents the column, and the second number represents the row.
  14710. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  14711. where X is video input from which to take width or height.
  14712. Multiple values can be used when separated by '+'. In such
  14713. case values are summed together.
  14714. Note that if inputs are of different sizes gaps may appear, as not all of
  14715. the output video frame will be filled. Similarly, videos can overlap each
  14716. other if their position doesn't leave enough space for the full frame of
  14717. adjoining videos.
  14718. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  14719. a layout must be set by the user.
  14720. @item shortest
  14721. If set to 1, force the output to terminate when the shortest input
  14722. terminates. Default value is 0.
  14723. @end table
  14724. @subsection Examples
  14725. @itemize
  14726. @item
  14727. Display 4 inputs into 2x2 grid.
  14728. Layout:
  14729. @example
  14730. input1(0, 0) | input3(w0, 0)
  14731. input2(0, h0) | input4(w0, h0)
  14732. @end example
  14733. @example
  14734. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  14735. @end example
  14736. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14737. @item
  14738. Display 4 inputs into 1x4 grid.
  14739. Layout:
  14740. @example
  14741. input1(0, 0)
  14742. input2(0, h0)
  14743. input3(0, h0+h1)
  14744. input4(0, h0+h1+h2)
  14745. @end example
  14746. @example
  14747. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  14748. @end example
  14749. Note that if inputs are of different widths, unused space will appear.
  14750. @item
  14751. Display 9 inputs into 3x3 grid.
  14752. Layout:
  14753. @example
  14754. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  14755. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  14756. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  14757. @end example
  14758. @example
  14759. 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
  14760. @end example
  14761. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14762. @item
  14763. Display 16 inputs into 4x4 grid.
  14764. Layout:
  14765. @example
  14766. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  14767. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  14768. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  14769. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  14770. @end example
  14771. @example
  14772. 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|
  14773. 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
  14774. @end example
  14775. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14776. @end itemize
  14777. @anchor{yadif}
  14778. @section yadif
  14779. Deinterlace the input video ("yadif" means "yet another deinterlacing
  14780. filter").
  14781. It accepts the following parameters:
  14782. @table @option
  14783. @item mode
  14784. The interlacing mode to adopt. It accepts one of the following values:
  14785. @table @option
  14786. @item 0, send_frame
  14787. Output one frame for each frame.
  14788. @item 1, send_field
  14789. Output one frame for each field.
  14790. @item 2, send_frame_nospatial
  14791. Like @code{send_frame}, but it skips the spatial interlacing check.
  14792. @item 3, send_field_nospatial
  14793. Like @code{send_field}, but it skips the spatial interlacing check.
  14794. @end table
  14795. The default value is @code{send_frame}.
  14796. @item parity
  14797. The picture field parity assumed for the input interlaced video. It accepts one
  14798. of the following values:
  14799. @table @option
  14800. @item 0, tff
  14801. Assume the top field is first.
  14802. @item 1, bff
  14803. Assume the bottom field is first.
  14804. @item -1, auto
  14805. Enable automatic detection of field parity.
  14806. @end table
  14807. The default value is @code{auto}.
  14808. If the interlacing is unknown or the decoder does not export this information,
  14809. top field first will be assumed.
  14810. @item deint
  14811. Specify which frames to deinterlace. Accepts one of the following
  14812. values:
  14813. @table @option
  14814. @item 0, all
  14815. Deinterlace all frames.
  14816. @item 1, interlaced
  14817. Only deinterlace frames marked as interlaced.
  14818. @end table
  14819. The default value is @code{all}.
  14820. @end table
  14821. @section yadif_cuda
  14822. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  14823. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  14824. and/or nvenc.
  14825. It accepts the following parameters:
  14826. @table @option
  14827. @item mode
  14828. The interlacing mode to adopt. It accepts one of the following values:
  14829. @table @option
  14830. @item 0, send_frame
  14831. Output one frame for each frame.
  14832. @item 1, send_field
  14833. Output one frame for each field.
  14834. @item 2, send_frame_nospatial
  14835. Like @code{send_frame}, but it skips the spatial interlacing check.
  14836. @item 3, send_field_nospatial
  14837. Like @code{send_field}, but it skips the spatial interlacing check.
  14838. @end table
  14839. The default value is @code{send_frame}.
  14840. @item parity
  14841. The picture field parity assumed for the input interlaced video. It accepts one
  14842. of the following values:
  14843. @table @option
  14844. @item 0, tff
  14845. Assume the top field is first.
  14846. @item 1, bff
  14847. Assume the bottom field is first.
  14848. @item -1, auto
  14849. Enable automatic detection of field parity.
  14850. @end table
  14851. The default value is @code{auto}.
  14852. If the interlacing is unknown or the decoder does not export this information,
  14853. top field first will be assumed.
  14854. @item deint
  14855. Specify which frames to deinterlace. Accepts one of the following
  14856. values:
  14857. @table @option
  14858. @item 0, all
  14859. Deinterlace all frames.
  14860. @item 1, interlaced
  14861. Only deinterlace frames marked as interlaced.
  14862. @end table
  14863. The default value is @code{all}.
  14864. @end table
  14865. @section zoompan
  14866. Apply Zoom & Pan effect.
  14867. This filter accepts the following options:
  14868. @table @option
  14869. @item zoom, z
  14870. Set the zoom expression. Range is 1-10. Default is 1.
  14871. @item x
  14872. @item y
  14873. Set the x and y expression. Default is 0.
  14874. @item d
  14875. Set the duration expression in number of frames.
  14876. This sets for how many number of frames effect will last for
  14877. single input image.
  14878. @item s
  14879. Set the output image size, default is 'hd720'.
  14880. @item fps
  14881. Set the output frame rate, default is '25'.
  14882. @end table
  14883. Each expression can contain the following constants:
  14884. @table @option
  14885. @item in_w, iw
  14886. Input width.
  14887. @item in_h, ih
  14888. Input height.
  14889. @item out_w, ow
  14890. Output width.
  14891. @item out_h, oh
  14892. Output height.
  14893. @item in
  14894. Input frame count.
  14895. @item on
  14896. Output frame count.
  14897. @item x
  14898. @item y
  14899. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14900. for current input frame.
  14901. @item px
  14902. @item py
  14903. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14904. not yet such frame (first input frame).
  14905. @item zoom
  14906. Last calculated zoom from 'z' expression for current input frame.
  14907. @item pzoom
  14908. Last calculated zoom of last output frame of previous input frame.
  14909. @item duration
  14910. Number of output frames for current input frame. Calculated from 'd' expression
  14911. for each input frame.
  14912. @item pduration
  14913. number of output frames created for previous input frame
  14914. @item a
  14915. Rational number: input width / input height
  14916. @item sar
  14917. sample aspect ratio
  14918. @item dar
  14919. display aspect ratio
  14920. @end table
  14921. @subsection Examples
  14922. @itemize
  14923. @item
  14924. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14925. @example
  14926. 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
  14927. @end example
  14928. @item
  14929. Zoom-in up to 1.5 and pan always at center of picture:
  14930. @example
  14931. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14932. @end example
  14933. @item
  14934. Same as above but without pausing:
  14935. @example
  14936. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14937. @end example
  14938. @end itemize
  14939. @anchor{zscale}
  14940. @section zscale
  14941. Scale (resize) the input video, using the z.lib library:
  14942. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14943. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14944. The zscale filter forces the output display aspect ratio to be the same
  14945. as the input, by changing the output sample aspect ratio.
  14946. If the input image format is different from the format requested by
  14947. the next filter, the zscale filter will convert the input to the
  14948. requested format.
  14949. @subsection Options
  14950. The filter accepts the following options.
  14951. @table @option
  14952. @item width, w
  14953. @item height, h
  14954. Set the output video dimension expression. Default value is the input
  14955. dimension.
  14956. If the @var{width} or @var{w} value is 0, the input width is used for
  14957. the output. If the @var{height} or @var{h} value is 0, the input height
  14958. is used for the output.
  14959. If one and only one of the values is -n with n >= 1, the zscale filter
  14960. will use a value that maintains the aspect ratio of the input image,
  14961. calculated from the other specified dimension. After that it will,
  14962. however, make sure that the calculated dimension is divisible by n and
  14963. adjust the value if necessary.
  14964. If both values are -n with n >= 1, the behavior will be identical to
  14965. both values being set to 0 as previously detailed.
  14966. See below for the list of accepted constants for use in the dimension
  14967. expression.
  14968. @item size, s
  14969. Set the video size. For the syntax of this option, check the
  14970. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14971. @item dither, d
  14972. Set the dither type.
  14973. Possible values are:
  14974. @table @var
  14975. @item none
  14976. @item ordered
  14977. @item random
  14978. @item error_diffusion
  14979. @end table
  14980. Default is none.
  14981. @item filter, f
  14982. Set the resize filter type.
  14983. Possible values are:
  14984. @table @var
  14985. @item point
  14986. @item bilinear
  14987. @item bicubic
  14988. @item spline16
  14989. @item spline36
  14990. @item lanczos
  14991. @end table
  14992. Default is bilinear.
  14993. @item range, r
  14994. Set the color range.
  14995. Possible values are:
  14996. @table @var
  14997. @item input
  14998. @item limited
  14999. @item full
  15000. @end table
  15001. Default is same as input.
  15002. @item primaries, p
  15003. Set the color primaries.
  15004. Possible values are:
  15005. @table @var
  15006. @item input
  15007. @item 709
  15008. @item unspecified
  15009. @item 170m
  15010. @item 240m
  15011. @item 2020
  15012. @end table
  15013. Default is same as input.
  15014. @item transfer, t
  15015. Set the transfer characteristics.
  15016. Possible values are:
  15017. @table @var
  15018. @item input
  15019. @item 709
  15020. @item unspecified
  15021. @item 601
  15022. @item linear
  15023. @item 2020_10
  15024. @item 2020_12
  15025. @item smpte2084
  15026. @item iec61966-2-1
  15027. @item arib-std-b67
  15028. @end table
  15029. Default is same as input.
  15030. @item matrix, m
  15031. Set the colorspace matrix.
  15032. Possible value are:
  15033. @table @var
  15034. @item input
  15035. @item 709
  15036. @item unspecified
  15037. @item 470bg
  15038. @item 170m
  15039. @item 2020_ncl
  15040. @item 2020_cl
  15041. @end table
  15042. Default is same as input.
  15043. @item rangein, rin
  15044. Set the input color range.
  15045. Possible values are:
  15046. @table @var
  15047. @item input
  15048. @item limited
  15049. @item full
  15050. @end table
  15051. Default is same as input.
  15052. @item primariesin, pin
  15053. Set the input color primaries.
  15054. Possible values are:
  15055. @table @var
  15056. @item input
  15057. @item 709
  15058. @item unspecified
  15059. @item 170m
  15060. @item 240m
  15061. @item 2020
  15062. @end table
  15063. Default is same as input.
  15064. @item transferin, tin
  15065. Set the input transfer characteristics.
  15066. Possible values are:
  15067. @table @var
  15068. @item input
  15069. @item 709
  15070. @item unspecified
  15071. @item 601
  15072. @item linear
  15073. @item 2020_10
  15074. @item 2020_12
  15075. @end table
  15076. Default is same as input.
  15077. @item matrixin, min
  15078. Set the input colorspace matrix.
  15079. Possible value are:
  15080. @table @var
  15081. @item input
  15082. @item 709
  15083. @item unspecified
  15084. @item 470bg
  15085. @item 170m
  15086. @item 2020_ncl
  15087. @item 2020_cl
  15088. @end table
  15089. @item chromal, c
  15090. Set the output chroma location.
  15091. Possible values are:
  15092. @table @var
  15093. @item input
  15094. @item left
  15095. @item center
  15096. @item topleft
  15097. @item top
  15098. @item bottomleft
  15099. @item bottom
  15100. @end table
  15101. @item chromalin, cin
  15102. Set the input chroma location.
  15103. Possible values are:
  15104. @table @var
  15105. @item input
  15106. @item left
  15107. @item center
  15108. @item topleft
  15109. @item top
  15110. @item bottomleft
  15111. @item bottom
  15112. @end table
  15113. @item npl
  15114. Set the nominal peak luminance.
  15115. @end table
  15116. The values of the @option{w} and @option{h} options are expressions
  15117. containing the following constants:
  15118. @table @var
  15119. @item in_w
  15120. @item in_h
  15121. The input width and height
  15122. @item iw
  15123. @item ih
  15124. These are the same as @var{in_w} and @var{in_h}.
  15125. @item out_w
  15126. @item out_h
  15127. The output (scaled) width and height
  15128. @item ow
  15129. @item oh
  15130. These are the same as @var{out_w} and @var{out_h}
  15131. @item a
  15132. The same as @var{iw} / @var{ih}
  15133. @item sar
  15134. input sample aspect ratio
  15135. @item dar
  15136. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15137. @item hsub
  15138. @item vsub
  15139. horizontal and vertical input chroma subsample values. For example for the
  15140. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15141. @item ohsub
  15142. @item ovsub
  15143. horizontal and vertical output chroma subsample values. For example for the
  15144. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15145. @end table
  15146. @table @option
  15147. @end table
  15148. @c man end VIDEO FILTERS
  15149. @chapter OpenCL Video Filters
  15150. @c man begin OPENCL VIDEO FILTERS
  15151. Below is a description of the currently available OpenCL video filters.
  15152. To enable compilation of these filters you need to configure FFmpeg with
  15153. @code{--enable-opencl}.
  15154. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  15155. @table @option
  15156. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  15157. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  15158. given device parameters.
  15159. @item -filter_hw_device @var{name}
  15160. Pass the hardware device called @var{name} to all filters in any filter graph.
  15161. @end table
  15162. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  15163. @itemize
  15164. @item
  15165. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  15166. @example
  15167. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  15168. @end example
  15169. @end itemize
  15170. 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.
  15171. @section avgblur_opencl
  15172. Apply average blur filter.
  15173. The filter accepts the following options:
  15174. @table @option
  15175. @item sizeX
  15176. Set horizontal radius size.
  15177. Range is @code{[1, 1024]} and default value is @code{1}.
  15178. @item planes
  15179. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15180. @item sizeY
  15181. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  15182. @end table
  15183. @subsection Example
  15184. @itemize
  15185. @item
  15186. 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.
  15187. @example
  15188. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  15189. @end example
  15190. @end itemize
  15191. @section boxblur_opencl
  15192. Apply a boxblur algorithm to the input video.
  15193. It accepts the following parameters:
  15194. @table @option
  15195. @item luma_radius, lr
  15196. @item luma_power, lp
  15197. @item chroma_radius, cr
  15198. @item chroma_power, cp
  15199. @item alpha_radius, ar
  15200. @item alpha_power, ap
  15201. @end table
  15202. A description of the accepted options follows.
  15203. @table @option
  15204. @item luma_radius, lr
  15205. @item chroma_radius, cr
  15206. @item alpha_radius, ar
  15207. Set an expression for the box radius in pixels used for blurring the
  15208. corresponding input plane.
  15209. The radius value must be a non-negative number, and must not be
  15210. greater than the value of the expression @code{min(w,h)/2} for the
  15211. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  15212. planes.
  15213. Default value for @option{luma_radius} is "2". If not specified,
  15214. @option{chroma_radius} and @option{alpha_radius} default to the
  15215. corresponding value set for @option{luma_radius}.
  15216. The expressions can contain the following constants:
  15217. @table @option
  15218. @item w
  15219. @item h
  15220. The input width and height in pixels.
  15221. @item cw
  15222. @item ch
  15223. The input chroma image width and height in pixels.
  15224. @item hsub
  15225. @item vsub
  15226. The horizontal and vertical chroma subsample values. For example, for the
  15227. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  15228. @end table
  15229. @item luma_power, lp
  15230. @item chroma_power, cp
  15231. @item alpha_power, ap
  15232. Specify how many times the boxblur filter is applied to the
  15233. corresponding plane.
  15234. Default value for @option{luma_power} is 2. If not specified,
  15235. @option{chroma_power} and @option{alpha_power} default to the
  15236. corresponding value set for @option{luma_power}.
  15237. A value of 0 will disable the effect.
  15238. @end table
  15239. @subsection Examples
  15240. 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.
  15241. @itemize
  15242. @item
  15243. Apply a boxblur filter with the luma, chroma, and alpha radius
  15244. 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.
  15245. @example
  15246. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  15247. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  15248. @end example
  15249. @item
  15250. 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.
  15251. For the luma plane, a 2x2 box radius will be run once.
  15252. For the chroma plane, a 4x4 box radius will be run 5 times.
  15253. For the alpha plane, a 3x3 box radius will be run 7 times.
  15254. @example
  15255. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  15256. @end example
  15257. @end itemize
  15258. @section convolution_opencl
  15259. Apply convolution of 3x3, 5x5, 7x7 matrix.
  15260. The filter accepts the following options:
  15261. @table @option
  15262. @item 0m
  15263. @item 1m
  15264. @item 2m
  15265. @item 3m
  15266. Set matrix for each plane.
  15267. Matrix is sequence of 9, 25 or 49 signed numbers.
  15268. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  15269. @item 0rdiv
  15270. @item 1rdiv
  15271. @item 2rdiv
  15272. @item 3rdiv
  15273. Set multiplier for calculated value for each plane.
  15274. If unset or 0, it will be sum of all matrix elements.
  15275. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  15276. @item 0bias
  15277. @item 1bias
  15278. @item 2bias
  15279. @item 3bias
  15280. Set bias for each plane. This value is added to the result of the multiplication.
  15281. Useful for making the overall image brighter or darker.
  15282. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  15283. @end table
  15284. @subsection Examples
  15285. @itemize
  15286. @item
  15287. Apply sharpen:
  15288. @example
  15289. -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
  15290. @end example
  15291. @item
  15292. Apply blur:
  15293. @example
  15294. -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
  15295. @end example
  15296. @item
  15297. Apply edge enhance:
  15298. @example
  15299. -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
  15300. @end example
  15301. @item
  15302. Apply edge detect:
  15303. @example
  15304. -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
  15305. @end example
  15306. @item
  15307. Apply laplacian edge detector which includes diagonals:
  15308. @example
  15309. -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
  15310. @end example
  15311. @item
  15312. Apply emboss:
  15313. @example
  15314. -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
  15315. @end example
  15316. @end itemize
  15317. @section dilation_opencl
  15318. Apply dilation effect to the video.
  15319. This filter replaces the pixel by the local(3x3) maximum.
  15320. It accepts the following options:
  15321. @table @option
  15322. @item threshold0
  15323. @item threshold1
  15324. @item threshold2
  15325. @item threshold3
  15326. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15327. If @code{0}, plane will remain unchanged.
  15328. @item coordinates
  15329. Flag which specifies the pixel to refer to.
  15330. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15331. Flags to local 3x3 coordinates region centered on @code{x}:
  15332. 1 2 3
  15333. 4 x 5
  15334. 6 7 8
  15335. @end table
  15336. @subsection Example
  15337. @itemize
  15338. @item
  15339. 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.
  15340. @example
  15341. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15342. @end example
  15343. @end itemize
  15344. @section erosion_opencl
  15345. Apply erosion effect to the video.
  15346. This filter replaces the pixel by the local(3x3) minimum.
  15347. It accepts the following options:
  15348. @table @option
  15349. @item threshold0
  15350. @item threshold1
  15351. @item threshold2
  15352. @item threshold3
  15353. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15354. If @code{0}, plane will remain unchanged.
  15355. @item coordinates
  15356. Flag which specifies the pixel to refer to.
  15357. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15358. Flags to local 3x3 coordinates region centered on @code{x}:
  15359. 1 2 3
  15360. 4 x 5
  15361. 6 7 8
  15362. @end table
  15363. @subsection Example
  15364. @itemize
  15365. @item
  15366. 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.
  15367. @example
  15368. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15369. @end example
  15370. @end itemize
  15371. @section colorkey_opencl
  15372. RGB colorspace color keying.
  15373. The filter accepts the following options:
  15374. @table @option
  15375. @item color
  15376. The color which will be replaced with transparency.
  15377. @item similarity
  15378. Similarity percentage with the key color.
  15379. 0.01 matches only the exact key color, while 1.0 matches everything.
  15380. @item blend
  15381. Blend percentage.
  15382. 0.0 makes pixels either fully transparent, or not transparent at all.
  15383. Higher values result in semi-transparent pixels, with a higher transparency
  15384. the more similar the pixels color is to the key color.
  15385. @end table
  15386. @subsection Examples
  15387. @itemize
  15388. @item
  15389. Make every semi-green pixel in the input transparent with some slight blending:
  15390. @example
  15391. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  15392. @end example
  15393. @end itemize
  15394. @section deshake_opencl
  15395. Feature-point based video stabilization filter.
  15396. The filter accepts the following options:
  15397. @table @option
  15398. @item tripod
  15399. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  15400. @item debug
  15401. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  15402. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  15403. Viewing point matches in the output video is only supported for RGB input.
  15404. Defaults to @code{0}.
  15405. @item adaptive_crop
  15406. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  15407. Defaults to @code{1}.
  15408. @item refine_features
  15409. Whether or not feature points should be refined at a sub-pixel level.
  15410. This can be turned off for a slight performance gain at the cost of precision.
  15411. Defaults to @code{1}.
  15412. @item smooth_strength
  15413. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  15414. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  15415. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  15416. Defaults to @code{0.0}.
  15417. @item smooth_window_multiplier
  15418. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  15419. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  15420. Acceptable values range from @code{0.1} to @code{10.0}.
  15421. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  15422. potentially improving smoothness, but also increase latency and memory usage.
  15423. Defaults to @code{2.0}.
  15424. @end table
  15425. @subsection Examples
  15426. @itemize
  15427. @item
  15428. Stabilize a video with a fixed, medium smoothing strength:
  15429. @example
  15430. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  15431. @end example
  15432. @item
  15433. Stabilize a video with debugging (both in console and in rendered video):
  15434. @example
  15435. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  15436. @end example
  15437. @end itemize
  15438. @section nlmeans_opencl
  15439. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  15440. @section overlay_opencl
  15441. Overlay one video on top of another.
  15442. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  15443. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  15444. The filter accepts the following options:
  15445. @table @option
  15446. @item x
  15447. Set the x coordinate of the overlaid video on the main video.
  15448. Default value is @code{0}.
  15449. @item y
  15450. Set the x coordinate of the overlaid video on the main video.
  15451. Default value is @code{0}.
  15452. @end table
  15453. @subsection Examples
  15454. @itemize
  15455. @item
  15456. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  15457. @example
  15458. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15459. @end example
  15460. @item
  15461. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  15462. @example
  15463. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15464. @end example
  15465. @end itemize
  15466. @section prewitt_opencl
  15467. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  15468. The filter accepts the following option:
  15469. @table @option
  15470. @item planes
  15471. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15472. @item scale
  15473. Set value which will be multiplied with filtered result.
  15474. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15475. @item delta
  15476. Set value which will be added to filtered result.
  15477. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15478. @end table
  15479. @subsection Example
  15480. @itemize
  15481. @item
  15482. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  15483. @example
  15484. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15485. @end example
  15486. @end itemize
  15487. @section roberts_opencl
  15488. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  15489. The filter accepts the following option:
  15490. @table @option
  15491. @item planes
  15492. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15493. @item scale
  15494. Set value which will be multiplied with filtered result.
  15495. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15496. @item delta
  15497. Set value which will be added to filtered result.
  15498. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15499. @end table
  15500. @subsection Example
  15501. @itemize
  15502. @item
  15503. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  15504. @example
  15505. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15506. @end example
  15507. @end itemize
  15508. @section sobel_opencl
  15509. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  15510. The filter accepts the following option:
  15511. @table @option
  15512. @item planes
  15513. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15514. @item scale
  15515. Set value which will be multiplied with filtered result.
  15516. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15517. @item delta
  15518. Set value which will be added to filtered result.
  15519. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15520. @end table
  15521. @subsection Example
  15522. @itemize
  15523. @item
  15524. Apply sobel operator with scale set to 2 and delta set to 10
  15525. @example
  15526. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15527. @end example
  15528. @end itemize
  15529. @section tonemap_opencl
  15530. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  15531. It accepts the following parameters:
  15532. @table @option
  15533. @item tonemap
  15534. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  15535. @item param
  15536. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  15537. @item desat
  15538. Apply desaturation for highlights that exceed this level of brightness. The
  15539. higher the parameter, the more color information will be preserved. This
  15540. setting helps prevent unnaturally blown-out colors for super-highlights, by
  15541. (smoothly) turning into white instead. This makes images feel more natural,
  15542. at the cost of reducing information about out-of-range colors.
  15543. The default value is 0.5, and the algorithm here is a little different from
  15544. the cpu version tonemap currently. A setting of 0.0 disables this option.
  15545. @item threshold
  15546. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  15547. is used to detect whether the scene has changed or not. If the distance between
  15548. the current frame average brightness and the current running average exceeds
  15549. a threshold value, we would re-calculate scene average and peak brightness.
  15550. The default value is 0.2.
  15551. @item format
  15552. Specify the output pixel format.
  15553. Currently supported formats are:
  15554. @table @var
  15555. @item p010
  15556. @item nv12
  15557. @end table
  15558. @item range, r
  15559. Set the output color range.
  15560. Possible values are:
  15561. @table @var
  15562. @item tv/mpeg
  15563. @item pc/jpeg
  15564. @end table
  15565. Default is same as input.
  15566. @item primaries, p
  15567. Set the output color primaries.
  15568. Possible values are:
  15569. @table @var
  15570. @item bt709
  15571. @item bt2020
  15572. @end table
  15573. Default is same as input.
  15574. @item transfer, t
  15575. Set the output transfer characteristics.
  15576. Possible values are:
  15577. @table @var
  15578. @item bt709
  15579. @item bt2020
  15580. @end table
  15581. Default is bt709.
  15582. @item matrix, m
  15583. Set the output colorspace matrix.
  15584. Possible value are:
  15585. @table @var
  15586. @item bt709
  15587. @item bt2020
  15588. @end table
  15589. Default is same as input.
  15590. @end table
  15591. @subsection Example
  15592. @itemize
  15593. @item
  15594. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  15595. @example
  15596. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  15597. @end example
  15598. @end itemize
  15599. @section unsharp_opencl
  15600. Sharpen or blur the input video.
  15601. It accepts the following parameters:
  15602. @table @option
  15603. @item luma_msize_x, lx
  15604. Set the luma matrix horizontal size.
  15605. Range is @code{[1, 23]} and default value is @code{5}.
  15606. @item luma_msize_y, ly
  15607. Set the luma matrix vertical size.
  15608. Range is @code{[1, 23]} and default value is @code{5}.
  15609. @item luma_amount, la
  15610. Set the luma effect strength.
  15611. Range is @code{[-10, 10]} and default value is @code{1.0}.
  15612. Negative values will blur the input video, while positive values will
  15613. sharpen it, a value of zero will disable the effect.
  15614. @item chroma_msize_x, cx
  15615. Set the chroma matrix horizontal size.
  15616. Range is @code{[1, 23]} and default value is @code{5}.
  15617. @item chroma_msize_y, cy
  15618. Set the chroma matrix vertical size.
  15619. Range is @code{[1, 23]} and default value is @code{5}.
  15620. @item chroma_amount, ca
  15621. Set the chroma effect strength.
  15622. Range is @code{[-10, 10]} and default value is @code{0.0}.
  15623. Negative values will blur the input video, while positive values will
  15624. sharpen it, a value of zero will disable the effect.
  15625. @end table
  15626. All parameters are optional and default to the equivalent of the
  15627. string '5:5:1.0:5:5:0.0'.
  15628. @subsection Examples
  15629. @itemize
  15630. @item
  15631. Apply strong luma sharpen effect:
  15632. @example
  15633. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  15634. @end example
  15635. @item
  15636. Apply a strong blur of both luma and chroma parameters:
  15637. @example
  15638. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  15639. @end example
  15640. @end itemize
  15641. @c man end OPENCL VIDEO FILTERS
  15642. @chapter Video Sources
  15643. @c man begin VIDEO SOURCES
  15644. Below is a description of the currently available video sources.
  15645. @section buffer
  15646. Buffer video frames, and make them available to the filter chain.
  15647. This source is mainly intended for a programmatic use, in particular
  15648. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  15649. It accepts the following parameters:
  15650. @table @option
  15651. @item video_size
  15652. Specify the size (width and height) of the buffered video frames. For the
  15653. syntax of this option, check the
  15654. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15655. @item width
  15656. The input video width.
  15657. @item height
  15658. The input video height.
  15659. @item pix_fmt
  15660. A string representing the pixel format of the buffered video frames.
  15661. It may be a number corresponding to a pixel format, or a pixel format
  15662. name.
  15663. @item time_base
  15664. Specify the timebase assumed by the timestamps of the buffered frames.
  15665. @item frame_rate
  15666. Specify the frame rate expected for the video stream.
  15667. @item pixel_aspect, sar
  15668. The sample (pixel) aspect ratio of the input video.
  15669. @item sws_param
  15670. Specify the optional parameters to be used for the scale filter which
  15671. is automatically inserted when an input change is detected in the
  15672. input size or format.
  15673. @item hw_frames_ctx
  15674. When using a hardware pixel format, this should be a reference to an
  15675. AVHWFramesContext describing input frames.
  15676. @end table
  15677. For example:
  15678. @example
  15679. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  15680. @end example
  15681. will instruct the source to accept video frames with size 320x240 and
  15682. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  15683. square pixels (1:1 sample aspect ratio).
  15684. Since the pixel format with name "yuv410p" corresponds to the number 6
  15685. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  15686. this example corresponds to:
  15687. @example
  15688. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  15689. @end example
  15690. Alternatively, the options can be specified as a flat string, but this
  15691. syntax is deprecated:
  15692. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}[:@var{sws_param}]
  15693. @section cellauto
  15694. Create a pattern generated by an elementary cellular automaton.
  15695. The initial state of the cellular automaton can be defined through the
  15696. @option{filename} and @option{pattern} options. If such options are
  15697. not specified an initial state is created randomly.
  15698. At each new frame a new row in the video is filled with the result of
  15699. the cellular automaton next generation. The behavior when the whole
  15700. frame is filled is defined by the @option{scroll} option.
  15701. This source accepts the following options:
  15702. @table @option
  15703. @item filename, f
  15704. Read the initial cellular automaton state, i.e. the starting row, from
  15705. the specified file.
  15706. In the file, each non-whitespace character is considered an alive
  15707. cell, a newline will terminate the row, and further characters in the
  15708. file will be ignored.
  15709. @item pattern, p
  15710. Read the initial cellular automaton state, i.e. the starting row, from
  15711. the specified string.
  15712. Each non-whitespace character in the string is considered an alive
  15713. cell, a newline will terminate the row, and further characters in the
  15714. string will be ignored.
  15715. @item rate, r
  15716. Set the video rate, that is the number of frames generated per second.
  15717. Default is 25.
  15718. @item random_fill_ratio, ratio
  15719. Set the random fill ratio for the initial cellular automaton row. It
  15720. is a floating point number value ranging from 0 to 1, defaults to
  15721. 1/PHI.
  15722. This option is ignored when a file or a pattern is specified.
  15723. @item random_seed, seed
  15724. Set the seed for filling randomly the initial row, must be an integer
  15725. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15726. set to -1, the filter will try to use a good random seed on a best
  15727. effort basis.
  15728. @item rule
  15729. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  15730. Default value is 110.
  15731. @item size, s
  15732. Set the size of the output video. For the syntax of this option, check the
  15733. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15734. If @option{filename} or @option{pattern} is specified, the size is set
  15735. by default to the width of the specified initial state row, and the
  15736. height is set to @var{width} * PHI.
  15737. If @option{size} is set, it must contain the width of the specified
  15738. pattern string, and the specified pattern will be centered in the
  15739. larger row.
  15740. If a filename or a pattern string is not specified, the size value
  15741. defaults to "320x518" (used for a randomly generated initial state).
  15742. @item scroll
  15743. If set to 1, scroll the output upward when all the rows in the output
  15744. have been already filled. If set to 0, the new generated row will be
  15745. written over the top row just after the bottom row is filled.
  15746. Defaults to 1.
  15747. @item start_full, full
  15748. If set to 1, completely fill the output with generated rows before
  15749. outputting the first frame.
  15750. This is the default behavior, for disabling set the value to 0.
  15751. @item stitch
  15752. If set to 1, stitch the left and right row edges together.
  15753. This is the default behavior, for disabling set the value to 0.
  15754. @end table
  15755. @subsection Examples
  15756. @itemize
  15757. @item
  15758. Read the initial state from @file{pattern}, and specify an output of
  15759. size 200x400.
  15760. @example
  15761. cellauto=f=pattern:s=200x400
  15762. @end example
  15763. @item
  15764. Generate a random initial row with a width of 200 cells, with a fill
  15765. ratio of 2/3:
  15766. @example
  15767. cellauto=ratio=2/3:s=200x200
  15768. @end example
  15769. @item
  15770. Create a pattern generated by rule 18 starting by a single alive cell
  15771. centered on an initial row with width 100:
  15772. @example
  15773. cellauto=p=@@:s=100x400:full=0:rule=18
  15774. @end example
  15775. @item
  15776. Specify a more elaborated initial pattern:
  15777. @example
  15778. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  15779. @end example
  15780. @end itemize
  15781. @anchor{coreimagesrc}
  15782. @section coreimagesrc
  15783. Video source generated on GPU using Apple's CoreImage API on OSX.
  15784. This video source is a specialized version of the @ref{coreimage} video filter.
  15785. Use a core image generator at the beginning of the applied filterchain to
  15786. generate the content.
  15787. The coreimagesrc video source accepts the following options:
  15788. @table @option
  15789. @item list_generators
  15790. List all available generators along with all their respective options as well as
  15791. possible minimum and maximum values along with the default values.
  15792. @example
  15793. list_generators=true
  15794. @end example
  15795. @item size, s
  15796. Specify the size of the sourced video. For the syntax of this option, check the
  15797. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15798. The default value is @code{320x240}.
  15799. @item rate, r
  15800. Specify the frame rate of the sourced video, as the number of frames
  15801. generated per second. It has to be a string in the format
  15802. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15803. number or a valid video frame rate abbreviation. The default value is
  15804. "25".
  15805. @item sar
  15806. Set the sample aspect ratio of the sourced video.
  15807. @item duration, d
  15808. Set the duration of the sourced video. See
  15809. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15810. for the accepted syntax.
  15811. If not specified, or the expressed duration is negative, the video is
  15812. supposed to be generated forever.
  15813. @end table
  15814. Additionally, all options of the @ref{coreimage} video filter are accepted.
  15815. A complete filterchain can be used for further processing of the
  15816. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  15817. and examples for details.
  15818. @subsection Examples
  15819. @itemize
  15820. @item
  15821. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  15822. given as complete and escaped command-line for Apple's standard bash shell:
  15823. @example
  15824. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  15825. @end example
  15826. This example is equivalent to the QRCode example of @ref{coreimage} without the
  15827. need for a nullsrc video source.
  15828. @end itemize
  15829. @section mandelbrot
  15830. Generate a Mandelbrot set fractal, and progressively zoom towards the
  15831. point specified with @var{start_x} and @var{start_y}.
  15832. This source accepts the following options:
  15833. @table @option
  15834. @item end_pts
  15835. Set the terminal pts value. Default value is 400.
  15836. @item end_scale
  15837. Set the terminal scale value.
  15838. Must be a floating point value. Default value is 0.3.
  15839. @item inner
  15840. Set the inner coloring mode, that is the algorithm used to draw the
  15841. Mandelbrot fractal internal region.
  15842. It shall assume one of the following values:
  15843. @table @option
  15844. @item black
  15845. Set black mode.
  15846. @item convergence
  15847. Show time until convergence.
  15848. @item mincol
  15849. Set color based on point closest to the origin of the iterations.
  15850. @item period
  15851. Set period mode.
  15852. @end table
  15853. Default value is @var{mincol}.
  15854. @item bailout
  15855. Set the bailout value. Default value is 10.0.
  15856. @item maxiter
  15857. Set the maximum of iterations performed by the rendering
  15858. algorithm. Default value is 7189.
  15859. @item outer
  15860. Set outer coloring mode.
  15861. It shall assume one of following values:
  15862. @table @option
  15863. @item iteration_count
  15864. Set iteration count mode.
  15865. @item normalized_iteration_count
  15866. set normalized iteration count mode.
  15867. @end table
  15868. Default value is @var{normalized_iteration_count}.
  15869. @item rate, r
  15870. Set frame rate, expressed as number of frames per second. Default
  15871. value is "25".
  15872. @item size, s
  15873. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  15874. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  15875. @item start_scale
  15876. Set the initial scale value. Default value is 3.0.
  15877. @item start_x
  15878. Set the initial x position. Must be a floating point value between
  15879. -100 and 100. Default value is -0.743643887037158704752191506114774.
  15880. @item start_y
  15881. Set the initial y position. Must be a floating point value between
  15882. -100 and 100. Default value is -0.131825904205311970493132056385139.
  15883. @end table
  15884. @section mptestsrc
  15885. Generate various test patterns, as generated by the MPlayer test filter.
  15886. The size of the generated video is fixed, and is 256x256.
  15887. This source is useful in particular for testing encoding features.
  15888. This source accepts the following options:
  15889. @table @option
  15890. @item rate, r
  15891. Specify the frame rate of the sourced video, as the number of frames
  15892. generated per second. It has to be a string in the format
  15893. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15894. number or a valid video frame rate abbreviation. The default value is
  15895. "25".
  15896. @item duration, d
  15897. Set the duration of the sourced video. See
  15898. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15899. for the accepted syntax.
  15900. If not specified, or the expressed duration is negative, the video is
  15901. supposed to be generated forever.
  15902. @item test, t
  15903. Set the number or the name of the test to perform. Supported tests are:
  15904. @table @option
  15905. @item dc_luma
  15906. @item dc_chroma
  15907. @item freq_luma
  15908. @item freq_chroma
  15909. @item amp_luma
  15910. @item amp_chroma
  15911. @item cbp
  15912. @item mv
  15913. @item ring1
  15914. @item ring2
  15915. @item all
  15916. @end table
  15917. Default value is "all", which will cycle through the list of all tests.
  15918. @end table
  15919. Some examples:
  15920. @example
  15921. mptestsrc=t=dc_luma
  15922. @end example
  15923. will generate a "dc_luma" test pattern.
  15924. @section frei0r_src
  15925. Provide a frei0r source.
  15926. To enable compilation of this filter you need to install the frei0r
  15927. header and configure FFmpeg with @code{--enable-frei0r}.
  15928. This source accepts the following parameters:
  15929. @table @option
  15930. @item size
  15931. The size of the video to generate. For the syntax of this option, check the
  15932. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15933. @item framerate
  15934. The framerate of the generated video. It may be a string of the form
  15935. @var{num}/@var{den} or a frame rate abbreviation.
  15936. @item filter_name
  15937. The name to the frei0r source to load. For more information regarding frei0r and
  15938. how to set the parameters, read the @ref{frei0r} section in the video filters
  15939. documentation.
  15940. @item filter_params
  15941. A '|'-separated list of parameters to pass to the frei0r source.
  15942. @end table
  15943. For example, to generate a frei0r partik0l source with size 200x200
  15944. and frame rate 10 which is overlaid on the overlay filter main input:
  15945. @example
  15946. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  15947. @end example
  15948. @section life
  15949. Generate a life pattern.
  15950. This source is based on a generalization of John Conway's life game.
  15951. The sourced input represents a life grid, each pixel represents a cell
  15952. which can be in one of two possible states, alive or dead. Every cell
  15953. interacts with its eight neighbours, which are the cells that are
  15954. horizontally, vertically, or diagonally adjacent.
  15955. At each interaction the grid evolves according to the adopted rule,
  15956. which specifies the number of neighbor alive cells which will make a
  15957. cell stay alive or born. The @option{rule} option allows one to specify
  15958. the rule to adopt.
  15959. This source accepts the following options:
  15960. @table @option
  15961. @item filename, f
  15962. Set the file from which to read the initial grid state. In the file,
  15963. each non-whitespace character is considered an alive cell, and newline
  15964. is used to delimit the end of each row.
  15965. If this option is not specified, the initial grid is generated
  15966. randomly.
  15967. @item rate, r
  15968. Set the video rate, that is the number of frames generated per second.
  15969. Default is 25.
  15970. @item random_fill_ratio, ratio
  15971. Set the random fill ratio for the initial random grid. It is a
  15972. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15973. It is ignored when a file is specified.
  15974. @item random_seed, seed
  15975. Set the seed for filling the initial random grid, must be an integer
  15976. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15977. set to -1, the filter will try to use a good random seed on a best
  15978. effort basis.
  15979. @item rule
  15980. Set the life rule.
  15981. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15982. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15983. @var{NS} specifies the number of alive neighbor cells which make a
  15984. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15985. which make a dead cell to become alive (i.e. to "born").
  15986. "s" and "b" can be used in place of "S" and "B", respectively.
  15987. Alternatively a rule can be specified by an 18-bits integer. The 9
  15988. high order bits are used to encode the next cell state if it is alive
  15989. for each number of neighbor alive cells, the low order bits specify
  15990. the rule for "borning" new cells. Higher order bits encode for an
  15991. higher number of neighbor cells.
  15992. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15993. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15994. Default value is "S23/B3", which is the original Conway's game of life
  15995. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15996. cells, and will born a new cell if there are three alive cells around
  15997. a dead cell.
  15998. @item size, s
  15999. Set the size of the output video. For the syntax of this option, check the
  16000. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16001. If @option{filename} is specified, the size is set by default to the
  16002. same size of the input file. If @option{size} is set, it must contain
  16003. the size specified in the input file, and the initial grid defined in
  16004. that file is centered in the larger resulting area.
  16005. If a filename is not specified, the size value defaults to "320x240"
  16006. (used for a randomly generated initial grid).
  16007. @item stitch
  16008. If set to 1, stitch the left and right grid edges together, and the
  16009. top and bottom edges also. Defaults to 1.
  16010. @item mold
  16011. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  16012. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  16013. value from 0 to 255.
  16014. @item life_color
  16015. Set the color of living (or new born) cells.
  16016. @item death_color
  16017. Set the color of dead cells. If @option{mold} is set, this is the first color
  16018. used to represent a dead cell.
  16019. @item mold_color
  16020. Set mold color, for definitely dead and moldy cells.
  16021. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  16022. ffmpeg-utils manual,ffmpeg-utils}.
  16023. @end table
  16024. @subsection Examples
  16025. @itemize
  16026. @item
  16027. Read a grid from @file{pattern}, and center it on a grid of size
  16028. 300x300 pixels:
  16029. @example
  16030. life=f=pattern:s=300x300
  16031. @end example
  16032. @item
  16033. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  16034. @example
  16035. life=ratio=2/3:s=200x200
  16036. @end example
  16037. @item
  16038. Specify a custom rule for evolving a randomly generated grid:
  16039. @example
  16040. life=rule=S14/B34
  16041. @end example
  16042. @item
  16043. Full example with slow death effect (mold) using @command{ffplay}:
  16044. @example
  16045. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  16046. @end example
  16047. @end itemize
  16048. @anchor{allrgb}
  16049. @anchor{allyuv}
  16050. @anchor{color}
  16051. @anchor{haldclutsrc}
  16052. @anchor{nullsrc}
  16053. @anchor{pal75bars}
  16054. @anchor{pal100bars}
  16055. @anchor{rgbtestsrc}
  16056. @anchor{smptebars}
  16057. @anchor{smptehdbars}
  16058. @anchor{testsrc}
  16059. @anchor{testsrc2}
  16060. @anchor{yuvtestsrc}
  16061. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  16062. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  16063. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  16064. The @code{color} source provides an uniformly colored input.
  16065. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  16066. @ref{haldclut} filter.
  16067. The @code{nullsrc} source returns unprocessed video frames. It is
  16068. mainly useful to be employed in analysis / debugging tools, or as the
  16069. source for filters which ignore the input data.
  16070. The @code{pal75bars} source generates a color bars pattern, based on
  16071. EBU PAL recommendations with 75% color levels.
  16072. The @code{pal100bars} source generates a color bars pattern, based on
  16073. EBU PAL recommendations with 100% color levels.
  16074. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  16075. detecting RGB vs BGR issues. You should see a red, green and blue
  16076. stripe from top to bottom.
  16077. The @code{smptebars} source generates a color bars pattern, based on
  16078. the SMPTE Engineering Guideline EG 1-1990.
  16079. The @code{smptehdbars} source generates a color bars pattern, based on
  16080. the SMPTE RP 219-2002.
  16081. The @code{testsrc} source generates a test video pattern, showing a
  16082. color pattern, a scrolling gradient and a timestamp. This is mainly
  16083. intended for testing purposes.
  16084. The @code{testsrc2} source is similar to testsrc, but supports more
  16085. pixel formats instead of just @code{rgb24}. This allows using it as an
  16086. input for other tests without requiring a format conversion.
  16087. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  16088. see a y, cb and cr stripe from top to bottom.
  16089. The sources accept the following parameters:
  16090. @table @option
  16091. @item level
  16092. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  16093. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  16094. pixels to be used as identity matrix for 3D lookup tables. Each component is
  16095. coded on a @code{1/(N*N)} scale.
  16096. @item color, c
  16097. Specify the color of the source, only available in the @code{color}
  16098. source. For the syntax of this option, check the
  16099. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16100. @item size, s
  16101. Specify the size of the sourced video. For the syntax of this option, check the
  16102. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16103. The default value is @code{320x240}.
  16104. This option is not available with the @code{allrgb}, @code{allyuv}, and
  16105. @code{haldclutsrc} filters.
  16106. @item rate, r
  16107. Specify the frame rate of the sourced video, as the number of frames
  16108. generated per second. It has to be a string in the format
  16109. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16110. number or a valid video frame rate abbreviation. The default value is
  16111. "25".
  16112. @item duration, d
  16113. Set the duration of the sourced video. See
  16114. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16115. for the accepted syntax.
  16116. If not specified, or the expressed duration is negative, the video is
  16117. supposed to be generated forever.
  16118. @item sar
  16119. Set the sample aspect ratio of the sourced video.
  16120. @item alpha
  16121. Specify the alpha (opacity) of the background, only available in the
  16122. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  16123. 255 (fully opaque, the default).
  16124. @item decimals, n
  16125. Set the number of decimals to show in the timestamp, only available in the
  16126. @code{testsrc} source.
  16127. The displayed timestamp value will correspond to the original
  16128. timestamp value multiplied by the power of 10 of the specified
  16129. value. Default value is 0.
  16130. @end table
  16131. @subsection Examples
  16132. @itemize
  16133. @item
  16134. Generate a video with a duration of 5.3 seconds, with size
  16135. 176x144 and a frame rate of 10 frames per second:
  16136. @example
  16137. testsrc=duration=5.3:size=qcif:rate=10
  16138. @end example
  16139. @item
  16140. The following graph description will generate a red source
  16141. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  16142. frames per second:
  16143. @example
  16144. color=c=red@@0.2:s=qcif:r=10
  16145. @end example
  16146. @item
  16147. If the input content is to be ignored, @code{nullsrc} can be used. The
  16148. following command generates noise in the luminance plane by employing
  16149. the @code{geq} filter:
  16150. @example
  16151. nullsrc=s=256x256, geq=random(1)*255:128:128
  16152. @end example
  16153. @end itemize
  16154. @subsection Commands
  16155. The @code{color} source supports the following commands:
  16156. @table @option
  16157. @item c, color
  16158. Set the color of the created image. Accepts the same syntax of the
  16159. corresponding @option{color} option.
  16160. @end table
  16161. @section openclsrc
  16162. Generate video using an OpenCL program.
  16163. @table @option
  16164. @item source
  16165. OpenCL program source file.
  16166. @item kernel
  16167. Kernel name in program.
  16168. @item size, s
  16169. Size of frames to generate. This must be set.
  16170. @item format
  16171. Pixel format to use for the generated frames. This must be set.
  16172. @item rate, r
  16173. Number of frames generated every second. Default value is '25'.
  16174. @end table
  16175. For details of how the program loading works, see the @ref{program_opencl}
  16176. filter.
  16177. Example programs:
  16178. @itemize
  16179. @item
  16180. Generate a colour ramp by setting pixel values from the position of the pixel
  16181. in the output image. (Note that this will work with all pixel formats, but
  16182. the generated output will not be the same.)
  16183. @verbatim
  16184. __kernel void ramp(__write_only image2d_t dst,
  16185. unsigned int index)
  16186. {
  16187. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16188. float4 val;
  16189. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  16190. write_imagef(dst, loc, val);
  16191. }
  16192. @end verbatim
  16193. @item
  16194. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  16195. @verbatim
  16196. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  16197. unsigned int index)
  16198. {
  16199. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16200. float4 value = 0.0f;
  16201. int x = loc.x + index;
  16202. int y = loc.y + index;
  16203. while (x > 0 || y > 0) {
  16204. if (x % 3 == 1 && y % 3 == 1) {
  16205. value = 1.0f;
  16206. break;
  16207. }
  16208. x /= 3;
  16209. y /= 3;
  16210. }
  16211. write_imagef(dst, loc, value);
  16212. }
  16213. @end verbatim
  16214. @end itemize
  16215. @section sierpinski
  16216. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  16217. This source accepts the following options:
  16218. @table @option
  16219. @item size, s
  16220. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16221. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16222. @item rate, r
  16223. Set frame rate, expressed as number of frames per second. Default
  16224. value is "25".
  16225. @item seed
  16226. Set seed which is used for random panning.
  16227. @item jump
  16228. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  16229. @item type
  16230. Set fractal type, can be default @code{carpet} or @code{triangle}.
  16231. @end table
  16232. @c man end VIDEO SOURCES
  16233. @chapter Video Sinks
  16234. @c man begin VIDEO SINKS
  16235. Below is a description of the currently available video sinks.
  16236. @section buffersink
  16237. Buffer video frames, and make them available to the end of the filter
  16238. graph.
  16239. This sink is mainly intended for programmatic use, in particular
  16240. through the interface defined in @file{libavfilter/buffersink.h}
  16241. or the options system.
  16242. It accepts a pointer to an AVBufferSinkContext structure, which
  16243. defines the incoming buffers' formats, to be passed as the opaque
  16244. parameter to @code{avfilter_init_filter} for initialization.
  16245. @section nullsink
  16246. Null video sink: do absolutely nothing with the input video. It is
  16247. mainly useful as a template and for use in analysis / debugging
  16248. tools.
  16249. @c man end VIDEO SINKS
  16250. @chapter Multimedia Filters
  16251. @c man begin MULTIMEDIA FILTERS
  16252. Below is a description of the currently available multimedia filters.
  16253. @section abitscope
  16254. Convert input audio to a video output, displaying the audio bit scope.
  16255. The filter accepts the following options:
  16256. @table @option
  16257. @item rate, r
  16258. Set frame rate, expressed as number of frames per second. Default
  16259. value is "25".
  16260. @item size, s
  16261. Specify the video size for the output. For the syntax of this option, check the
  16262. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16263. Default value is @code{1024x256}.
  16264. @item colors
  16265. Specify list of colors separated by space or by '|' which will be used to
  16266. draw channels. Unrecognized or missing colors will be replaced
  16267. by white color.
  16268. @end table
  16269. @section ahistogram
  16270. Convert input audio to a video output, displaying the volume histogram.
  16271. The filter accepts the following options:
  16272. @table @option
  16273. @item dmode
  16274. Specify how histogram is calculated.
  16275. It accepts the following values:
  16276. @table @samp
  16277. @item single
  16278. Use single histogram for all channels.
  16279. @item separate
  16280. Use separate histogram for each channel.
  16281. @end table
  16282. Default is @code{single}.
  16283. @item rate, r
  16284. Set frame rate, expressed as number of frames per second. Default
  16285. value is "25".
  16286. @item size, s
  16287. Specify the video size for the output. For the syntax of this option, check the
  16288. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16289. Default value is @code{hd720}.
  16290. @item scale
  16291. Set display scale.
  16292. It accepts the following values:
  16293. @table @samp
  16294. @item log
  16295. logarithmic
  16296. @item sqrt
  16297. square root
  16298. @item cbrt
  16299. cubic root
  16300. @item lin
  16301. linear
  16302. @item rlog
  16303. reverse logarithmic
  16304. @end table
  16305. Default is @code{log}.
  16306. @item ascale
  16307. Set amplitude scale.
  16308. It accepts the following values:
  16309. @table @samp
  16310. @item log
  16311. logarithmic
  16312. @item lin
  16313. linear
  16314. @end table
  16315. Default is @code{log}.
  16316. @item acount
  16317. Set how much frames to accumulate in histogram.
  16318. Default is 1. Setting this to -1 accumulates all frames.
  16319. @item rheight
  16320. Set histogram ratio of window height.
  16321. @item slide
  16322. Set sonogram sliding.
  16323. It accepts the following values:
  16324. @table @samp
  16325. @item replace
  16326. replace old rows with new ones.
  16327. @item scroll
  16328. scroll from top to bottom.
  16329. @end table
  16330. Default is @code{replace}.
  16331. @end table
  16332. @section aphasemeter
  16333. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  16334. representing mean phase of current audio frame. A video output can also be produced and is
  16335. enabled by default. The audio is passed through as first output.
  16336. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  16337. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  16338. and @code{1} means channels are in phase.
  16339. The filter accepts the following options, all related to its video output:
  16340. @table @option
  16341. @item rate, r
  16342. Set the output frame rate. Default value is @code{25}.
  16343. @item size, s
  16344. Set the video size for the output. For the syntax of this option, check the
  16345. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16346. Default value is @code{800x400}.
  16347. @item rc
  16348. @item gc
  16349. @item bc
  16350. Specify the red, green, blue contrast. Default values are @code{2},
  16351. @code{7} and @code{1}.
  16352. Allowed range is @code{[0, 255]}.
  16353. @item mpc
  16354. Set color which will be used for drawing median phase. If color is
  16355. @code{none} which is default, no median phase value will be drawn.
  16356. @item video
  16357. Enable video output. Default is enabled.
  16358. @end table
  16359. @section avectorscope
  16360. Convert input audio to a video output, representing the audio vector
  16361. scope.
  16362. The filter is used to measure the difference between channels of stereo
  16363. audio stream. A monaural signal, consisting of identical left and right
  16364. signal, results in straight vertical line. Any stereo separation is visible
  16365. as a deviation from this line, creating a Lissajous figure.
  16366. If the straight (or deviation from it) but horizontal line appears this
  16367. indicates that the left and right channels are out of phase.
  16368. The filter accepts the following options:
  16369. @table @option
  16370. @item mode, m
  16371. Set the vectorscope mode.
  16372. Available values are:
  16373. @table @samp
  16374. @item lissajous
  16375. Lissajous rotated by 45 degrees.
  16376. @item lissajous_xy
  16377. Same as above but not rotated.
  16378. @item polar
  16379. Shape resembling half of circle.
  16380. @end table
  16381. Default value is @samp{lissajous}.
  16382. @item size, s
  16383. Set the video size for the output. For the syntax of this option, check the
  16384. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16385. Default value is @code{400x400}.
  16386. @item rate, r
  16387. Set the output frame rate. Default value is @code{25}.
  16388. @item rc
  16389. @item gc
  16390. @item bc
  16391. @item ac
  16392. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  16393. @code{160}, @code{80} and @code{255}.
  16394. Allowed range is @code{[0, 255]}.
  16395. @item rf
  16396. @item gf
  16397. @item bf
  16398. @item af
  16399. Specify the red, green, blue and alpha fade. Default values are @code{15},
  16400. @code{10}, @code{5} and @code{5}.
  16401. Allowed range is @code{[0, 255]}.
  16402. @item zoom
  16403. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  16404. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  16405. @item draw
  16406. Set the vectorscope drawing mode.
  16407. Available values are:
  16408. @table @samp
  16409. @item dot
  16410. Draw dot for each sample.
  16411. @item line
  16412. Draw line between previous and current sample.
  16413. @end table
  16414. Default value is @samp{dot}.
  16415. @item scale
  16416. Specify amplitude scale of audio samples.
  16417. Available values are:
  16418. @table @samp
  16419. @item lin
  16420. Linear.
  16421. @item sqrt
  16422. Square root.
  16423. @item cbrt
  16424. Cubic root.
  16425. @item log
  16426. Logarithmic.
  16427. @end table
  16428. @item swap
  16429. Swap left channel axis with right channel axis.
  16430. @item mirror
  16431. Mirror axis.
  16432. @table @samp
  16433. @item none
  16434. No mirror.
  16435. @item x
  16436. Mirror only x axis.
  16437. @item y
  16438. Mirror only y axis.
  16439. @item xy
  16440. Mirror both axis.
  16441. @end table
  16442. @end table
  16443. @subsection Examples
  16444. @itemize
  16445. @item
  16446. Complete example using @command{ffplay}:
  16447. @example
  16448. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16449. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  16450. @end example
  16451. @end itemize
  16452. @section bench, abench
  16453. Benchmark part of a filtergraph.
  16454. The filter accepts the following options:
  16455. @table @option
  16456. @item action
  16457. Start or stop a timer.
  16458. Available values are:
  16459. @table @samp
  16460. @item start
  16461. Get the current time, set it as frame metadata (using the key
  16462. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  16463. @item stop
  16464. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  16465. the input frame metadata to get the time difference. Time difference, average,
  16466. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  16467. @code{min}) are then printed. The timestamps are expressed in seconds.
  16468. @end table
  16469. @end table
  16470. @subsection Examples
  16471. @itemize
  16472. @item
  16473. Benchmark @ref{selectivecolor} filter:
  16474. @example
  16475. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  16476. @end example
  16477. @end itemize
  16478. @section concat
  16479. Concatenate audio and video streams, joining them together one after the
  16480. other.
  16481. The filter works on segments of synchronized video and audio streams. All
  16482. segments must have the same number of streams of each type, and that will
  16483. also be the number of streams at output.
  16484. The filter accepts the following options:
  16485. @table @option
  16486. @item n
  16487. Set the number of segments. Default is 2.
  16488. @item v
  16489. Set the number of output video streams, that is also the number of video
  16490. streams in each segment. Default is 1.
  16491. @item a
  16492. Set the number of output audio streams, that is also the number of audio
  16493. streams in each segment. Default is 0.
  16494. @item unsafe
  16495. Activate unsafe mode: do not fail if segments have a different format.
  16496. @end table
  16497. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  16498. @var{a} audio outputs.
  16499. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  16500. segment, in the same order as the outputs, then the inputs for the second
  16501. segment, etc.
  16502. Related streams do not always have exactly the same duration, for various
  16503. reasons including codec frame size or sloppy authoring. For that reason,
  16504. related synchronized streams (e.g. a video and its audio track) should be
  16505. concatenated at once. The concat filter will use the duration of the longest
  16506. stream in each segment (except the last one), and if necessary pad shorter
  16507. audio streams with silence.
  16508. For this filter to work correctly, all segments must start at timestamp 0.
  16509. All corresponding streams must have the same parameters in all segments; the
  16510. filtering system will automatically select a common pixel format for video
  16511. streams, and a common sample format, sample rate and channel layout for
  16512. audio streams, but other settings, such as resolution, must be converted
  16513. explicitly by the user.
  16514. Different frame rates are acceptable but will result in variable frame rate
  16515. at output; be sure to configure the output file to handle it.
  16516. @subsection Examples
  16517. @itemize
  16518. @item
  16519. Concatenate an opening, an episode and an ending, all in bilingual version
  16520. (video in stream 0, audio in streams 1 and 2):
  16521. @example
  16522. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  16523. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  16524. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  16525. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  16526. @end example
  16527. @item
  16528. Concatenate two parts, handling audio and video separately, using the
  16529. (a)movie sources, and adjusting the resolution:
  16530. @example
  16531. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  16532. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  16533. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  16534. @end example
  16535. Note that a desync will happen at the stitch if the audio and video streams
  16536. do not have exactly the same duration in the first file.
  16537. @end itemize
  16538. @subsection Commands
  16539. This filter supports the following commands:
  16540. @table @option
  16541. @item next
  16542. Close the current segment and step to the next one
  16543. @end table
  16544. @section drawgraph, adrawgraph
  16545. Draw a graph using input video or audio metadata.
  16546. It accepts the following parameters:
  16547. @table @option
  16548. @item m1
  16549. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  16550. @item fg1
  16551. Set 1st foreground color expression.
  16552. @item m2
  16553. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  16554. @item fg2
  16555. Set 2nd foreground color expression.
  16556. @item m3
  16557. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  16558. @item fg3
  16559. Set 3rd foreground color expression.
  16560. @item m4
  16561. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  16562. @item fg4
  16563. Set 4th foreground color expression.
  16564. @item min
  16565. Set minimal value of metadata value.
  16566. @item max
  16567. Set maximal value of metadata value.
  16568. @item bg
  16569. Set graph background color. Default is white.
  16570. @item mode
  16571. Set graph mode.
  16572. Available values for mode is:
  16573. @table @samp
  16574. @item bar
  16575. @item dot
  16576. @item line
  16577. @end table
  16578. Default is @code{line}.
  16579. @item slide
  16580. Set slide mode.
  16581. Available values for slide is:
  16582. @table @samp
  16583. @item frame
  16584. Draw new frame when right border is reached.
  16585. @item replace
  16586. Replace old columns with new ones.
  16587. @item scroll
  16588. Scroll from right to left.
  16589. @item rscroll
  16590. Scroll from left to right.
  16591. @item picture
  16592. Draw single picture.
  16593. @end table
  16594. Default is @code{frame}.
  16595. @item size
  16596. Set size of graph video. For the syntax of this option, check the
  16597. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16598. The default value is @code{900x256}.
  16599. The foreground color expressions can use the following variables:
  16600. @table @option
  16601. @item MIN
  16602. Minimal value of metadata value.
  16603. @item MAX
  16604. Maximal value of metadata value.
  16605. @item VAL
  16606. Current metadata key value.
  16607. @end table
  16608. The color is defined as 0xAABBGGRR.
  16609. @end table
  16610. Example using metadata from @ref{signalstats} filter:
  16611. @example
  16612. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  16613. @end example
  16614. Example using metadata from @ref{ebur128} filter:
  16615. @example
  16616. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  16617. @end example
  16618. @anchor{ebur128}
  16619. @section ebur128
  16620. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  16621. level. By default, it logs a message at a frequency of 10Hz with the
  16622. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  16623. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  16624. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  16625. sample format is double-precision floating point. The input stream will be converted to
  16626. this specification, if needed. Users may need to insert aformat and/or aresample filters
  16627. after this filter to obtain the original parameters.
  16628. The filter also has a video output (see the @var{video} option) with a real
  16629. time graph to observe the loudness evolution. The graphic contains the logged
  16630. message mentioned above, so it is not printed anymore when this option is set,
  16631. unless the verbose logging is set. The main graphing area contains the
  16632. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  16633. the momentary loudness (400 milliseconds), but can optionally be configured
  16634. to instead display short-term loudness (see @var{gauge}).
  16635. The green area marks a +/- 1LU target range around the target loudness
  16636. (-23LUFS by default, unless modified through @var{target}).
  16637. More information about the Loudness Recommendation EBU R128 on
  16638. @url{http://tech.ebu.ch/loudness}.
  16639. The filter accepts the following options:
  16640. @table @option
  16641. @item video
  16642. Activate the video output. The audio stream is passed unchanged whether this
  16643. option is set or no. The video stream will be the first output stream if
  16644. activated. Default is @code{0}.
  16645. @item size
  16646. Set the video size. This option is for video only. For the syntax of this
  16647. option, check the
  16648. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16649. Default and minimum resolution is @code{640x480}.
  16650. @item meter
  16651. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  16652. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  16653. other integer value between this range is allowed.
  16654. @item metadata
  16655. Set metadata injection. If set to @code{1}, the audio input will be segmented
  16656. into 100ms output frames, each of them containing various loudness information
  16657. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  16658. Default is @code{0}.
  16659. @item framelog
  16660. Force the frame logging level.
  16661. Available values are:
  16662. @table @samp
  16663. @item info
  16664. information logging level
  16665. @item verbose
  16666. verbose logging level
  16667. @end table
  16668. By default, the logging level is set to @var{info}. If the @option{video} or
  16669. the @option{metadata} options are set, it switches to @var{verbose}.
  16670. @item peak
  16671. Set peak mode(s).
  16672. Available modes can be cumulated (the option is a @code{flag} type). Possible
  16673. values are:
  16674. @table @samp
  16675. @item none
  16676. Disable any peak mode (default).
  16677. @item sample
  16678. Enable sample-peak mode.
  16679. Simple peak mode looking for the higher sample value. It logs a message
  16680. for sample-peak (identified by @code{SPK}).
  16681. @item true
  16682. Enable true-peak mode.
  16683. If enabled, the peak lookup is done on an over-sampled version of the input
  16684. stream for better peak accuracy. It logs a message for true-peak.
  16685. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  16686. This mode requires a build with @code{libswresample}.
  16687. @end table
  16688. @item dualmono
  16689. Treat mono input files as "dual mono". If a mono file is intended for playback
  16690. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  16691. If set to @code{true}, this option will compensate for this effect.
  16692. Multi-channel input files are not affected by this option.
  16693. @item panlaw
  16694. Set a specific pan law to be used for the measurement of dual mono files.
  16695. This parameter is optional, and has a default value of -3.01dB.
  16696. @item target
  16697. Set a specific target level (in LUFS) used as relative zero in the visualization.
  16698. This parameter is optional and has a default value of -23LUFS as specified
  16699. by EBU R128. However, material published online may prefer a level of -16LUFS
  16700. (e.g. for use with podcasts or video platforms).
  16701. @item gauge
  16702. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  16703. @code{shortterm}. By default the momentary value will be used, but in certain
  16704. scenarios it may be more useful to observe the short term value instead (e.g.
  16705. live mixing).
  16706. @item scale
  16707. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  16708. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  16709. video output, not the summary or continuous log output.
  16710. @end table
  16711. @subsection Examples
  16712. @itemize
  16713. @item
  16714. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  16715. @example
  16716. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  16717. @end example
  16718. @item
  16719. Run an analysis with @command{ffmpeg}:
  16720. @example
  16721. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  16722. @end example
  16723. @end itemize
  16724. @section interleave, ainterleave
  16725. Temporally interleave frames from several inputs.
  16726. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  16727. These filters read frames from several inputs and send the oldest
  16728. queued frame to the output.
  16729. Input streams must have well defined, monotonically increasing frame
  16730. timestamp values.
  16731. In order to submit one frame to output, these filters need to enqueue
  16732. at least one frame for each input, so they cannot work in case one
  16733. input is not yet terminated and will not receive incoming frames.
  16734. For example consider the case when one input is a @code{select} filter
  16735. which always drops input frames. The @code{interleave} filter will keep
  16736. reading from that input, but it will never be able to send new frames
  16737. to output until the input sends an end-of-stream signal.
  16738. Also, depending on inputs synchronization, the filters will drop
  16739. frames in case one input receives more frames than the other ones, and
  16740. the queue is already filled.
  16741. These filters accept the following options:
  16742. @table @option
  16743. @item nb_inputs, n
  16744. Set the number of different inputs, it is 2 by default.
  16745. @end table
  16746. @subsection Examples
  16747. @itemize
  16748. @item
  16749. Interleave frames belonging to different streams using @command{ffmpeg}:
  16750. @example
  16751. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  16752. @end example
  16753. @item
  16754. Add flickering blur effect:
  16755. @example
  16756. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  16757. @end example
  16758. @end itemize
  16759. @section metadata, ametadata
  16760. Manipulate frame metadata.
  16761. This filter accepts the following options:
  16762. @table @option
  16763. @item mode
  16764. Set mode of operation of the filter.
  16765. Can be one of the following:
  16766. @table @samp
  16767. @item select
  16768. If both @code{value} and @code{key} is set, select frames
  16769. which have such metadata. If only @code{key} is set, select
  16770. every frame that has such key in metadata.
  16771. @item add
  16772. Add new metadata @code{key} and @code{value}. If key is already available
  16773. do nothing.
  16774. @item modify
  16775. Modify value of already present key.
  16776. @item delete
  16777. If @code{value} is set, delete only keys that have such value.
  16778. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  16779. the frame.
  16780. @item print
  16781. Print key and its value if metadata was found. If @code{key} is not set print all
  16782. metadata values available in frame.
  16783. @end table
  16784. @item key
  16785. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  16786. @item value
  16787. Set metadata value which will be used. This option is mandatory for
  16788. @code{modify} and @code{add} mode.
  16789. @item function
  16790. Which function to use when comparing metadata value and @code{value}.
  16791. Can be one of following:
  16792. @table @samp
  16793. @item same_str
  16794. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  16795. @item starts_with
  16796. Values are interpreted as strings, returns true if metadata value starts with
  16797. the @code{value} option string.
  16798. @item less
  16799. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  16800. @item equal
  16801. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  16802. @item greater
  16803. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  16804. @item expr
  16805. Values are interpreted as floats, returns true if expression from option @code{expr}
  16806. evaluates to true.
  16807. @item ends_with
  16808. Values are interpreted as strings, returns true if metadata value ends with
  16809. the @code{value} option string.
  16810. @end table
  16811. @item expr
  16812. Set expression which is used when @code{function} is set to @code{expr}.
  16813. The expression is evaluated through the eval API and can contain the following
  16814. constants:
  16815. @table @option
  16816. @item VALUE1
  16817. Float representation of @code{value} from metadata key.
  16818. @item VALUE2
  16819. Float representation of @code{value} as supplied by user in @code{value} option.
  16820. @end table
  16821. @item file
  16822. If specified in @code{print} mode, output is written to the named file. Instead of
  16823. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  16824. for standard output. If @code{file} option is not set, output is written to the log
  16825. with AV_LOG_INFO loglevel.
  16826. @end table
  16827. @subsection Examples
  16828. @itemize
  16829. @item
  16830. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  16831. between 0 and 1.
  16832. @example
  16833. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  16834. @end example
  16835. @item
  16836. Print silencedetect output to file @file{metadata.txt}.
  16837. @example
  16838. silencedetect,ametadata=mode=print:file=metadata.txt
  16839. @end example
  16840. @item
  16841. Direct all metadata to a pipe with file descriptor 4.
  16842. @example
  16843. metadata=mode=print:file='pipe\:4'
  16844. @end example
  16845. @end itemize
  16846. @section perms, aperms
  16847. Set read/write permissions for the output frames.
  16848. These filters are mainly aimed at developers to test direct path in the
  16849. following filter in the filtergraph.
  16850. The filters accept the following options:
  16851. @table @option
  16852. @item mode
  16853. Select the permissions mode.
  16854. It accepts the following values:
  16855. @table @samp
  16856. @item none
  16857. Do nothing. This is the default.
  16858. @item ro
  16859. Set all the output frames read-only.
  16860. @item rw
  16861. Set all the output frames directly writable.
  16862. @item toggle
  16863. Make the frame read-only if writable, and writable if read-only.
  16864. @item random
  16865. Set each output frame read-only or writable randomly.
  16866. @end table
  16867. @item seed
  16868. Set the seed for the @var{random} mode, must be an integer included between
  16869. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  16870. @code{-1}, the filter will try to use a good random seed on a best effort
  16871. basis.
  16872. @end table
  16873. Note: in case of auto-inserted filter between the permission filter and the
  16874. following one, the permission might not be received as expected in that
  16875. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  16876. perms/aperms filter can avoid this problem.
  16877. @section realtime, arealtime
  16878. Slow down filtering to match real time approximately.
  16879. These filters will pause the filtering for a variable amount of time to
  16880. match the output rate with the input timestamps.
  16881. They are similar to the @option{re} option to @code{ffmpeg}.
  16882. They accept the following options:
  16883. @table @option
  16884. @item limit
  16885. Time limit for the pauses. Any pause longer than that will be considered
  16886. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  16887. @item speed
  16888. Speed factor for processing. The value must be a float larger than zero.
  16889. Values larger than 1.0 will result in faster than realtime processing,
  16890. smaller will slow processing down. The @var{limit} is automatically adapted
  16891. accordingly. Default is 1.0.
  16892. A processing speed faster than what is possible without these filters cannot
  16893. be achieved.
  16894. @end table
  16895. @anchor{select}
  16896. @section select, aselect
  16897. Select frames to pass in output.
  16898. This filter accepts the following options:
  16899. @table @option
  16900. @item expr, e
  16901. Set expression, which is evaluated for each input frame.
  16902. If the expression is evaluated to zero, the frame is discarded.
  16903. If the evaluation result is negative or NaN, the frame is sent to the
  16904. first output; otherwise it is sent to the output with index
  16905. @code{ceil(val)-1}, assuming that the input index starts from 0.
  16906. For example a value of @code{1.2} corresponds to the output with index
  16907. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  16908. @item outputs, n
  16909. Set the number of outputs. The output to which to send the selected
  16910. frame is based on the result of the evaluation. Default value is 1.
  16911. @end table
  16912. The expression can contain the following constants:
  16913. @table @option
  16914. @item n
  16915. The (sequential) number of the filtered frame, starting from 0.
  16916. @item selected_n
  16917. The (sequential) number of the selected frame, starting from 0.
  16918. @item prev_selected_n
  16919. The sequential number of the last selected frame. It's NAN if undefined.
  16920. @item TB
  16921. The timebase of the input timestamps.
  16922. @item pts
  16923. The PTS (Presentation TimeStamp) of the filtered video frame,
  16924. expressed in @var{TB} units. It's NAN if undefined.
  16925. @item t
  16926. The PTS of the filtered video frame,
  16927. expressed in seconds. It's NAN if undefined.
  16928. @item prev_pts
  16929. The PTS of the previously filtered video frame. It's NAN if undefined.
  16930. @item prev_selected_pts
  16931. The PTS of the last previously filtered video frame. It's NAN if undefined.
  16932. @item prev_selected_t
  16933. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  16934. @item start_pts
  16935. The PTS of the first video frame in the video. It's NAN if undefined.
  16936. @item start_t
  16937. The time of the first video frame in the video. It's NAN if undefined.
  16938. @item pict_type @emph{(video only)}
  16939. The type of the filtered frame. It can assume one of the following
  16940. values:
  16941. @table @option
  16942. @item I
  16943. @item P
  16944. @item B
  16945. @item S
  16946. @item SI
  16947. @item SP
  16948. @item BI
  16949. @end table
  16950. @item interlace_type @emph{(video only)}
  16951. The frame interlace type. It can assume one of the following values:
  16952. @table @option
  16953. @item PROGRESSIVE
  16954. The frame is progressive (not interlaced).
  16955. @item TOPFIRST
  16956. The frame is top-field-first.
  16957. @item BOTTOMFIRST
  16958. The frame is bottom-field-first.
  16959. @end table
  16960. @item consumed_sample_n @emph{(audio only)}
  16961. the number of selected samples before the current frame
  16962. @item samples_n @emph{(audio only)}
  16963. the number of samples in the current frame
  16964. @item sample_rate @emph{(audio only)}
  16965. the input sample rate
  16966. @item key
  16967. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  16968. @item pos
  16969. the position in the file of the filtered frame, -1 if the information
  16970. is not available (e.g. for synthetic video)
  16971. @item scene @emph{(video only)}
  16972. value between 0 and 1 to indicate a new scene; a low value reflects a low
  16973. probability for the current frame to introduce a new scene, while a higher
  16974. value means the current frame is more likely to be one (see the example below)
  16975. @item concatdec_select
  16976. The concat demuxer can select only part of a concat input file by setting an
  16977. inpoint and an outpoint, but the output packets may not be entirely contained
  16978. in the selected interval. By using this variable, it is possible to skip frames
  16979. generated by the concat demuxer which are not exactly contained in the selected
  16980. interval.
  16981. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  16982. and the @var{lavf.concat.duration} packet metadata values which are also
  16983. present in the decoded frames.
  16984. The @var{concatdec_select} variable is -1 if the frame pts is at least
  16985. start_time and either the duration metadata is missing or the frame pts is less
  16986. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  16987. missing.
  16988. That basically means that an input frame is selected if its pts is within the
  16989. interval set by the concat demuxer.
  16990. @end table
  16991. The default value of the select expression is "1".
  16992. @subsection Examples
  16993. @itemize
  16994. @item
  16995. Select all frames in input:
  16996. @example
  16997. select
  16998. @end example
  16999. The example above is the same as:
  17000. @example
  17001. select=1
  17002. @end example
  17003. @item
  17004. Skip all frames:
  17005. @example
  17006. select=0
  17007. @end example
  17008. @item
  17009. Select only I-frames:
  17010. @example
  17011. select='eq(pict_type\,I)'
  17012. @end example
  17013. @item
  17014. Select one frame every 100:
  17015. @example
  17016. select='not(mod(n\,100))'
  17017. @end example
  17018. @item
  17019. Select only frames contained in the 10-20 time interval:
  17020. @example
  17021. select=between(t\,10\,20)
  17022. @end example
  17023. @item
  17024. Select only I-frames contained in the 10-20 time interval:
  17025. @example
  17026. select=between(t\,10\,20)*eq(pict_type\,I)
  17027. @end example
  17028. @item
  17029. Select frames with a minimum distance of 10 seconds:
  17030. @example
  17031. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  17032. @end example
  17033. @item
  17034. Use aselect to select only audio frames with samples number > 100:
  17035. @example
  17036. aselect='gt(samples_n\,100)'
  17037. @end example
  17038. @item
  17039. Create a mosaic of the first scenes:
  17040. @example
  17041. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  17042. @end example
  17043. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  17044. choice.
  17045. @item
  17046. Send even and odd frames to separate outputs, and compose them:
  17047. @example
  17048. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  17049. @end example
  17050. @item
  17051. Select useful frames from an ffconcat file which is using inpoints and
  17052. outpoints but where the source files are not intra frame only.
  17053. @example
  17054. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  17055. @end example
  17056. @end itemize
  17057. @section sendcmd, asendcmd
  17058. Send commands to filters in the filtergraph.
  17059. These filters read commands to be sent to other filters in the
  17060. filtergraph.
  17061. @code{sendcmd} must be inserted between two video filters,
  17062. @code{asendcmd} must be inserted between two audio filters, but apart
  17063. from that they act the same way.
  17064. The specification of commands can be provided in the filter arguments
  17065. with the @var{commands} option, or in a file specified by the
  17066. @var{filename} option.
  17067. These filters accept the following options:
  17068. @table @option
  17069. @item commands, c
  17070. Set the commands to be read and sent to the other filters.
  17071. @item filename, f
  17072. Set the filename of the commands to be read and sent to the other
  17073. filters.
  17074. @end table
  17075. @subsection Commands syntax
  17076. A commands description consists of a sequence of interval
  17077. specifications, comprising a list of commands to be executed when a
  17078. particular event related to that interval occurs. The occurring event
  17079. is typically the current frame time entering or leaving a given time
  17080. interval.
  17081. An interval is specified by the following syntax:
  17082. @example
  17083. @var{START}[-@var{END}] @var{COMMANDS};
  17084. @end example
  17085. The time interval is specified by the @var{START} and @var{END} times.
  17086. @var{END} is optional and defaults to the maximum time.
  17087. The current frame time is considered within the specified interval if
  17088. it is included in the interval [@var{START}, @var{END}), that is when
  17089. the time is greater or equal to @var{START} and is lesser than
  17090. @var{END}.
  17091. @var{COMMANDS} consists of a sequence of one or more command
  17092. specifications, separated by ",", relating to that interval. The
  17093. syntax of a command specification is given by:
  17094. @example
  17095. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  17096. @end example
  17097. @var{FLAGS} is optional and specifies the type of events relating to
  17098. the time interval which enable sending the specified command, and must
  17099. be a non-null sequence of identifier flags separated by "+" or "|" and
  17100. enclosed between "[" and "]".
  17101. The following flags are recognized:
  17102. @table @option
  17103. @item enter
  17104. The command is sent when the current frame timestamp enters the
  17105. specified interval. In other words, the command is sent when the
  17106. previous frame timestamp was not in the given interval, and the
  17107. current is.
  17108. @item leave
  17109. The command is sent when the current frame timestamp leaves the
  17110. specified interval. In other words, the command is sent when the
  17111. previous frame timestamp was in the given interval, and the
  17112. current is not.
  17113. @end table
  17114. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  17115. assumed.
  17116. @var{TARGET} specifies the target of the command, usually the name of
  17117. the filter class or a specific filter instance name.
  17118. @var{COMMAND} specifies the name of the command for the target filter.
  17119. @var{ARG} is optional and specifies the optional list of argument for
  17120. the given @var{COMMAND}.
  17121. Between one interval specification and another, whitespaces, or
  17122. sequences of characters starting with @code{#} until the end of line,
  17123. are ignored and can be used to annotate comments.
  17124. A simplified BNF description of the commands specification syntax
  17125. follows:
  17126. @example
  17127. @var{COMMAND_FLAG} ::= "enter" | "leave"
  17128. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  17129. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  17130. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  17131. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  17132. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  17133. @end example
  17134. @subsection Examples
  17135. @itemize
  17136. @item
  17137. Specify audio tempo change at second 4:
  17138. @example
  17139. asendcmd=c='4.0 atempo tempo 1.5',atempo
  17140. @end example
  17141. @item
  17142. Target a specific filter instance:
  17143. @example
  17144. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  17145. @end example
  17146. @item
  17147. Specify a list of drawtext and hue commands in a file.
  17148. @example
  17149. # show text in the interval 5-10
  17150. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  17151. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  17152. # desaturate the image in the interval 15-20
  17153. 15.0-20.0 [enter] hue s 0,
  17154. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  17155. [leave] hue s 1,
  17156. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  17157. # apply an exponential saturation fade-out effect, starting from time 25
  17158. 25 [enter] hue s exp(25-t)
  17159. @end example
  17160. A filtergraph allowing to read and process the above command list
  17161. stored in a file @file{test.cmd}, can be specified with:
  17162. @example
  17163. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  17164. @end example
  17165. @end itemize
  17166. @anchor{setpts}
  17167. @section setpts, asetpts
  17168. Change the PTS (presentation timestamp) of the input frames.
  17169. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  17170. This filter accepts the following options:
  17171. @table @option
  17172. @item expr
  17173. The expression which is evaluated for each frame to construct its timestamp.
  17174. @end table
  17175. The expression is evaluated through the eval API and can contain the following
  17176. constants:
  17177. @table @option
  17178. @item FRAME_RATE, FR
  17179. frame rate, only defined for constant frame-rate video
  17180. @item PTS
  17181. The presentation timestamp in input
  17182. @item N
  17183. The count of the input frame for video or the number of consumed samples,
  17184. not including the current frame for audio, starting from 0.
  17185. @item NB_CONSUMED_SAMPLES
  17186. The number of consumed samples, not including the current frame (only
  17187. audio)
  17188. @item NB_SAMPLES, S
  17189. The number of samples in the current frame (only audio)
  17190. @item SAMPLE_RATE, SR
  17191. The audio sample rate.
  17192. @item STARTPTS
  17193. The PTS of the first frame.
  17194. @item STARTT
  17195. the time in seconds of the first frame
  17196. @item INTERLACED
  17197. State whether the current frame is interlaced.
  17198. @item T
  17199. the time in seconds of the current frame
  17200. @item POS
  17201. original position in the file of the frame, or undefined if undefined
  17202. for the current frame
  17203. @item PREV_INPTS
  17204. The previous input PTS.
  17205. @item PREV_INT
  17206. previous input time in seconds
  17207. @item PREV_OUTPTS
  17208. The previous output PTS.
  17209. @item PREV_OUTT
  17210. previous output time in seconds
  17211. @item RTCTIME
  17212. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  17213. instead.
  17214. @item RTCSTART
  17215. The wallclock (RTC) time at the start of the movie in microseconds.
  17216. @item TB
  17217. The timebase of the input timestamps.
  17218. @end table
  17219. @subsection Examples
  17220. @itemize
  17221. @item
  17222. Start counting PTS from zero
  17223. @example
  17224. setpts=PTS-STARTPTS
  17225. @end example
  17226. @item
  17227. Apply fast motion effect:
  17228. @example
  17229. setpts=0.5*PTS
  17230. @end example
  17231. @item
  17232. Apply slow motion effect:
  17233. @example
  17234. setpts=2.0*PTS
  17235. @end example
  17236. @item
  17237. Set fixed rate of 25 frames per second:
  17238. @example
  17239. setpts=N/(25*TB)
  17240. @end example
  17241. @item
  17242. Set fixed rate 25 fps with some jitter:
  17243. @example
  17244. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  17245. @end example
  17246. @item
  17247. Apply an offset of 10 seconds to the input PTS:
  17248. @example
  17249. setpts=PTS+10/TB
  17250. @end example
  17251. @item
  17252. Generate timestamps from a "live source" and rebase onto the current timebase:
  17253. @example
  17254. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  17255. @end example
  17256. @item
  17257. Generate timestamps by counting samples:
  17258. @example
  17259. asetpts=N/SR/TB
  17260. @end example
  17261. @end itemize
  17262. @section setrange
  17263. Force color range for the output video frame.
  17264. The @code{setrange} filter marks the color range property for the
  17265. output frames. It does not change the input frame, but only sets the
  17266. corresponding property, which affects how the frame is treated by
  17267. following filters.
  17268. The filter accepts the following options:
  17269. @table @option
  17270. @item range
  17271. Available values are:
  17272. @table @samp
  17273. @item auto
  17274. Keep the same color range property.
  17275. @item unspecified, unknown
  17276. Set the color range as unspecified.
  17277. @item limited, tv, mpeg
  17278. Set the color range as limited.
  17279. @item full, pc, jpeg
  17280. Set the color range as full.
  17281. @end table
  17282. @end table
  17283. @section settb, asettb
  17284. Set the timebase to use for the output frames timestamps.
  17285. It is mainly useful for testing timebase configuration.
  17286. It accepts the following parameters:
  17287. @table @option
  17288. @item expr, tb
  17289. The expression which is evaluated into the output timebase.
  17290. @end table
  17291. The value for @option{tb} is an arithmetic expression representing a
  17292. rational. The expression can contain the constants "AVTB" (the default
  17293. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  17294. audio only). Default value is "intb".
  17295. @subsection Examples
  17296. @itemize
  17297. @item
  17298. Set the timebase to 1/25:
  17299. @example
  17300. settb=expr=1/25
  17301. @end example
  17302. @item
  17303. Set the timebase to 1/10:
  17304. @example
  17305. settb=expr=0.1
  17306. @end example
  17307. @item
  17308. Set the timebase to 1001/1000:
  17309. @example
  17310. settb=1+0.001
  17311. @end example
  17312. @item
  17313. Set the timebase to 2*intb:
  17314. @example
  17315. settb=2*intb
  17316. @end example
  17317. @item
  17318. Set the default timebase value:
  17319. @example
  17320. settb=AVTB
  17321. @end example
  17322. @end itemize
  17323. @section showcqt
  17324. Convert input audio to a video output representing frequency spectrum
  17325. logarithmically using Brown-Puckette constant Q transform algorithm with
  17326. direct frequency domain coefficient calculation (but the transform itself
  17327. is not really constant Q, instead the Q factor is actually variable/clamped),
  17328. with musical tone scale, from E0 to D#10.
  17329. The filter accepts the following options:
  17330. @table @option
  17331. @item size, s
  17332. Specify the video size for the output. It must be even. For the syntax of this option,
  17333. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17334. Default value is @code{1920x1080}.
  17335. @item fps, rate, r
  17336. Set the output frame rate. Default value is @code{25}.
  17337. @item bar_h
  17338. Set the bargraph height. It must be even. Default value is @code{-1} which
  17339. computes the bargraph height automatically.
  17340. @item axis_h
  17341. Set the axis height. It must be even. Default value is @code{-1} which computes
  17342. the axis height automatically.
  17343. @item sono_h
  17344. Set the sonogram height. It must be even. Default value is @code{-1} which
  17345. computes the sonogram height automatically.
  17346. @item fullhd
  17347. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  17348. instead. Default value is @code{1}.
  17349. @item sono_v, volume
  17350. Specify the sonogram volume expression. It can contain variables:
  17351. @table @option
  17352. @item bar_v
  17353. the @var{bar_v} evaluated expression
  17354. @item frequency, freq, f
  17355. the frequency where it is evaluated
  17356. @item timeclamp, tc
  17357. the value of @var{timeclamp} option
  17358. @end table
  17359. and functions:
  17360. @table @option
  17361. @item a_weighting(f)
  17362. A-weighting of equal loudness
  17363. @item b_weighting(f)
  17364. B-weighting of equal loudness
  17365. @item c_weighting(f)
  17366. C-weighting of equal loudness.
  17367. @end table
  17368. Default value is @code{16}.
  17369. @item bar_v, volume2
  17370. Specify the bargraph volume expression. It can contain variables:
  17371. @table @option
  17372. @item sono_v
  17373. the @var{sono_v} evaluated expression
  17374. @item frequency, freq, f
  17375. the frequency where it is evaluated
  17376. @item timeclamp, tc
  17377. the value of @var{timeclamp} option
  17378. @end table
  17379. and functions:
  17380. @table @option
  17381. @item a_weighting(f)
  17382. A-weighting of equal loudness
  17383. @item b_weighting(f)
  17384. B-weighting of equal loudness
  17385. @item c_weighting(f)
  17386. C-weighting of equal loudness.
  17387. @end table
  17388. Default value is @code{sono_v}.
  17389. @item sono_g, gamma
  17390. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  17391. higher gamma makes the spectrum having more range. Default value is @code{3}.
  17392. Acceptable range is @code{[1, 7]}.
  17393. @item bar_g, gamma2
  17394. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  17395. @code{[1, 7]}.
  17396. @item bar_t
  17397. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  17398. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  17399. @item timeclamp, tc
  17400. Specify the transform timeclamp. At low frequency, there is trade-off between
  17401. accuracy in time domain and frequency domain. If timeclamp is lower,
  17402. event in time domain is represented more accurately (such as fast bass drum),
  17403. otherwise event in frequency domain is represented more accurately
  17404. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  17405. @item attack
  17406. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  17407. limits future samples by applying asymmetric windowing in time domain, useful
  17408. when low latency is required. Accepted range is @code{[0, 1]}.
  17409. @item basefreq
  17410. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  17411. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  17412. @item endfreq
  17413. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  17414. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  17415. @item coeffclamp
  17416. This option is deprecated and ignored.
  17417. @item tlength
  17418. Specify the transform length in time domain. Use this option to control accuracy
  17419. trade-off between time domain and frequency domain at every frequency sample.
  17420. It can contain variables:
  17421. @table @option
  17422. @item frequency, freq, f
  17423. the frequency where it is evaluated
  17424. @item timeclamp, tc
  17425. the value of @var{timeclamp} option.
  17426. @end table
  17427. Default value is @code{384*tc/(384+tc*f)}.
  17428. @item count
  17429. Specify the transform count for every video frame. Default value is @code{6}.
  17430. Acceptable range is @code{[1, 30]}.
  17431. @item fcount
  17432. Specify the transform count for every single pixel. Default value is @code{0},
  17433. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  17434. @item fontfile
  17435. Specify font file for use with freetype to draw the axis. If not specified,
  17436. use embedded font. Note that drawing with font file or embedded font is not
  17437. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  17438. option instead.
  17439. @item font
  17440. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  17441. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  17442. escaping.
  17443. @item fontcolor
  17444. Specify font color expression. This is arithmetic expression that should return
  17445. integer value 0xRRGGBB. It can contain variables:
  17446. @table @option
  17447. @item frequency, freq, f
  17448. the frequency where it is evaluated
  17449. @item timeclamp, tc
  17450. the value of @var{timeclamp} option
  17451. @end table
  17452. and functions:
  17453. @table @option
  17454. @item midi(f)
  17455. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  17456. @item r(x), g(x), b(x)
  17457. red, green, and blue value of intensity x.
  17458. @end table
  17459. Default value is @code{st(0, (midi(f)-59.5)/12);
  17460. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  17461. r(1-ld(1)) + b(ld(1))}.
  17462. @item axisfile
  17463. Specify image file to draw the axis. This option override @var{fontfile} and
  17464. @var{fontcolor} option.
  17465. @item axis, text
  17466. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  17467. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  17468. Default value is @code{1}.
  17469. @item csp
  17470. Set colorspace. The accepted values are:
  17471. @table @samp
  17472. @item unspecified
  17473. Unspecified (default)
  17474. @item bt709
  17475. BT.709
  17476. @item fcc
  17477. FCC
  17478. @item bt470bg
  17479. BT.470BG or BT.601-6 625
  17480. @item smpte170m
  17481. SMPTE-170M or BT.601-6 525
  17482. @item smpte240m
  17483. SMPTE-240M
  17484. @item bt2020ncl
  17485. BT.2020 with non-constant luminance
  17486. @end table
  17487. @item cscheme
  17488. Set spectrogram color scheme. This is list of floating point values with format
  17489. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  17490. The default is @code{1|0.5|0|0|0.5|1}.
  17491. @end table
  17492. @subsection Examples
  17493. @itemize
  17494. @item
  17495. Playing audio while showing the spectrum:
  17496. @example
  17497. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  17498. @end example
  17499. @item
  17500. Same as above, but with frame rate 30 fps:
  17501. @example
  17502. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  17503. @end example
  17504. @item
  17505. Playing at 1280x720:
  17506. @example
  17507. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  17508. @end example
  17509. @item
  17510. Disable sonogram display:
  17511. @example
  17512. sono_h=0
  17513. @end example
  17514. @item
  17515. A1 and its harmonics: A1, A2, (near)E3, A3:
  17516. @example
  17517. 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),
  17518. asplit[a][out1]; [a] showcqt [out0]'
  17519. @end example
  17520. @item
  17521. Same as above, but with more accuracy in frequency domain:
  17522. @example
  17523. 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),
  17524. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  17525. @end example
  17526. @item
  17527. Custom volume:
  17528. @example
  17529. bar_v=10:sono_v=bar_v*a_weighting(f)
  17530. @end example
  17531. @item
  17532. Custom gamma, now spectrum is linear to the amplitude.
  17533. @example
  17534. bar_g=2:sono_g=2
  17535. @end example
  17536. @item
  17537. Custom tlength equation:
  17538. @example
  17539. 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)))'
  17540. @end example
  17541. @item
  17542. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  17543. @example
  17544. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  17545. @end example
  17546. @item
  17547. Custom font using fontconfig:
  17548. @example
  17549. font='Courier New,Monospace,mono|bold'
  17550. @end example
  17551. @item
  17552. Custom frequency range with custom axis using image file:
  17553. @example
  17554. axisfile=myaxis.png:basefreq=40:endfreq=10000
  17555. @end example
  17556. @end itemize
  17557. @section showfreqs
  17558. Convert input audio to video output representing the audio power spectrum.
  17559. Audio amplitude is on Y-axis while frequency is on X-axis.
  17560. The filter accepts the following options:
  17561. @table @option
  17562. @item size, s
  17563. Specify size of video. For the syntax of this option, check the
  17564. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17565. Default is @code{1024x512}.
  17566. @item mode
  17567. Set display mode.
  17568. This set how each frequency bin will be represented.
  17569. It accepts the following values:
  17570. @table @samp
  17571. @item line
  17572. @item bar
  17573. @item dot
  17574. @end table
  17575. Default is @code{bar}.
  17576. @item ascale
  17577. Set amplitude scale.
  17578. It accepts the following values:
  17579. @table @samp
  17580. @item lin
  17581. Linear scale.
  17582. @item sqrt
  17583. Square root scale.
  17584. @item cbrt
  17585. Cubic root scale.
  17586. @item log
  17587. Logarithmic scale.
  17588. @end table
  17589. Default is @code{log}.
  17590. @item fscale
  17591. Set frequency scale.
  17592. It accepts the following values:
  17593. @table @samp
  17594. @item lin
  17595. Linear scale.
  17596. @item log
  17597. Logarithmic scale.
  17598. @item rlog
  17599. Reverse logarithmic scale.
  17600. @end table
  17601. Default is @code{lin}.
  17602. @item win_size
  17603. Set window size. Allowed range is from 16 to 65536.
  17604. Default is @code{2048}
  17605. @item win_func
  17606. Set windowing function.
  17607. It accepts the following values:
  17608. @table @samp
  17609. @item rect
  17610. @item bartlett
  17611. @item hanning
  17612. @item hamming
  17613. @item blackman
  17614. @item welch
  17615. @item flattop
  17616. @item bharris
  17617. @item bnuttall
  17618. @item bhann
  17619. @item sine
  17620. @item nuttall
  17621. @item lanczos
  17622. @item gauss
  17623. @item tukey
  17624. @item dolph
  17625. @item cauchy
  17626. @item parzen
  17627. @item poisson
  17628. @item bohman
  17629. @end table
  17630. Default is @code{hanning}.
  17631. @item overlap
  17632. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17633. which means optimal overlap for selected window function will be picked.
  17634. @item averaging
  17635. Set time averaging. Setting this to 0 will display current maximal peaks.
  17636. Default is @code{1}, which means time averaging is disabled.
  17637. @item colors
  17638. Specify list of colors separated by space or by '|' which will be used to
  17639. draw channel frequencies. Unrecognized or missing colors will be replaced
  17640. by white color.
  17641. @item cmode
  17642. Set channel display mode.
  17643. It accepts the following values:
  17644. @table @samp
  17645. @item combined
  17646. @item separate
  17647. @end table
  17648. Default is @code{combined}.
  17649. @item minamp
  17650. Set minimum amplitude used in @code{log} amplitude scaler.
  17651. @end table
  17652. @section showspatial
  17653. Convert stereo input audio to a video output, representing the spatial relationship
  17654. between two channels.
  17655. The filter accepts the following options:
  17656. @table @option
  17657. @item size, s
  17658. Specify the video size for the output. For the syntax of this option, check the
  17659. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17660. Default value is @code{512x512}.
  17661. @item win_size
  17662. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  17663. @item win_func
  17664. Set window function.
  17665. It accepts the following values:
  17666. @table @samp
  17667. @item rect
  17668. @item bartlett
  17669. @item hann
  17670. @item hanning
  17671. @item hamming
  17672. @item blackman
  17673. @item welch
  17674. @item flattop
  17675. @item bharris
  17676. @item bnuttall
  17677. @item bhann
  17678. @item sine
  17679. @item nuttall
  17680. @item lanczos
  17681. @item gauss
  17682. @item tukey
  17683. @item dolph
  17684. @item cauchy
  17685. @item parzen
  17686. @item poisson
  17687. @item bohman
  17688. @end table
  17689. Default value is @code{hann}.
  17690. @item overlap
  17691. Set ratio of overlap window. Default value is @code{0.5}.
  17692. When value is @code{1} overlap is set to recommended size for specific
  17693. window function currently used.
  17694. @end table
  17695. @anchor{showspectrum}
  17696. @section showspectrum
  17697. Convert input audio to a video output, representing the audio frequency
  17698. spectrum.
  17699. The filter accepts the following options:
  17700. @table @option
  17701. @item size, s
  17702. Specify the video size for the output. For the syntax of this option, check the
  17703. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17704. Default value is @code{640x512}.
  17705. @item slide
  17706. Specify how the spectrum should slide along the window.
  17707. It accepts the following values:
  17708. @table @samp
  17709. @item replace
  17710. the samples start again on the left when they reach the right
  17711. @item scroll
  17712. the samples scroll from right to left
  17713. @item fullframe
  17714. frames are only produced when the samples reach the right
  17715. @item rscroll
  17716. the samples scroll from left to right
  17717. @end table
  17718. Default value is @code{replace}.
  17719. @item mode
  17720. Specify display mode.
  17721. It accepts the following values:
  17722. @table @samp
  17723. @item combined
  17724. all channels are displayed in the same row
  17725. @item separate
  17726. all channels are displayed in separate rows
  17727. @end table
  17728. Default value is @samp{combined}.
  17729. @item color
  17730. Specify display color mode.
  17731. It accepts the following values:
  17732. @table @samp
  17733. @item channel
  17734. each channel is displayed in a separate color
  17735. @item intensity
  17736. each channel is displayed using the same color scheme
  17737. @item rainbow
  17738. each channel is displayed using the rainbow color scheme
  17739. @item moreland
  17740. each channel is displayed using the moreland color scheme
  17741. @item nebulae
  17742. each channel is displayed using the nebulae color scheme
  17743. @item fire
  17744. each channel is displayed using the fire color scheme
  17745. @item fiery
  17746. each channel is displayed using the fiery color scheme
  17747. @item fruit
  17748. each channel is displayed using the fruit color scheme
  17749. @item cool
  17750. each channel is displayed using the cool color scheme
  17751. @item magma
  17752. each channel is displayed using the magma color scheme
  17753. @item green
  17754. each channel is displayed using the green color scheme
  17755. @item viridis
  17756. each channel is displayed using the viridis color scheme
  17757. @item plasma
  17758. each channel is displayed using the plasma color scheme
  17759. @item cividis
  17760. each channel is displayed using the cividis color scheme
  17761. @item terrain
  17762. each channel is displayed using the terrain color scheme
  17763. @end table
  17764. Default value is @samp{channel}.
  17765. @item scale
  17766. Specify scale used for calculating intensity color values.
  17767. It accepts the following values:
  17768. @table @samp
  17769. @item lin
  17770. linear
  17771. @item sqrt
  17772. square root, default
  17773. @item cbrt
  17774. cubic root
  17775. @item log
  17776. logarithmic
  17777. @item 4thrt
  17778. 4th root
  17779. @item 5thrt
  17780. 5th root
  17781. @end table
  17782. Default value is @samp{sqrt}.
  17783. @item fscale
  17784. Specify frequency scale.
  17785. It accepts the following values:
  17786. @table @samp
  17787. @item lin
  17788. linear
  17789. @item log
  17790. logarithmic
  17791. @end table
  17792. Default value is @samp{lin}.
  17793. @item saturation
  17794. Set saturation modifier for displayed colors. Negative values provide
  17795. alternative color scheme. @code{0} is no saturation at all.
  17796. Saturation must be in [-10.0, 10.0] range.
  17797. Default value is @code{1}.
  17798. @item win_func
  17799. Set window function.
  17800. It accepts the following values:
  17801. @table @samp
  17802. @item rect
  17803. @item bartlett
  17804. @item hann
  17805. @item hanning
  17806. @item hamming
  17807. @item blackman
  17808. @item welch
  17809. @item flattop
  17810. @item bharris
  17811. @item bnuttall
  17812. @item bhann
  17813. @item sine
  17814. @item nuttall
  17815. @item lanczos
  17816. @item gauss
  17817. @item tukey
  17818. @item dolph
  17819. @item cauchy
  17820. @item parzen
  17821. @item poisson
  17822. @item bohman
  17823. @end table
  17824. Default value is @code{hann}.
  17825. @item orientation
  17826. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17827. @code{horizontal}. Default is @code{vertical}.
  17828. @item overlap
  17829. Set ratio of overlap window. Default value is @code{0}.
  17830. When value is @code{1} overlap is set to recommended size for specific
  17831. window function currently used.
  17832. @item gain
  17833. Set scale gain for calculating intensity color values.
  17834. Default value is @code{1}.
  17835. @item data
  17836. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  17837. @item rotation
  17838. Set color rotation, must be in [-1.0, 1.0] range.
  17839. Default value is @code{0}.
  17840. @item start
  17841. Set start frequency from which to display spectrogram. Default is @code{0}.
  17842. @item stop
  17843. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17844. @item fps
  17845. Set upper frame rate limit. Default is @code{auto}, unlimited.
  17846. @item legend
  17847. Draw time and frequency axes and legends. Default is disabled.
  17848. @end table
  17849. The usage is very similar to the showwaves filter; see the examples in that
  17850. section.
  17851. @subsection Examples
  17852. @itemize
  17853. @item
  17854. Large window with logarithmic color scaling:
  17855. @example
  17856. showspectrum=s=1280x480:scale=log
  17857. @end example
  17858. @item
  17859. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  17860. @example
  17861. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17862. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  17863. @end example
  17864. @end itemize
  17865. @section showspectrumpic
  17866. Convert input audio to a single video frame, representing the audio frequency
  17867. spectrum.
  17868. The filter accepts the following options:
  17869. @table @option
  17870. @item size, s
  17871. Specify the video size for the output. For the syntax of this option, check the
  17872. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17873. Default value is @code{4096x2048}.
  17874. @item mode
  17875. Specify display mode.
  17876. It accepts the following values:
  17877. @table @samp
  17878. @item combined
  17879. all channels are displayed in the same row
  17880. @item separate
  17881. all channels are displayed in separate rows
  17882. @end table
  17883. Default value is @samp{combined}.
  17884. @item color
  17885. Specify display color mode.
  17886. It accepts the following values:
  17887. @table @samp
  17888. @item channel
  17889. each channel is displayed in a separate color
  17890. @item intensity
  17891. each channel is displayed using the same color scheme
  17892. @item rainbow
  17893. each channel is displayed using the rainbow color scheme
  17894. @item moreland
  17895. each channel is displayed using the moreland color scheme
  17896. @item nebulae
  17897. each channel is displayed using the nebulae color scheme
  17898. @item fire
  17899. each channel is displayed using the fire color scheme
  17900. @item fiery
  17901. each channel is displayed using the fiery color scheme
  17902. @item fruit
  17903. each channel is displayed using the fruit color scheme
  17904. @item cool
  17905. each channel is displayed using the cool color scheme
  17906. @item magma
  17907. each channel is displayed using the magma color scheme
  17908. @item green
  17909. each channel is displayed using the green color scheme
  17910. @item viridis
  17911. each channel is displayed using the viridis color scheme
  17912. @item plasma
  17913. each channel is displayed using the plasma color scheme
  17914. @item cividis
  17915. each channel is displayed using the cividis color scheme
  17916. @item terrain
  17917. each channel is displayed using the terrain color scheme
  17918. @end table
  17919. Default value is @samp{intensity}.
  17920. @item scale
  17921. Specify scale used for calculating intensity color values.
  17922. It accepts the following values:
  17923. @table @samp
  17924. @item lin
  17925. linear
  17926. @item sqrt
  17927. square root, default
  17928. @item cbrt
  17929. cubic root
  17930. @item log
  17931. logarithmic
  17932. @item 4thrt
  17933. 4th root
  17934. @item 5thrt
  17935. 5th root
  17936. @end table
  17937. Default value is @samp{log}.
  17938. @item fscale
  17939. Specify frequency scale.
  17940. It accepts the following values:
  17941. @table @samp
  17942. @item lin
  17943. linear
  17944. @item log
  17945. logarithmic
  17946. @end table
  17947. Default value is @samp{lin}.
  17948. @item saturation
  17949. Set saturation modifier for displayed colors. Negative values provide
  17950. alternative color scheme. @code{0} is no saturation at all.
  17951. Saturation must be in [-10.0, 10.0] range.
  17952. Default value is @code{1}.
  17953. @item win_func
  17954. Set window function.
  17955. It accepts the following values:
  17956. @table @samp
  17957. @item rect
  17958. @item bartlett
  17959. @item hann
  17960. @item hanning
  17961. @item hamming
  17962. @item blackman
  17963. @item welch
  17964. @item flattop
  17965. @item bharris
  17966. @item bnuttall
  17967. @item bhann
  17968. @item sine
  17969. @item nuttall
  17970. @item lanczos
  17971. @item gauss
  17972. @item tukey
  17973. @item dolph
  17974. @item cauchy
  17975. @item parzen
  17976. @item poisson
  17977. @item bohman
  17978. @end table
  17979. Default value is @code{hann}.
  17980. @item orientation
  17981. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17982. @code{horizontal}. Default is @code{vertical}.
  17983. @item gain
  17984. Set scale gain for calculating intensity color values.
  17985. Default value is @code{1}.
  17986. @item legend
  17987. Draw time and frequency axes and legends. Default is enabled.
  17988. @item rotation
  17989. Set color rotation, must be in [-1.0, 1.0] range.
  17990. Default value is @code{0}.
  17991. @item start
  17992. Set start frequency from which to display spectrogram. Default is @code{0}.
  17993. @item stop
  17994. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17995. @end table
  17996. @subsection Examples
  17997. @itemize
  17998. @item
  17999. Extract an audio spectrogram of a whole audio track
  18000. in a 1024x1024 picture using @command{ffmpeg}:
  18001. @example
  18002. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  18003. @end example
  18004. @end itemize
  18005. @section showvolume
  18006. Convert input audio volume to a video output.
  18007. The filter accepts the following options:
  18008. @table @option
  18009. @item rate, r
  18010. Set video rate.
  18011. @item b
  18012. Set border width, allowed range is [0, 5]. Default is 1.
  18013. @item w
  18014. Set channel width, allowed range is [80, 8192]. Default is 400.
  18015. @item h
  18016. Set channel height, allowed range is [1, 900]. Default is 20.
  18017. @item f
  18018. Set fade, allowed range is [0, 1]. Default is 0.95.
  18019. @item c
  18020. Set volume color expression.
  18021. The expression can use the following variables:
  18022. @table @option
  18023. @item VOLUME
  18024. Current max volume of channel in dB.
  18025. @item PEAK
  18026. Current peak.
  18027. @item CHANNEL
  18028. Current channel number, starting from 0.
  18029. @end table
  18030. @item t
  18031. If set, displays channel names. Default is enabled.
  18032. @item v
  18033. If set, displays volume values. Default is enabled.
  18034. @item o
  18035. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  18036. default is @code{h}.
  18037. @item s
  18038. Set step size, allowed range is [0, 5]. Default is 0, which means
  18039. step is disabled.
  18040. @item p
  18041. Set background opacity, allowed range is [0, 1]. Default is 0.
  18042. @item m
  18043. Set metering mode, can be peak: @code{p} or rms: @code{r},
  18044. default is @code{p}.
  18045. @item ds
  18046. Set display scale, can be linear: @code{lin} or log: @code{log},
  18047. default is @code{lin}.
  18048. @item dm
  18049. In second.
  18050. If set to > 0., display a line for the max level
  18051. in the previous seconds.
  18052. default is disabled: @code{0.}
  18053. @item dmc
  18054. The color of the max line. Use when @code{dm} option is set to > 0.
  18055. default is: @code{orange}
  18056. @end table
  18057. @section showwaves
  18058. Convert input audio to a video output, representing the samples waves.
  18059. The filter accepts the following options:
  18060. @table @option
  18061. @item size, s
  18062. Specify the video size for the output. For the syntax of this option, check the
  18063. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18064. Default value is @code{600x240}.
  18065. @item mode
  18066. Set display mode.
  18067. Available values are:
  18068. @table @samp
  18069. @item point
  18070. Draw a point for each sample.
  18071. @item line
  18072. Draw a vertical line for each sample.
  18073. @item p2p
  18074. Draw a point for each sample and a line between them.
  18075. @item cline
  18076. Draw a centered vertical line for each sample.
  18077. @end table
  18078. Default value is @code{point}.
  18079. @item n
  18080. Set the number of samples which are printed on the same column. A
  18081. larger value will decrease the frame rate. Must be a positive
  18082. integer. This option can be set only if the value for @var{rate}
  18083. is not explicitly specified.
  18084. @item rate, r
  18085. Set the (approximate) output frame rate. This is done by setting the
  18086. option @var{n}. Default value is "25".
  18087. @item split_channels
  18088. Set if channels should be drawn separately or overlap. Default value is 0.
  18089. @item colors
  18090. Set colors separated by '|' which are going to be used for drawing of each channel.
  18091. @item scale
  18092. Set amplitude scale.
  18093. Available values are:
  18094. @table @samp
  18095. @item lin
  18096. Linear.
  18097. @item log
  18098. Logarithmic.
  18099. @item sqrt
  18100. Square root.
  18101. @item cbrt
  18102. Cubic root.
  18103. @end table
  18104. Default is linear.
  18105. @item draw
  18106. Set the draw mode. This is mostly useful to set for high @var{n}.
  18107. Available values are:
  18108. @table @samp
  18109. @item scale
  18110. Scale pixel values for each drawn sample.
  18111. @item full
  18112. Draw every sample directly.
  18113. @end table
  18114. Default value is @code{scale}.
  18115. @end table
  18116. @subsection Examples
  18117. @itemize
  18118. @item
  18119. Output the input file audio and the corresponding video representation
  18120. at the same time:
  18121. @example
  18122. amovie=a.mp3,asplit[out0],showwaves[out1]
  18123. @end example
  18124. @item
  18125. Create a synthetic signal and show it with showwaves, forcing a
  18126. frame rate of 30 frames per second:
  18127. @example
  18128. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  18129. @end example
  18130. @end itemize
  18131. @section showwavespic
  18132. Convert input audio to a single video frame, representing the samples waves.
  18133. The filter accepts the following options:
  18134. @table @option
  18135. @item size, s
  18136. Specify the video size for the output. For the syntax of this option, check the
  18137. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18138. Default value is @code{600x240}.
  18139. @item split_channels
  18140. Set if channels should be drawn separately or overlap. Default value is 0.
  18141. @item colors
  18142. Set colors separated by '|' which are going to be used for drawing of each channel.
  18143. @item scale
  18144. Set amplitude scale.
  18145. Available values are:
  18146. @table @samp
  18147. @item lin
  18148. Linear.
  18149. @item log
  18150. Logarithmic.
  18151. @item sqrt
  18152. Square root.
  18153. @item cbrt
  18154. Cubic root.
  18155. @end table
  18156. Default is linear.
  18157. @item draw
  18158. Set the draw mode.
  18159. Available values are:
  18160. @table @samp
  18161. @item scale
  18162. Scale pixel values for each drawn sample.
  18163. @item full
  18164. Draw every sample directly.
  18165. @end table
  18166. Default value is @code{scale}.
  18167. @end table
  18168. @subsection Examples
  18169. @itemize
  18170. @item
  18171. Extract a channel split representation of the wave form of a whole audio track
  18172. in a 1024x800 picture using @command{ffmpeg}:
  18173. @example
  18174. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  18175. @end example
  18176. @end itemize
  18177. @section sidedata, asidedata
  18178. Delete frame side data, or select frames based on it.
  18179. This filter accepts the following options:
  18180. @table @option
  18181. @item mode
  18182. Set mode of operation of the filter.
  18183. Can be one of the following:
  18184. @table @samp
  18185. @item select
  18186. Select every frame with side data of @code{type}.
  18187. @item delete
  18188. Delete side data of @code{type}. If @code{type} is not set, delete all side
  18189. data in the frame.
  18190. @end table
  18191. @item type
  18192. Set side data type used with all modes. Must be set for @code{select} mode. For
  18193. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  18194. in @file{libavutil/frame.h}. For example, to choose
  18195. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  18196. @end table
  18197. @section spectrumsynth
  18198. Synthesize audio from 2 input video spectrums, first input stream represents
  18199. magnitude across time and second represents phase across time.
  18200. The filter will transform from frequency domain as displayed in videos back
  18201. to time domain as presented in audio output.
  18202. This filter is primarily created for reversing processed @ref{showspectrum}
  18203. filter outputs, but can synthesize sound from other spectrograms too.
  18204. But in such case results are going to be poor if the phase data is not
  18205. available, because in such cases phase data need to be recreated, usually
  18206. it's just recreated from random noise.
  18207. For best results use gray only output (@code{channel} color mode in
  18208. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  18209. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  18210. @code{data} option. Inputs videos should generally use @code{fullframe}
  18211. slide mode as that saves resources needed for decoding video.
  18212. The filter accepts the following options:
  18213. @table @option
  18214. @item sample_rate
  18215. Specify sample rate of output audio, the sample rate of audio from which
  18216. spectrum was generated may differ.
  18217. @item channels
  18218. Set number of channels represented in input video spectrums.
  18219. @item scale
  18220. Set scale which was used when generating magnitude input spectrum.
  18221. Can be @code{lin} or @code{log}. Default is @code{log}.
  18222. @item slide
  18223. Set slide which was used when generating inputs spectrums.
  18224. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  18225. Default is @code{fullframe}.
  18226. @item win_func
  18227. Set window function used for resynthesis.
  18228. @item overlap
  18229. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18230. which means optimal overlap for selected window function will be picked.
  18231. @item orientation
  18232. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  18233. Default is @code{vertical}.
  18234. @end table
  18235. @subsection Examples
  18236. @itemize
  18237. @item
  18238. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  18239. then resynthesize videos back to audio with spectrumsynth:
  18240. @example
  18241. 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
  18242. 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
  18243. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  18244. @end example
  18245. @end itemize
  18246. @section split, asplit
  18247. Split input into several identical outputs.
  18248. @code{asplit} works with audio input, @code{split} with video.
  18249. The filter accepts a single parameter which specifies the number of outputs. If
  18250. unspecified, it defaults to 2.
  18251. @subsection Examples
  18252. @itemize
  18253. @item
  18254. Create two separate outputs from the same input:
  18255. @example
  18256. [in] split [out0][out1]
  18257. @end example
  18258. @item
  18259. To create 3 or more outputs, you need to specify the number of
  18260. outputs, like in:
  18261. @example
  18262. [in] asplit=3 [out0][out1][out2]
  18263. @end example
  18264. @item
  18265. Create two separate outputs from the same input, one cropped and
  18266. one padded:
  18267. @example
  18268. [in] split [splitout1][splitout2];
  18269. [splitout1] crop=100:100:0:0 [cropout];
  18270. [splitout2] pad=200:200:100:100 [padout];
  18271. @end example
  18272. @item
  18273. Create 5 copies of the input audio with @command{ffmpeg}:
  18274. @example
  18275. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  18276. @end example
  18277. @end itemize
  18278. @section zmq, azmq
  18279. Receive commands sent through a libzmq client, and forward them to
  18280. filters in the filtergraph.
  18281. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  18282. must be inserted between two video filters, @code{azmq} between two
  18283. audio filters. Both are capable to send messages to any filter type.
  18284. To enable these filters you need to install the libzmq library and
  18285. headers and configure FFmpeg with @code{--enable-libzmq}.
  18286. For more information about libzmq see:
  18287. @url{http://www.zeromq.org/}
  18288. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  18289. receives messages sent through a network interface defined by the
  18290. @option{bind_address} (or the abbreviation "@option{b}") option.
  18291. Default value of this option is @file{tcp://localhost:5555}. You may
  18292. want to alter this value to your needs, but do not forget to escape any
  18293. ':' signs (see @ref{filtergraph escaping}).
  18294. The received message must be in the form:
  18295. @example
  18296. @var{TARGET} @var{COMMAND} [@var{ARG}]
  18297. @end example
  18298. @var{TARGET} specifies the target of the command, usually the name of
  18299. the filter class or a specific filter instance name. The default
  18300. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  18301. but you can override this by using the @samp{filter_name@@id} syntax
  18302. (see @ref{Filtergraph syntax}).
  18303. @var{COMMAND} specifies the name of the command for the target filter.
  18304. @var{ARG} is optional and specifies the optional argument list for the
  18305. given @var{COMMAND}.
  18306. Upon reception, the message is processed and the corresponding command
  18307. is injected into the filtergraph. Depending on the result, the filter
  18308. will send a reply to the client, adopting the format:
  18309. @example
  18310. @var{ERROR_CODE} @var{ERROR_REASON}
  18311. @var{MESSAGE}
  18312. @end example
  18313. @var{MESSAGE} is optional.
  18314. @subsection Examples
  18315. Look at @file{tools/zmqsend} for an example of a zmq client which can
  18316. be used to send commands processed by these filters.
  18317. Consider the following filtergraph generated by @command{ffplay}.
  18318. In this example the last overlay filter has an instance name. All other
  18319. filters will have default instance names.
  18320. @example
  18321. ffplay -dumpgraph 1 -f lavfi "
  18322. color=s=100x100:c=red [l];
  18323. color=s=100x100:c=blue [r];
  18324. nullsrc=s=200x100, zmq [bg];
  18325. [bg][l] overlay [bg+l];
  18326. [bg+l][r] overlay@@my=x=100 "
  18327. @end example
  18328. To change the color of the left side of the video, the following
  18329. command can be used:
  18330. @example
  18331. echo Parsed_color_0 c yellow | tools/zmqsend
  18332. @end example
  18333. To change the right side:
  18334. @example
  18335. echo Parsed_color_1 c pink | tools/zmqsend
  18336. @end example
  18337. To change the position of the right side:
  18338. @example
  18339. echo overlay@@my x 150 | tools/zmqsend
  18340. @end example
  18341. @c man end MULTIMEDIA FILTERS
  18342. @chapter Multimedia Sources
  18343. @c man begin MULTIMEDIA SOURCES
  18344. Below is a description of the currently available multimedia sources.
  18345. @section amovie
  18346. This is the same as @ref{movie} source, except it selects an audio
  18347. stream by default.
  18348. @anchor{movie}
  18349. @section movie
  18350. Read audio and/or video stream(s) from a movie container.
  18351. It accepts the following parameters:
  18352. @table @option
  18353. @item filename
  18354. The name of the resource to read (not necessarily a file; it can also be a
  18355. device or a stream accessed through some protocol).
  18356. @item format_name, f
  18357. Specifies the format assumed for the movie to read, and can be either
  18358. the name of a container or an input device. If not specified, the
  18359. format is guessed from @var{movie_name} or by probing.
  18360. @item seek_point, sp
  18361. Specifies the seek point in seconds. The frames will be output
  18362. starting from this seek point. The parameter is evaluated with
  18363. @code{av_strtod}, so the numerical value may be suffixed by an IS
  18364. postfix. The default value is "0".
  18365. @item streams, s
  18366. Specifies the streams to read. Several streams can be specified,
  18367. separated by "+". The source will then have as many outputs, in the
  18368. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  18369. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  18370. respectively the default (best suited) video and audio stream. Default
  18371. is "dv", or "da" if the filter is called as "amovie".
  18372. @item stream_index, si
  18373. Specifies the index of the video stream to read. If the value is -1,
  18374. the most suitable video stream will be automatically selected. The default
  18375. value is "-1". Deprecated. If the filter is called "amovie", it will select
  18376. audio instead of video.
  18377. @item loop
  18378. Specifies how many times to read the stream in sequence.
  18379. If the value is 0, the stream will be looped infinitely.
  18380. Default value is "1".
  18381. Note that when the movie is looped the source timestamps are not
  18382. changed, so it will generate non monotonically increasing timestamps.
  18383. @item discontinuity
  18384. Specifies the time difference between frames above which the point is
  18385. considered a timestamp discontinuity which is removed by adjusting the later
  18386. timestamps.
  18387. @end table
  18388. It allows overlaying a second video on top of the main input of
  18389. a filtergraph, as shown in this graph:
  18390. @example
  18391. input -----------> deltapts0 --> overlay --> output
  18392. ^
  18393. |
  18394. movie --> scale--> deltapts1 -------+
  18395. @end example
  18396. @subsection Examples
  18397. @itemize
  18398. @item
  18399. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  18400. on top of the input labelled "in":
  18401. @example
  18402. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18403. [in] setpts=PTS-STARTPTS [main];
  18404. [main][over] overlay=16:16 [out]
  18405. @end example
  18406. @item
  18407. Read from a video4linux2 device, and overlay it on top of the input
  18408. labelled "in":
  18409. @example
  18410. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18411. [in] setpts=PTS-STARTPTS [main];
  18412. [main][over] overlay=16:16 [out]
  18413. @end example
  18414. @item
  18415. Read the first video stream and the audio stream with id 0x81 from
  18416. dvd.vob; the video is connected to the pad named "video" and the audio is
  18417. connected to the pad named "audio":
  18418. @example
  18419. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  18420. @end example
  18421. @end itemize
  18422. @subsection Commands
  18423. Both movie and amovie support the following commands:
  18424. @table @option
  18425. @item seek
  18426. Perform seek using "av_seek_frame".
  18427. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  18428. @itemize
  18429. @item
  18430. @var{stream_index}: If stream_index is -1, a default
  18431. stream is selected, and @var{timestamp} is automatically converted
  18432. from AV_TIME_BASE units to the stream specific time_base.
  18433. @item
  18434. @var{timestamp}: Timestamp in AVStream.time_base units
  18435. or, if no stream is specified, in AV_TIME_BASE units.
  18436. @item
  18437. @var{flags}: Flags which select direction and seeking mode.
  18438. @end itemize
  18439. @item get_duration
  18440. Get movie duration in AV_TIME_BASE units.
  18441. @end table
  18442. @c man end MULTIMEDIA SOURCES