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.

23370 lines
622KB

  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{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item mode
  315. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  316. Default is @code{downward}.
  317. @item threshold
  318. If a signal of stream rises above this level it will affect the gain
  319. reduction.
  320. By default it is 0.125. Range is between 0.00097563 and 1.
  321. @item ratio
  322. Set a ratio by which the signal is reduced. 1:2 means that if the level
  323. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  324. Default is 2. Range is between 1 and 20.
  325. @item attack
  326. Amount of milliseconds the signal has to rise above the threshold before gain
  327. reduction starts. Default is 20. Range is between 0.01 and 2000.
  328. @item release
  329. Amount of milliseconds the signal has to fall below the threshold before
  330. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  331. @item makeup
  332. Set the amount by how much signal will be amplified after processing.
  333. Default is 1. Range is from 1 to 64.
  334. @item knee
  335. Curve the sharp knee around the threshold to enter gain reduction more softly.
  336. Default is 2.82843. Range is between 1 and 8.
  337. @item link
  338. Choose if the @code{average} level between all channels of input stream
  339. or the louder(@code{maximum}) channel of input stream affects the
  340. reduction. Default is @code{average}.
  341. @item detection
  342. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  343. of @code{rms}. Default is @code{rms} which is mostly smoother.
  344. @item mix
  345. How much to use compressed signal in output. Default is 1.
  346. Range is between 0 and 1.
  347. @end table
  348. @section acontrast
  349. Simple audio dynamic range compression/expansion filter.
  350. The filter accepts the following options:
  351. @table @option
  352. @item contrast
  353. Set contrast. Default is 33. Allowed range is between 0 and 100.
  354. @end table
  355. @section acopy
  356. Copy the input audio source unchanged to the output. This is mainly useful for
  357. testing purposes.
  358. @section acrossfade
  359. Apply cross fade from one input audio stream to another input audio stream.
  360. The cross fade is applied for specified duration near the end of first stream.
  361. The filter accepts the following options:
  362. @table @option
  363. @item nb_samples, ns
  364. Specify the number of samples for which the cross fade effect has to last.
  365. At the end of the cross fade effect the first input audio will be completely
  366. silent. Default is 44100.
  367. @item duration, d
  368. Specify the duration of the cross fade effect. See
  369. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  370. for the accepted syntax.
  371. By default the duration is determined by @var{nb_samples}.
  372. If set this option is used instead of @var{nb_samples}.
  373. @item overlap, o
  374. Should first stream end overlap with second stream start. Default is enabled.
  375. @item curve1
  376. Set curve for cross fade transition for first stream.
  377. @item curve2
  378. Set curve for cross fade transition for second stream.
  379. For description of available curve types see @ref{afade} filter description.
  380. @end table
  381. @subsection Examples
  382. @itemize
  383. @item
  384. Cross fade from one input to another:
  385. @example
  386. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  387. @end example
  388. @item
  389. Cross fade from one input to another but without overlapping:
  390. @example
  391. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  392. @end example
  393. @end itemize
  394. @section acrossover
  395. Split audio stream into several bands.
  396. This filter splits audio stream into two or more frequency ranges.
  397. Summing all streams back will give flat output.
  398. The filter accepts the following options:
  399. @table @option
  400. @item split
  401. Set split frequencies. Those must be positive and increasing.
  402. @item order
  403. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  404. Default is @var{4th}.
  405. @end table
  406. @section acrusher
  407. Reduce audio bit resolution.
  408. This filter is bit crusher with enhanced functionality. A bit crusher
  409. is used to audibly reduce number of bits an audio signal is sampled
  410. with. This doesn't change the bit depth at all, it just produces the
  411. effect. Material reduced in bit depth sounds more harsh and "digital".
  412. This filter is able to even round to continuous values instead of discrete
  413. bit depths.
  414. Additionally it has a D/C offset which results in different crushing of
  415. the lower and the upper half of the signal.
  416. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  417. Another feature of this filter is the logarithmic mode.
  418. This setting switches from linear distances between bits to logarithmic ones.
  419. The result is a much more "natural" sounding crusher which doesn't gate low
  420. signals for example. The human ear has a logarithmic perception,
  421. so this kind of crushing is much more pleasant.
  422. Logarithmic crushing is also able to get anti-aliased.
  423. The filter accepts the following options:
  424. @table @option
  425. @item level_in
  426. Set level in.
  427. @item level_out
  428. Set level out.
  429. @item bits
  430. Set bit reduction.
  431. @item mix
  432. Set mixing amount.
  433. @item mode
  434. Can be linear: @code{lin} or logarithmic: @code{log}.
  435. @item dc
  436. Set DC.
  437. @item aa
  438. Set anti-aliasing.
  439. @item samples
  440. Set sample reduction.
  441. @item lfo
  442. Enable LFO. By default disabled.
  443. @item lforange
  444. Set LFO range.
  445. @item lforate
  446. Set LFO rate.
  447. @end table
  448. @section acue
  449. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  450. filter.
  451. @section adeclick
  452. Remove impulsive noise from input audio.
  453. Samples detected as impulsive noise are replaced by interpolated samples using
  454. autoregressive modelling.
  455. @table @option
  456. @item w
  457. Set window size, in milliseconds. Allowed range is from @code{10} to
  458. @code{100}. Default value is @code{55} milliseconds.
  459. This sets size of window which will be processed at once.
  460. @item o
  461. Set window overlap, in percentage of window size. Allowed range is from
  462. @code{50} to @code{95}. Default value is @code{75} percent.
  463. Setting this to a very high value increases impulsive noise removal but makes
  464. whole process much slower.
  465. @item a
  466. Set autoregression order, in percentage of window size. Allowed range is from
  467. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  468. controls quality of interpolated samples using neighbour good samples.
  469. @item t
  470. Set threshold value. Allowed range is from @code{1} to @code{100}.
  471. Default value is @code{2}.
  472. This controls the strength of impulsive noise which is going to be removed.
  473. The lower value, the more samples will be detected as impulsive noise.
  474. @item b
  475. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  476. @code{10}. Default value is @code{2}.
  477. If any two samples detected as noise are spaced less than this value then any
  478. sample between those two samples will be also detected as noise.
  479. @item m
  480. Set overlap method.
  481. It accepts the following values:
  482. @table @option
  483. @item a
  484. Select overlap-add method. Even not interpolated samples are slightly
  485. changed with this method.
  486. @item s
  487. Select overlap-save method. Not interpolated samples remain unchanged.
  488. @end table
  489. Default value is @code{a}.
  490. @end table
  491. @section adeclip
  492. Remove clipped samples from input audio.
  493. Samples detected as clipped are replaced by interpolated samples using
  494. autoregressive modelling.
  495. @table @option
  496. @item w
  497. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  498. Default value is @code{55} milliseconds.
  499. This sets size of window which will be processed at once.
  500. @item o
  501. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  502. to @code{95}. Default value is @code{75} percent.
  503. @item a
  504. Set autoregression order, in percentage of window size. Allowed range is from
  505. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  506. quality of interpolated samples using neighbour good samples.
  507. @item t
  508. Set threshold value. Allowed range is from @code{1} to @code{100}.
  509. Default value is @code{10}. Higher values make clip detection less aggressive.
  510. @item n
  511. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  512. Default value is @code{1000}. Higher values make clip detection less aggressive.
  513. @item m
  514. Set overlap method.
  515. It accepts the following values:
  516. @table @option
  517. @item a
  518. Select overlap-add method. Even not interpolated samples are slightly changed
  519. with this method.
  520. @item s
  521. Select overlap-save method. Not interpolated samples remain unchanged.
  522. @end table
  523. Default value is @code{a}.
  524. @end table
  525. @section adelay
  526. Delay one or more audio channels.
  527. Samples in delayed channel are filled with silence.
  528. The filter accepts the following option:
  529. @table @option
  530. @item delays
  531. Set list of delays in milliseconds for each channel separated by '|'.
  532. Unused delays will be silently ignored. If number of given delays is
  533. smaller than number of channels all remaining channels will not be delayed.
  534. If you want to delay exact number of samples, append 'S' to number.
  535. If you want instead to delay in seconds, append 's' to number.
  536. @end table
  537. @subsection Examples
  538. @itemize
  539. @item
  540. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  541. the second channel (and any other channels that may be present) unchanged.
  542. @example
  543. adelay=1500|0|500
  544. @end example
  545. @item
  546. Delay second channel by 500 samples, the third channel by 700 samples and leave
  547. the first channel (and any other channels that may be present) unchanged.
  548. @example
  549. adelay=0|500S|700S
  550. @end example
  551. @end itemize
  552. @section aderivative, aintegral
  553. Compute derivative/integral of audio stream.
  554. Applying both filters one after another produces original audio.
  555. @section aecho
  556. Apply echoing to the input audio.
  557. Echoes are reflected sound and can occur naturally amongst mountains
  558. (and sometimes large buildings) when talking or shouting; digital echo
  559. effects emulate this behaviour and are often used to help fill out the
  560. sound of a single instrument or vocal. The time difference between the
  561. original signal and the reflection is the @code{delay}, and the
  562. loudness of the reflected signal is the @code{decay}.
  563. Multiple echoes can have different delays and decays.
  564. A description of the accepted parameters follows.
  565. @table @option
  566. @item in_gain
  567. Set input gain of reflected signal. Default is @code{0.6}.
  568. @item out_gain
  569. Set output gain of reflected signal. Default is @code{0.3}.
  570. @item delays
  571. Set list of time intervals in milliseconds between original signal and reflections
  572. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  573. Default is @code{1000}.
  574. @item decays
  575. Set list of loudness of reflected signals separated by '|'.
  576. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  577. Default is @code{0.5}.
  578. @end table
  579. @subsection Examples
  580. @itemize
  581. @item
  582. Make it sound as if there are twice as many instruments as are actually playing:
  583. @example
  584. aecho=0.8:0.88:60:0.4
  585. @end example
  586. @item
  587. If delay is very short, then it sound like a (metallic) robot playing music:
  588. @example
  589. aecho=0.8:0.88:6:0.4
  590. @end example
  591. @item
  592. A longer delay will sound like an open air concert in the mountains:
  593. @example
  594. aecho=0.8:0.9:1000:0.3
  595. @end example
  596. @item
  597. Same as above but with one more mountain:
  598. @example
  599. aecho=0.8:0.9:1000|1800:0.3|0.25
  600. @end example
  601. @end itemize
  602. @section aemphasis
  603. Audio emphasis filter creates or restores material directly taken from LPs or
  604. emphased CDs with different filter curves. E.g. to store music on vinyl the
  605. signal has to be altered by a filter first to even out the disadvantages of
  606. this recording medium.
  607. Once the material is played back the inverse filter has to be applied to
  608. restore the distortion of the frequency response.
  609. The filter accepts the following options:
  610. @table @option
  611. @item level_in
  612. Set input gain.
  613. @item level_out
  614. Set output gain.
  615. @item mode
  616. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  617. use @code{production} mode. Default is @code{reproduction} mode.
  618. @item type
  619. Set filter type. Selects medium. Can be one of the following:
  620. @table @option
  621. @item col
  622. select Columbia.
  623. @item emi
  624. select EMI.
  625. @item bsi
  626. select BSI (78RPM).
  627. @item riaa
  628. select RIAA.
  629. @item cd
  630. select Compact Disc (CD).
  631. @item 50fm
  632. select 50µs (FM).
  633. @item 75fm
  634. select 75µs (FM).
  635. @item 50kf
  636. select 50µs (FM-KF).
  637. @item 75kf
  638. select 75µs (FM-KF).
  639. @end table
  640. @end table
  641. @section aeval
  642. Modify an audio signal according to the specified expressions.
  643. This filter accepts one or more expressions (one for each channel),
  644. which are evaluated and used to modify a corresponding audio signal.
  645. It accepts the following parameters:
  646. @table @option
  647. @item exprs
  648. Set the '|'-separated expressions list for each separate channel. If
  649. the number of input channels is greater than the number of
  650. expressions, the last specified expression is used for the remaining
  651. output channels.
  652. @item channel_layout, c
  653. Set output channel layout. If not specified, the channel layout is
  654. specified by the number of expressions. If set to @samp{same}, it will
  655. use by default the same input channel layout.
  656. @end table
  657. Each expression in @var{exprs} can contain the following constants and functions:
  658. @table @option
  659. @item ch
  660. channel number of the current expression
  661. @item n
  662. number of the evaluated sample, starting from 0
  663. @item s
  664. sample rate
  665. @item t
  666. time of the evaluated sample expressed in seconds
  667. @item nb_in_channels
  668. @item nb_out_channels
  669. input and output number of channels
  670. @item val(CH)
  671. the value of input channel with number @var{CH}
  672. @end table
  673. Note: this filter is slow. For faster processing you should use a
  674. dedicated filter.
  675. @subsection Examples
  676. @itemize
  677. @item
  678. Half volume:
  679. @example
  680. aeval=val(ch)/2:c=same
  681. @end example
  682. @item
  683. Invert phase of the second channel:
  684. @example
  685. aeval=val(0)|-val(1)
  686. @end example
  687. @end itemize
  688. @anchor{afade}
  689. @section afade
  690. Apply fade-in/out effect to input audio.
  691. A description of the accepted parameters follows.
  692. @table @option
  693. @item type, t
  694. Specify the effect type, can be either @code{in} for fade-in, or
  695. @code{out} for a fade-out effect. Default is @code{in}.
  696. @item start_sample, ss
  697. Specify the number of the start sample for starting to apply the fade
  698. effect. Default is 0.
  699. @item nb_samples, ns
  700. Specify the number of samples for which the fade effect has to last. At
  701. the end of the fade-in effect the output audio will have the same
  702. volume as the input audio, at the end of the fade-out transition
  703. the output audio will be silence. Default is 44100.
  704. @item start_time, st
  705. Specify the start time of the fade effect. Default is 0.
  706. The value must be specified as a time duration; see
  707. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  708. for the accepted syntax.
  709. If set this option is used instead of @var{start_sample}.
  710. @item duration, d
  711. Specify the duration of the fade effect. See
  712. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  713. for the accepted syntax.
  714. At the end of the fade-in effect the output audio will have the same
  715. volume as the input audio, at the end of the fade-out transition
  716. the output audio will be silence.
  717. By default the duration is determined by @var{nb_samples}.
  718. If set this option is used instead of @var{nb_samples}.
  719. @item curve
  720. Set curve for fade transition.
  721. It accepts the following values:
  722. @table @option
  723. @item tri
  724. select triangular, linear slope (default)
  725. @item qsin
  726. select quarter of sine wave
  727. @item hsin
  728. select half of sine wave
  729. @item esin
  730. select exponential sine wave
  731. @item log
  732. select logarithmic
  733. @item ipar
  734. select inverted parabola
  735. @item qua
  736. select quadratic
  737. @item cub
  738. select cubic
  739. @item squ
  740. select square root
  741. @item cbr
  742. select cubic root
  743. @item par
  744. select parabola
  745. @item exp
  746. select exponential
  747. @item iqsin
  748. select inverted quarter of sine wave
  749. @item ihsin
  750. select inverted half of sine wave
  751. @item dese
  752. select double-exponential seat
  753. @item desi
  754. select double-exponential sigmoid
  755. @item losi
  756. select logistic sigmoid
  757. @item nofade
  758. no fade applied
  759. @end table
  760. @end table
  761. @subsection Examples
  762. @itemize
  763. @item
  764. Fade in first 15 seconds of audio:
  765. @example
  766. afade=t=in:ss=0:d=15
  767. @end example
  768. @item
  769. Fade out last 25 seconds of a 900 seconds audio:
  770. @example
  771. afade=t=out:st=875:d=25
  772. @end example
  773. @end itemize
  774. @section afftdn
  775. Denoise audio samples with FFT.
  776. A description of the accepted parameters follows.
  777. @table @option
  778. @item nr
  779. Set the noise reduction in dB, allowed range is 0.01 to 97.
  780. Default value is 12 dB.
  781. @item nf
  782. Set the noise floor in dB, allowed range is -80 to -20.
  783. Default value is -50 dB.
  784. @item nt
  785. Set the noise type.
  786. It accepts the following values:
  787. @table @option
  788. @item w
  789. Select white noise.
  790. @item v
  791. Select vinyl noise.
  792. @item s
  793. Select shellac noise.
  794. @item c
  795. Select custom noise, defined in @code{bn} option.
  796. Default value is white noise.
  797. @end table
  798. @item bn
  799. Set custom band noise for every one of 15 bands.
  800. Bands are separated by ' ' or '|'.
  801. @item rf
  802. Set the residual floor in dB, allowed range is -80 to -20.
  803. Default value is -38 dB.
  804. @item tn
  805. Enable noise tracking. By default is disabled.
  806. With this enabled, noise floor is automatically adjusted.
  807. @item tr
  808. Enable residual tracking. By default is disabled.
  809. @item om
  810. Set the output mode.
  811. It accepts the following values:
  812. @table @option
  813. @item i
  814. Pass input unchanged.
  815. @item o
  816. Pass noise filtered out.
  817. @item n
  818. Pass only noise.
  819. Default value is @var{o}.
  820. @end table
  821. @end table
  822. @subsection Commands
  823. This filter supports the following commands:
  824. @table @option
  825. @item sample_noise, sn
  826. Start or stop measuring noise profile.
  827. Syntax for the command is : "start" or "stop" string.
  828. After measuring noise profile is stopped it will be
  829. automatically applied in filtering.
  830. @item noise_reduction, nr
  831. Change noise reduction. Argument is single float number.
  832. Syntax for the command is : "@var{noise_reduction}"
  833. @item noise_floor, nf
  834. Change noise floor. Argument is single float number.
  835. Syntax for the command is : "@var{noise_floor}"
  836. @item output_mode, om
  837. Change output mode operation.
  838. Syntax for the command is : "i", "o" or "n" string.
  839. @end table
  840. @section afftfilt
  841. Apply arbitrary expressions to samples in frequency domain.
  842. @table @option
  843. @item real
  844. Set frequency domain real expression for each separate channel separated
  845. by '|'. Default is "re".
  846. If the number of input channels is greater than the number of
  847. expressions, the last specified expression is used for the remaining
  848. output channels.
  849. @item imag
  850. Set frequency domain imaginary expression for each separate channel
  851. separated by '|'. Default is "im".
  852. Each expression in @var{real} and @var{imag} can contain the following
  853. constants and functions:
  854. @table @option
  855. @item sr
  856. sample rate
  857. @item b
  858. current frequency bin number
  859. @item nb
  860. number of available bins
  861. @item ch
  862. channel number of the current expression
  863. @item chs
  864. number of channels
  865. @item pts
  866. current frame pts
  867. @item re
  868. current real part of frequency bin of current channel
  869. @item im
  870. current imaginary part of frequency bin of current channel
  871. @item real(b, ch)
  872. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  873. @item imag(b, ch)
  874. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  875. @end table
  876. @item win_size
  877. Set window size.
  878. It accepts the following values:
  879. @table @samp
  880. @item w16
  881. @item w32
  882. @item w64
  883. @item w128
  884. @item w256
  885. @item w512
  886. @item w1024
  887. @item w2048
  888. @item w4096
  889. @item w8192
  890. @item w16384
  891. @item w32768
  892. @item w65536
  893. @end table
  894. Default is @code{w4096}
  895. @item win_func
  896. Set window function. Default is @code{hann}.
  897. @item overlap
  898. Set window overlap. If set to 1, the recommended overlap for selected
  899. window function will be picked. Default is @code{0.75}.
  900. @end table
  901. @subsection Examples
  902. @itemize
  903. @item
  904. Leave almost only low frequencies in audio:
  905. @example
  906. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  907. @end example
  908. @end itemize
  909. @anchor{afir}
  910. @section afir
  911. Apply an arbitrary Frequency Impulse Response filter.
  912. This filter is designed for applying long FIR filters,
  913. up to 60 seconds long.
  914. It can be used as component for digital crossover filters,
  915. room equalization, cross talk cancellation, wavefield synthesis,
  916. auralization, ambiophonics, ambisonics and spatialization.
  917. This filter uses second stream as FIR coefficients.
  918. If second stream holds single channel, it will be used
  919. for all input channels in first stream, otherwise
  920. number of channels in second stream must be same as
  921. number of channels in first stream.
  922. It accepts the following parameters:
  923. @table @option
  924. @item dry
  925. Set dry gain. This sets input gain.
  926. @item wet
  927. Set wet gain. This sets final output gain.
  928. @item length
  929. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  930. @item gtype
  931. Enable applying gain measured from power of IR.
  932. Set which approach to use for auto gain measurement.
  933. @table @option
  934. @item none
  935. Do not apply any gain.
  936. @item peak
  937. select peak gain, very conservative approach. This is default value.
  938. @item dc
  939. select DC gain, limited application.
  940. @item gn
  941. select gain to noise approach, this is most popular one.
  942. @end table
  943. @item irgain
  944. Set gain to be applied to IR coefficients before filtering.
  945. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  946. @item irfmt
  947. Set format of IR stream. Can be @code{mono} or @code{input}.
  948. Default is @code{input}.
  949. @item maxir
  950. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  951. Allowed range is 0.1 to 60 seconds.
  952. @item response
  953. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  954. By default it is disabled.
  955. @item channel
  956. Set for which IR channel to display frequency response. By default is first channel
  957. displayed. This option is used only when @var{response} is enabled.
  958. @item size
  959. Set video stream size. This option is used only when @var{response} is enabled.
  960. @item rate
  961. Set video stream frame rate. This option is used only when @var{response} is enabled.
  962. @item minp
  963. Set minimal partition size used for convolution. Default is @var{8192}.
  964. Allowed range is from @var{8} to @var{32768}.
  965. Lower values decreases latency at cost of higher CPU usage.
  966. @item maxp
  967. Set maximal partition size used for convolution. Default is @var{8192}.
  968. Allowed range is from @var{8} to @var{32768}.
  969. Lower values may increase CPU usage.
  970. @end table
  971. @subsection Examples
  972. @itemize
  973. @item
  974. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  975. @example
  976. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  977. @end example
  978. @end itemize
  979. @anchor{aformat}
  980. @section aformat
  981. Set output format constraints for the input audio. The framework will
  982. negotiate the most appropriate format to minimize conversions.
  983. It accepts the following parameters:
  984. @table @option
  985. @item sample_fmts
  986. A '|'-separated list of requested sample formats.
  987. @item sample_rates
  988. A '|'-separated list of requested sample rates.
  989. @item channel_layouts
  990. A '|'-separated list of requested channel layouts.
  991. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  992. for the required syntax.
  993. @end table
  994. If a parameter is omitted, all values are allowed.
  995. Force the output to either unsigned 8-bit or signed 16-bit stereo
  996. @example
  997. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  998. @end example
  999. @section agate
  1000. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1001. processing reduces disturbing noise between useful signals.
  1002. Gating is done by detecting the volume below a chosen level @var{threshold}
  1003. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1004. floor is set via @var{range}. Because an exact manipulation of the signal
  1005. would cause distortion of the waveform the reduction can be levelled over
  1006. time. This is done by setting @var{attack} and @var{release}.
  1007. @var{attack} determines how long the signal has to fall below the threshold
  1008. before any reduction will occur and @var{release} sets the time the signal
  1009. has to rise above the threshold to reduce the reduction again.
  1010. Shorter signals than the chosen attack time will be left untouched.
  1011. @table @option
  1012. @item level_in
  1013. Set input level before filtering.
  1014. Default is 1. Allowed range is from 0.015625 to 64.
  1015. @item mode
  1016. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1017. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1018. will be amplified, expanding dynamic range in upward direction.
  1019. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1020. @item range
  1021. Set the level of gain reduction when the signal is below the threshold.
  1022. Default is 0.06125. Allowed range is from 0 to 1.
  1023. Setting this to 0 disables reduction and then filter behaves like expander.
  1024. @item threshold
  1025. If a signal rises above this level the gain reduction is released.
  1026. Default is 0.125. Allowed range is from 0 to 1.
  1027. @item ratio
  1028. Set a ratio by which the signal is reduced.
  1029. Default is 2. Allowed range is from 1 to 9000.
  1030. @item attack
  1031. Amount of milliseconds the signal has to rise above the threshold before gain
  1032. reduction stops.
  1033. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1034. @item release
  1035. Amount of milliseconds the signal has to fall below the threshold before the
  1036. reduction is increased again. Default is 250 milliseconds.
  1037. Allowed range is from 0.01 to 9000.
  1038. @item makeup
  1039. Set amount of amplification of signal after processing.
  1040. Default is 1. Allowed range is from 1 to 64.
  1041. @item knee
  1042. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1043. Default is 2.828427125. Allowed range is from 1 to 8.
  1044. @item detection
  1045. Choose if exact signal should be taken for detection or an RMS like one.
  1046. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1047. @item link
  1048. Choose if the average level between all channels or the louder channel affects
  1049. the reduction.
  1050. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1051. @end table
  1052. @section aiir
  1053. Apply an arbitrary Infinite Impulse Response filter.
  1054. It accepts the following parameters:
  1055. @table @option
  1056. @item z
  1057. Set numerator/zeros coefficients.
  1058. @item p
  1059. Set denominator/poles coefficients.
  1060. @item k
  1061. Set channels gains.
  1062. @item dry_gain
  1063. Set input gain.
  1064. @item wet_gain
  1065. Set output gain.
  1066. @item f
  1067. Set coefficients format.
  1068. @table @samp
  1069. @item tf
  1070. transfer function
  1071. @item zp
  1072. Z-plane zeros/poles, cartesian (default)
  1073. @item pr
  1074. Z-plane zeros/poles, polar radians
  1075. @item pd
  1076. Z-plane zeros/poles, polar degrees
  1077. @end table
  1078. @item r
  1079. Set kind of processing.
  1080. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1081. @item e
  1082. Set filtering precision.
  1083. @table @samp
  1084. @item dbl
  1085. double-precision floating-point (default)
  1086. @item flt
  1087. single-precision floating-point
  1088. @item i32
  1089. 32-bit integers
  1090. @item i16
  1091. 16-bit integers
  1092. @end table
  1093. @item response
  1094. Show IR frequency response, magnitude and phase in additional video stream.
  1095. By default it is disabled.
  1096. @item channel
  1097. Set for which IR channel to display frequency response. By default is first channel
  1098. displayed. This option is used only when @var{response} is enabled.
  1099. @item size
  1100. Set video stream size. This option is used only when @var{response} is enabled.
  1101. @end table
  1102. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1103. order.
  1104. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1105. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1106. imaginary unit.
  1107. Different coefficients and gains can be provided for every channel, in such case
  1108. use '|' to separate coefficients or gains. Last provided coefficients will be
  1109. used for all remaining channels.
  1110. @subsection Examples
  1111. @itemize
  1112. @item
  1113. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1114. @example
  1115. 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
  1116. @end example
  1117. @item
  1118. Same as above but in @code{zp} format:
  1119. @example
  1120. 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
  1121. @end example
  1122. @end itemize
  1123. @section alimiter
  1124. The limiter prevents an input signal from rising over a desired threshold.
  1125. This limiter uses lookahead technology to prevent your signal from distorting.
  1126. It means that there is a small delay after the signal is processed. Keep in mind
  1127. that the delay it produces is the attack time you set.
  1128. The filter accepts the following options:
  1129. @table @option
  1130. @item level_in
  1131. Set input gain. Default is 1.
  1132. @item level_out
  1133. Set output gain. Default is 1.
  1134. @item limit
  1135. Don't let signals above this level pass the limiter. Default is 1.
  1136. @item attack
  1137. The limiter will reach its attenuation level in this amount of time in
  1138. milliseconds. Default is 5 milliseconds.
  1139. @item release
  1140. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1141. Default is 50 milliseconds.
  1142. @item asc
  1143. When gain reduction is always needed ASC takes care of releasing to an
  1144. average reduction level rather than reaching a reduction of 0 in the release
  1145. time.
  1146. @item asc_level
  1147. Select how much the release time is affected by ASC, 0 means nearly no changes
  1148. in release time while 1 produces higher release times.
  1149. @item level
  1150. Auto level output signal. Default is enabled.
  1151. This normalizes audio back to 0dB if enabled.
  1152. @end table
  1153. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1154. with @ref{aresample} before applying this filter.
  1155. @section allpass
  1156. Apply a two-pole all-pass filter with central frequency (in Hz)
  1157. @var{frequency}, and filter-width @var{width}.
  1158. An all-pass filter changes the audio's frequency to phase relationship
  1159. without changing its frequency to amplitude relationship.
  1160. The filter accepts the following options:
  1161. @table @option
  1162. @item frequency, f
  1163. Set frequency in Hz.
  1164. @item width_type, t
  1165. Set method to specify band-width of filter.
  1166. @table @option
  1167. @item h
  1168. Hz
  1169. @item q
  1170. Q-Factor
  1171. @item o
  1172. octave
  1173. @item s
  1174. slope
  1175. @item k
  1176. kHz
  1177. @end table
  1178. @item width, w
  1179. Specify the band-width of a filter in width_type units.
  1180. @item channels, c
  1181. Specify which channels to filter, by default all available are filtered.
  1182. @end table
  1183. @subsection Commands
  1184. This filter supports the following commands:
  1185. @table @option
  1186. @item frequency, f
  1187. Change allpass frequency.
  1188. Syntax for the command is : "@var{frequency}"
  1189. @item width_type, t
  1190. Change allpass width_type.
  1191. Syntax for the command is : "@var{width_type}"
  1192. @item width, w
  1193. Change allpass width.
  1194. Syntax for the command is : "@var{width}"
  1195. @end table
  1196. @section aloop
  1197. Loop audio samples.
  1198. The filter accepts the following options:
  1199. @table @option
  1200. @item loop
  1201. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1202. Default is 0.
  1203. @item size
  1204. Set maximal number of samples. Default is 0.
  1205. @item start
  1206. Set first sample of loop. Default is 0.
  1207. @end table
  1208. @anchor{amerge}
  1209. @section amerge
  1210. Merge two or more audio streams into a single multi-channel stream.
  1211. The filter accepts the following options:
  1212. @table @option
  1213. @item inputs
  1214. Set the number of inputs. Default is 2.
  1215. @end table
  1216. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1217. the channel layout of the output will be set accordingly and the channels
  1218. will be reordered as necessary. If the channel layouts of the inputs are not
  1219. disjoint, the output will have all the channels of the first input then all
  1220. the channels of the second input, in that order, and the channel layout of
  1221. the output will be the default value corresponding to the total number of
  1222. channels.
  1223. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1224. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1225. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1226. first input, b1 is the first channel of the second input).
  1227. On the other hand, if both input are in stereo, the output channels will be
  1228. in the default order: a1, a2, b1, b2, and the channel layout will be
  1229. arbitrarily set to 4.0, which may or may not be the expected value.
  1230. All inputs must have the same sample rate, and format.
  1231. If inputs do not have the same duration, the output will stop with the
  1232. shortest.
  1233. @subsection Examples
  1234. @itemize
  1235. @item
  1236. Merge two mono files into a stereo stream:
  1237. @example
  1238. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1239. @end example
  1240. @item
  1241. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1242. @example
  1243. 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
  1244. @end example
  1245. @end itemize
  1246. @section amix
  1247. Mixes multiple audio inputs into a single output.
  1248. Note that this filter only supports float samples (the @var{amerge}
  1249. and @var{pan} audio filters support many formats). If the @var{amix}
  1250. input has integer samples then @ref{aresample} will be automatically
  1251. inserted to perform the conversion to float samples.
  1252. For example
  1253. @example
  1254. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1255. @end example
  1256. will mix 3 input audio streams to a single output with the same duration as the
  1257. first input and a dropout transition time of 3 seconds.
  1258. It accepts the following parameters:
  1259. @table @option
  1260. @item inputs
  1261. The number of inputs. If unspecified, it defaults to 2.
  1262. @item duration
  1263. How to determine the end-of-stream.
  1264. @table @option
  1265. @item longest
  1266. The duration of the longest input. (default)
  1267. @item shortest
  1268. The duration of the shortest input.
  1269. @item first
  1270. The duration of the first input.
  1271. @end table
  1272. @item dropout_transition
  1273. The transition time, in seconds, for volume renormalization when an input
  1274. stream ends. The default value is 2 seconds.
  1275. @item weights
  1276. Specify weight of each input audio stream as sequence.
  1277. Each weight is separated by space. By default all inputs have same weight.
  1278. @end table
  1279. @section amultiply
  1280. Multiply first audio stream with second audio stream and store result
  1281. in output audio stream. Multiplication is done by multiplying each
  1282. sample from first stream with sample at same position from second stream.
  1283. With this element-wise multiplication one can create amplitude fades and
  1284. amplitude modulations.
  1285. @section anequalizer
  1286. High-order parametric multiband equalizer for each channel.
  1287. It accepts the following parameters:
  1288. @table @option
  1289. @item params
  1290. This option string is in format:
  1291. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1292. Each equalizer band is separated by '|'.
  1293. @table @option
  1294. @item chn
  1295. Set channel number to which equalization will be applied.
  1296. If input doesn't have that channel the entry is ignored.
  1297. @item f
  1298. Set central frequency for band.
  1299. If input doesn't have that frequency the entry is ignored.
  1300. @item w
  1301. Set band width in hertz.
  1302. @item g
  1303. Set band gain in dB.
  1304. @item t
  1305. Set filter type for band, optional, can be:
  1306. @table @samp
  1307. @item 0
  1308. Butterworth, this is default.
  1309. @item 1
  1310. Chebyshev type 1.
  1311. @item 2
  1312. Chebyshev type 2.
  1313. @end table
  1314. @end table
  1315. @item curves
  1316. With this option activated frequency response of anequalizer is displayed
  1317. in video stream.
  1318. @item size
  1319. Set video stream size. Only useful if curves option is activated.
  1320. @item mgain
  1321. Set max gain that will be displayed. Only useful if curves option is activated.
  1322. Setting this to a reasonable value makes it possible to display gain which is derived from
  1323. neighbour bands which are too close to each other and thus produce higher gain
  1324. when both are activated.
  1325. @item fscale
  1326. Set frequency scale used to draw frequency response in video output.
  1327. Can be linear or logarithmic. Default is logarithmic.
  1328. @item colors
  1329. Set color for each channel curve which is going to be displayed in video stream.
  1330. This is list of color names separated by space or by '|'.
  1331. Unrecognised or missing colors will be replaced by white color.
  1332. @end table
  1333. @subsection Examples
  1334. @itemize
  1335. @item
  1336. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1337. for first 2 channels using Chebyshev type 1 filter:
  1338. @example
  1339. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1340. @end example
  1341. @end itemize
  1342. @subsection Commands
  1343. This filter supports the following commands:
  1344. @table @option
  1345. @item change
  1346. Alter existing filter parameters.
  1347. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1348. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1349. error is returned.
  1350. @var{freq} set new frequency parameter.
  1351. @var{width} set new width parameter in herz.
  1352. @var{gain} set new gain parameter in dB.
  1353. Full filter invocation with asendcmd may look like this:
  1354. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1355. @end table
  1356. @section anlmdn
  1357. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1358. Each sample is adjusted by looking for other samples with similar contexts. This
  1359. context similarity is defined by comparing their surrounding patches of size
  1360. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1361. The filter accepts the following options.
  1362. @table @option
  1363. @item s
  1364. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1365. @item p
  1366. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1367. Default value is 2 milliseconds.
  1368. @item r
  1369. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1370. Default value is 6 milliseconds.
  1371. @item o
  1372. Set the output mode.
  1373. It accepts the following values:
  1374. @table @option
  1375. @item i
  1376. Pass input unchanged.
  1377. @item o
  1378. Pass noise filtered out.
  1379. @item n
  1380. Pass only noise.
  1381. Default value is @var{o}.
  1382. @end table
  1383. @item m
  1384. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1385. @end table
  1386. @subsection Commands
  1387. This filter supports the following commands:
  1388. @table @option
  1389. @item s
  1390. Change denoise strength. Argument is single float number.
  1391. Syntax for the command is : "@var{s}"
  1392. @item o
  1393. Change output mode.
  1394. Syntax for the command is : "i", "o" or "n" string.
  1395. @end table
  1396. @section anull
  1397. Pass the audio source unchanged to the output.
  1398. @section apad
  1399. Pad the end of an audio stream with silence.
  1400. This can be used together with @command{ffmpeg} @option{-shortest} to
  1401. extend audio streams to the same length as the video stream.
  1402. A description of the accepted options follows.
  1403. @table @option
  1404. @item packet_size
  1405. Set silence packet size. Default value is 4096.
  1406. @item pad_len
  1407. Set the number of samples of silence to add to the end. After the
  1408. value is reached, the stream is terminated. This option is mutually
  1409. exclusive with @option{whole_len}.
  1410. @item whole_len
  1411. Set the minimum total number of samples in the output audio stream. If
  1412. the value is longer than the input audio length, silence is added to
  1413. the end, until the value is reached. This option is mutually exclusive
  1414. with @option{pad_len}.
  1415. @item pad_dur
  1416. Specify the duration of samples of silence to add. See
  1417. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1418. for the accepted syntax. Used only if set to non-zero value.
  1419. @item whole_dur
  1420. Specify the minimum total duration in the output audio stream. See
  1421. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1422. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1423. the input audio length, silence is added to the end, until the value is reached.
  1424. This option is mutually exclusive with @option{pad_dur}
  1425. @end table
  1426. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1427. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1428. the input stream indefinitely.
  1429. @subsection Examples
  1430. @itemize
  1431. @item
  1432. Add 1024 samples of silence to the end of the input:
  1433. @example
  1434. apad=pad_len=1024
  1435. @end example
  1436. @item
  1437. Make sure the audio output will contain at least 10000 samples, pad
  1438. the input with silence if required:
  1439. @example
  1440. apad=whole_len=10000
  1441. @end example
  1442. @item
  1443. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1444. video stream will always result the shortest and will be converted
  1445. until the end in the output file when using the @option{shortest}
  1446. option:
  1447. @example
  1448. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1449. @end example
  1450. @end itemize
  1451. @section aphaser
  1452. Add a phasing effect to the input audio.
  1453. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1454. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1455. A description of the accepted parameters follows.
  1456. @table @option
  1457. @item in_gain
  1458. Set input gain. Default is 0.4.
  1459. @item out_gain
  1460. Set output gain. Default is 0.74
  1461. @item delay
  1462. Set delay in milliseconds. Default is 3.0.
  1463. @item decay
  1464. Set decay. Default is 0.4.
  1465. @item speed
  1466. Set modulation speed in Hz. Default is 0.5.
  1467. @item type
  1468. Set modulation type. Default is triangular.
  1469. It accepts the following values:
  1470. @table @samp
  1471. @item triangular, t
  1472. @item sinusoidal, s
  1473. @end table
  1474. @end table
  1475. @section apulsator
  1476. Audio pulsator is something between an autopanner and a tremolo.
  1477. But it can produce funny stereo effects as well. Pulsator changes the volume
  1478. of the left and right channel based on a LFO (low frequency oscillator) with
  1479. different waveforms and shifted phases.
  1480. This filter have the ability to define an offset between left and right
  1481. channel. An offset of 0 means that both LFO shapes match each other.
  1482. The left and right channel are altered equally - a conventional tremolo.
  1483. An offset of 50% means that the shape of the right channel is exactly shifted
  1484. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1485. an autopanner. At 1 both curves match again. Every setting in between moves the
  1486. phase shift gapless between all stages and produces some "bypassing" sounds with
  1487. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1488. the 0.5) the faster the signal passes from the left to the right speaker.
  1489. The filter accepts the following options:
  1490. @table @option
  1491. @item level_in
  1492. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1493. @item level_out
  1494. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1495. @item mode
  1496. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1497. sawup or sawdown. Default is sine.
  1498. @item amount
  1499. Set modulation. Define how much of original signal is affected by the LFO.
  1500. @item offset_l
  1501. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1502. @item offset_r
  1503. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1504. @item width
  1505. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1506. @item timing
  1507. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1508. @item bpm
  1509. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1510. is set to bpm.
  1511. @item ms
  1512. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1513. is set to ms.
  1514. @item hz
  1515. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1516. if timing is set to hz.
  1517. @end table
  1518. @anchor{aresample}
  1519. @section aresample
  1520. Resample the input audio to the specified parameters, using the
  1521. libswresample library. If none are specified then the filter will
  1522. automatically convert between its input and output.
  1523. This filter is also able to stretch/squeeze the audio data to make it match
  1524. the timestamps or to inject silence / cut out audio to make it match the
  1525. timestamps, do a combination of both or do neither.
  1526. The filter accepts the syntax
  1527. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1528. expresses a sample rate and @var{resampler_options} is a list of
  1529. @var{key}=@var{value} pairs, separated by ":". See the
  1530. @ref{Resampler Options,,"Resampler Options" section in the
  1531. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1532. for the complete list of supported options.
  1533. @subsection Examples
  1534. @itemize
  1535. @item
  1536. Resample the input audio to 44100Hz:
  1537. @example
  1538. aresample=44100
  1539. @end example
  1540. @item
  1541. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1542. samples per second compensation:
  1543. @example
  1544. aresample=async=1000
  1545. @end example
  1546. @end itemize
  1547. @section areverse
  1548. Reverse an audio clip.
  1549. Warning: This filter requires memory to buffer the entire clip, so trimming
  1550. is suggested.
  1551. @subsection Examples
  1552. @itemize
  1553. @item
  1554. Take the first 5 seconds of a clip, and reverse it.
  1555. @example
  1556. atrim=end=5,areverse
  1557. @end example
  1558. @end itemize
  1559. @section asetnsamples
  1560. Set the number of samples per each output audio frame.
  1561. The last output packet may contain a different number of samples, as
  1562. the filter will flush all the remaining samples when the input audio
  1563. signals its end.
  1564. The filter accepts the following options:
  1565. @table @option
  1566. @item nb_out_samples, n
  1567. Set the number of frames per each output audio frame. The number is
  1568. intended as the number of samples @emph{per each channel}.
  1569. Default value is 1024.
  1570. @item pad, p
  1571. If set to 1, the filter will pad the last audio frame with zeroes, so
  1572. that the last frame will contain the same number of samples as the
  1573. previous ones. Default value is 1.
  1574. @end table
  1575. For example, to set the number of per-frame samples to 1234 and
  1576. disable padding for the last frame, use:
  1577. @example
  1578. asetnsamples=n=1234:p=0
  1579. @end example
  1580. @section asetrate
  1581. Set the sample rate without altering the PCM data.
  1582. This will result in a change of speed and pitch.
  1583. The filter accepts the following options:
  1584. @table @option
  1585. @item sample_rate, r
  1586. Set the output sample rate. Default is 44100 Hz.
  1587. @end table
  1588. @section ashowinfo
  1589. Show a line containing various information for each input audio frame.
  1590. The input audio is not modified.
  1591. The shown line contains a sequence of key/value pairs of the form
  1592. @var{key}:@var{value}.
  1593. The following values are shown in the output:
  1594. @table @option
  1595. @item n
  1596. The (sequential) number of the input frame, starting from 0.
  1597. @item pts
  1598. The presentation timestamp of the input frame, in time base units; the time base
  1599. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1600. @item pts_time
  1601. The presentation timestamp of the input frame in seconds.
  1602. @item pos
  1603. position of the frame in the input stream, -1 if this information in
  1604. unavailable and/or meaningless (for example in case of synthetic audio)
  1605. @item fmt
  1606. The sample format.
  1607. @item chlayout
  1608. The channel layout.
  1609. @item rate
  1610. The sample rate for the audio frame.
  1611. @item nb_samples
  1612. The number of samples (per channel) in the frame.
  1613. @item checksum
  1614. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1615. audio, the data is treated as if all the planes were concatenated.
  1616. @item plane_checksums
  1617. A list of Adler-32 checksums for each data plane.
  1618. @end table
  1619. @section asoftclip
  1620. Apply audio soft clipping.
  1621. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1622. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1623. This filter accepts the following options:
  1624. @table @option
  1625. @item type
  1626. Set type of soft-clipping.
  1627. It accepts the following values:
  1628. @table @option
  1629. @item tanh
  1630. @item atan
  1631. @item cubic
  1632. @item exp
  1633. @item alg
  1634. @item quintic
  1635. @item sin
  1636. @end table
  1637. @item param
  1638. Set additional parameter which controls sigmoid function.
  1639. @end table
  1640. @section asr
  1641. Automatic Speech Recognition
  1642. This filter uses PocketSphinx for speech recognition. To enable
  1643. compilation of this filter, you need to configure FFmpeg with
  1644. @code{--enable-pocketsphinx}.
  1645. It accepts the following options:
  1646. @table @option
  1647. @item rate
  1648. Set sampling rate of input audio. Defaults is @code{16000}.
  1649. This need to match speech models, otherwise one will get poor results.
  1650. @item hmm
  1651. Set dictionary containing acoustic model files.
  1652. @item dict
  1653. Set pronunciation dictionary.
  1654. @item lm
  1655. Set language model file.
  1656. @item lmctl
  1657. Set language model set.
  1658. @item lmname
  1659. Set which language model to use.
  1660. @item logfn
  1661. Set output for log messages.
  1662. @end table
  1663. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1664. @anchor{astats}
  1665. @section astats
  1666. Display time domain statistical information about the audio channels.
  1667. Statistics are calculated and displayed for each audio channel and,
  1668. where applicable, an overall figure is also given.
  1669. It accepts the following option:
  1670. @table @option
  1671. @item length
  1672. Short window length in seconds, used for peak and trough RMS measurement.
  1673. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1674. @item metadata
  1675. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1676. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1677. disabled.
  1678. Available keys for each channel are:
  1679. DC_offset
  1680. Min_level
  1681. Max_level
  1682. Min_difference
  1683. Max_difference
  1684. Mean_difference
  1685. RMS_difference
  1686. Peak_level
  1687. RMS_peak
  1688. RMS_trough
  1689. Crest_factor
  1690. Flat_factor
  1691. Peak_count
  1692. Bit_depth
  1693. Dynamic_range
  1694. Zero_crossings
  1695. Zero_crossings_rate
  1696. Number_of_NaNs
  1697. Number_of_Infs
  1698. Number_of_denormals
  1699. and for Overall:
  1700. DC_offset
  1701. Min_level
  1702. Max_level
  1703. Min_difference
  1704. Max_difference
  1705. Mean_difference
  1706. RMS_difference
  1707. Peak_level
  1708. RMS_level
  1709. RMS_peak
  1710. RMS_trough
  1711. Flat_factor
  1712. Peak_count
  1713. Bit_depth
  1714. Number_of_samples
  1715. Number_of_NaNs
  1716. Number_of_Infs
  1717. Number_of_denormals
  1718. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1719. this @code{lavfi.astats.Overall.Peak_count}.
  1720. For description what each key means read below.
  1721. @item reset
  1722. Set number of frame after which stats are going to be recalculated.
  1723. Default is disabled.
  1724. @item measure_perchannel
  1725. Select the entries which need to be measured per channel. The metadata keys can
  1726. be used as flags, default is @option{all} which measures everything.
  1727. @option{none} disables all per channel measurement.
  1728. @item measure_overall
  1729. Select the entries which need to be measured overall. The metadata keys can
  1730. be used as flags, default is @option{all} which measures everything.
  1731. @option{none} disables all overall measurement.
  1732. @end table
  1733. A description of each shown parameter follows:
  1734. @table @option
  1735. @item DC offset
  1736. Mean amplitude displacement from zero.
  1737. @item Min level
  1738. Minimal sample level.
  1739. @item Max level
  1740. Maximal sample level.
  1741. @item Min difference
  1742. Minimal difference between two consecutive samples.
  1743. @item Max difference
  1744. Maximal difference between two consecutive samples.
  1745. @item Mean difference
  1746. Mean difference between two consecutive samples.
  1747. The average of each difference between two consecutive samples.
  1748. @item RMS difference
  1749. Root Mean Square difference between two consecutive samples.
  1750. @item Peak level dB
  1751. @item RMS level dB
  1752. Standard peak and RMS level measured in dBFS.
  1753. @item RMS peak dB
  1754. @item RMS trough dB
  1755. Peak and trough values for RMS level measured over a short window.
  1756. @item Crest factor
  1757. Standard ratio of peak to RMS level (note: not in dB).
  1758. @item Flat factor
  1759. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1760. (i.e. either @var{Min level} or @var{Max level}).
  1761. @item Peak count
  1762. Number of occasions (not the number of samples) that the signal attained either
  1763. @var{Min level} or @var{Max level}.
  1764. @item Bit depth
  1765. Overall bit depth of audio. Number of bits used for each sample.
  1766. @item Dynamic range
  1767. Measured dynamic range of audio in dB.
  1768. @item Zero crossings
  1769. Number of points where the waveform crosses the zero level axis.
  1770. @item Zero crossings rate
  1771. Rate of Zero crossings and number of audio samples.
  1772. @end table
  1773. @section atempo
  1774. Adjust audio tempo.
  1775. The filter accepts exactly one parameter, the audio tempo. If not
  1776. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1777. be in the [0.5, 100.0] range.
  1778. Note that tempo greater than 2 will skip some samples rather than
  1779. blend them in. If for any reason this is a concern it is always
  1780. possible to daisy-chain several instances of atempo to achieve the
  1781. desired product tempo.
  1782. @subsection Examples
  1783. @itemize
  1784. @item
  1785. Slow down audio to 80% tempo:
  1786. @example
  1787. atempo=0.8
  1788. @end example
  1789. @item
  1790. To speed up audio to 300% tempo:
  1791. @example
  1792. atempo=3
  1793. @end example
  1794. @item
  1795. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1796. @example
  1797. atempo=sqrt(3),atempo=sqrt(3)
  1798. @end example
  1799. @end itemize
  1800. @section atrim
  1801. Trim the input so that the output contains one continuous subpart of the input.
  1802. It accepts the following parameters:
  1803. @table @option
  1804. @item start
  1805. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1806. sample with the timestamp @var{start} will be the first sample in the output.
  1807. @item end
  1808. Specify time of the first audio sample that will be dropped, i.e. the
  1809. audio sample immediately preceding the one with the timestamp @var{end} will be
  1810. the last sample in the output.
  1811. @item start_pts
  1812. Same as @var{start}, except this option sets the start timestamp in samples
  1813. instead of seconds.
  1814. @item end_pts
  1815. Same as @var{end}, except this option sets the end timestamp in samples instead
  1816. of seconds.
  1817. @item duration
  1818. The maximum duration of the output in seconds.
  1819. @item start_sample
  1820. The number of the first sample that should be output.
  1821. @item end_sample
  1822. The number of the first sample that should be dropped.
  1823. @end table
  1824. @option{start}, @option{end}, and @option{duration} are expressed as time
  1825. duration specifications; see
  1826. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1827. Note that the first two sets of the start/end options and the @option{duration}
  1828. option look at the frame timestamp, while the _sample options simply count the
  1829. samples that pass through the filter. So start/end_pts and start/end_sample will
  1830. give different results when the timestamps are wrong, inexact or do not start at
  1831. zero. Also note that this filter does not modify the timestamps. If you wish
  1832. to have the output timestamps start at zero, insert the asetpts filter after the
  1833. atrim filter.
  1834. If multiple start or end options are set, this filter tries to be greedy and
  1835. keep all samples that match at least one of the specified constraints. To keep
  1836. only the part that matches all the constraints at once, chain multiple atrim
  1837. filters.
  1838. The defaults are such that all the input is kept. So it is possible to set e.g.
  1839. just the end values to keep everything before the specified time.
  1840. Examples:
  1841. @itemize
  1842. @item
  1843. Drop everything except the second minute of input:
  1844. @example
  1845. ffmpeg -i INPUT -af atrim=60:120
  1846. @end example
  1847. @item
  1848. Keep only the first 1000 samples:
  1849. @example
  1850. ffmpeg -i INPUT -af atrim=end_sample=1000
  1851. @end example
  1852. @end itemize
  1853. @section bandpass
  1854. Apply a two-pole Butterworth band-pass filter with central
  1855. frequency @var{frequency}, and (3dB-point) band-width width.
  1856. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1857. instead of the default: constant 0dB peak gain.
  1858. The filter roll off at 6dB per octave (20dB per decade).
  1859. The filter accepts the following options:
  1860. @table @option
  1861. @item frequency, f
  1862. Set the filter's central frequency. Default is @code{3000}.
  1863. @item csg
  1864. Constant skirt gain if set to 1. Defaults to 0.
  1865. @item width_type, t
  1866. Set method to specify band-width of filter.
  1867. @table @option
  1868. @item h
  1869. Hz
  1870. @item q
  1871. Q-Factor
  1872. @item o
  1873. octave
  1874. @item s
  1875. slope
  1876. @item k
  1877. kHz
  1878. @end table
  1879. @item width, w
  1880. Specify the band-width of a filter in width_type units.
  1881. @item channels, c
  1882. Specify which channels to filter, by default all available are filtered.
  1883. @end table
  1884. @subsection Commands
  1885. This filter supports the following commands:
  1886. @table @option
  1887. @item frequency, f
  1888. Change bandpass frequency.
  1889. Syntax for the command is : "@var{frequency}"
  1890. @item width_type, t
  1891. Change bandpass width_type.
  1892. Syntax for the command is : "@var{width_type}"
  1893. @item width, w
  1894. Change bandpass width.
  1895. Syntax for the command is : "@var{width}"
  1896. @end table
  1897. @section bandreject
  1898. Apply a two-pole Butterworth band-reject filter with central
  1899. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1900. The filter roll off at 6dB per octave (20dB per decade).
  1901. The filter accepts the following options:
  1902. @table @option
  1903. @item frequency, f
  1904. Set the filter's central frequency. Default is @code{3000}.
  1905. @item width_type, t
  1906. Set method to specify band-width of filter.
  1907. @table @option
  1908. @item h
  1909. Hz
  1910. @item q
  1911. Q-Factor
  1912. @item o
  1913. octave
  1914. @item s
  1915. slope
  1916. @item k
  1917. kHz
  1918. @end table
  1919. @item width, w
  1920. Specify the band-width of a filter in width_type units.
  1921. @item channels, c
  1922. Specify which channels to filter, by default all available are filtered.
  1923. @end table
  1924. @subsection Commands
  1925. This filter supports the following commands:
  1926. @table @option
  1927. @item frequency, f
  1928. Change bandreject frequency.
  1929. Syntax for the command is : "@var{frequency}"
  1930. @item width_type, t
  1931. Change bandreject width_type.
  1932. Syntax for the command is : "@var{width_type}"
  1933. @item width, w
  1934. Change bandreject width.
  1935. Syntax for the command is : "@var{width}"
  1936. @end table
  1937. @section bass, lowshelf
  1938. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1939. shelving filter with a response similar to that of a standard
  1940. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1941. The filter accepts the following options:
  1942. @table @option
  1943. @item gain, g
  1944. Give the gain at 0 Hz. Its useful range is about -20
  1945. (for a large cut) to +20 (for a large boost).
  1946. Beware of clipping when using a positive gain.
  1947. @item frequency, f
  1948. Set the filter's central frequency and so can be used
  1949. to extend or reduce the frequency range to be boosted or cut.
  1950. The default value is @code{100} Hz.
  1951. @item width_type, t
  1952. Set method to specify band-width of filter.
  1953. @table @option
  1954. @item h
  1955. Hz
  1956. @item q
  1957. Q-Factor
  1958. @item o
  1959. octave
  1960. @item s
  1961. slope
  1962. @item k
  1963. kHz
  1964. @end table
  1965. @item width, w
  1966. Determine how steep is the filter's shelf transition.
  1967. @item channels, c
  1968. Specify which channels to filter, by default all available are filtered.
  1969. @end table
  1970. @subsection Commands
  1971. This filter supports the following commands:
  1972. @table @option
  1973. @item frequency, f
  1974. Change bass frequency.
  1975. Syntax for the command is : "@var{frequency}"
  1976. @item width_type, t
  1977. Change bass width_type.
  1978. Syntax for the command is : "@var{width_type}"
  1979. @item width, w
  1980. Change bass width.
  1981. Syntax for the command is : "@var{width}"
  1982. @item gain, g
  1983. Change bass gain.
  1984. Syntax for the command is : "@var{gain}"
  1985. @end table
  1986. @section biquad
  1987. Apply a biquad IIR filter with the given coefficients.
  1988. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1989. are the numerator and denominator coefficients respectively.
  1990. and @var{channels}, @var{c} specify which channels to filter, by default all
  1991. available are filtered.
  1992. @subsection Commands
  1993. This filter supports the following commands:
  1994. @table @option
  1995. @item a0
  1996. @item a1
  1997. @item a2
  1998. @item b0
  1999. @item b1
  2000. @item b2
  2001. Change biquad parameter.
  2002. Syntax for the command is : "@var{value}"
  2003. @end table
  2004. @section bs2b
  2005. Bauer stereo to binaural transformation, which improves headphone listening of
  2006. stereo audio records.
  2007. To enable compilation of this filter you need to configure FFmpeg with
  2008. @code{--enable-libbs2b}.
  2009. It accepts the following parameters:
  2010. @table @option
  2011. @item profile
  2012. Pre-defined crossfeed level.
  2013. @table @option
  2014. @item default
  2015. Default level (fcut=700, feed=50).
  2016. @item cmoy
  2017. Chu Moy circuit (fcut=700, feed=60).
  2018. @item jmeier
  2019. Jan Meier circuit (fcut=650, feed=95).
  2020. @end table
  2021. @item fcut
  2022. Cut frequency (in Hz).
  2023. @item feed
  2024. Feed level (in Hz).
  2025. @end table
  2026. @section channelmap
  2027. Remap input channels to new locations.
  2028. It accepts the following parameters:
  2029. @table @option
  2030. @item map
  2031. Map channels from input to output. The argument is a '|'-separated list of
  2032. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2033. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2034. channel (e.g. FL for front left) or its index in the input channel layout.
  2035. @var{out_channel} is the name of the output channel or its index in the output
  2036. channel layout. If @var{out_channel} is not given then it is implicitly an
  2037. index, starting with zero and increasing by one for each mapping.
  2038. @item channel_layout
  2039. The channel layout of the output stream.
  2040. @end table
  2041. If no mapping is present, the filter will implicitly map input channels to
  2042. output channels, preserving indices.
  2043. @subsection Examples
  2044. @itemize
  2045. @item
  2046. For example, assuming a 5.1+downmix input MOV file,
  2047. @example
  2048. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2049. @end example
  2050. will create an output WAV file tagged as stereo from the downmix channels of
  2051. the input.
  2052. @item
  2053. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2054. @example
  2055. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2056. @end example
  2057. @end itemize
  2058. @section channelsplit
  2059. Split each channel from an input audio stream into a separate output stream.
  2060. It accepts the following parameters:
  2061. @table @option
  2062. @item channel_layout
  2063. The channel layout of the input stream. The default is "stereo".
  2064. @item channels
  2065. A channel layout describing the channels to be extracted as separate output streams
  2066. or "all" to extract each input channel as a separate stream. The default is "all".
  2067. Choosing channels not present in channel layout in the input will result in an error.
  2068. @end table
  2069. @subsection Examples
  2070. @itemize
  2071. @item
  2072. For example, assuming a stereo input MP3 file,
  2073. @example
  2074. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2075. @end example
  2076. will create an output Matroska file with two audio streams, one containing only
  2077. the left channel and the other the right channel.
  2078. @item
  2079. Split a 5.1 WAV file into per-channel files:
  2080. @example
  2081. ffmpeg -i in.wav -filter_complex
  2082. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2083. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2084. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2085. side_right.wav
  2086. @end example
  2087. @item
  2088. Extract only LFE from a 5.1 WAV file:
  2089. @example
  2090. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2091. -map '[LFE]' lfe.wav
  2092. @end example
  2093. @end itemize
  2094. @section chorus
  2095. Add a chorus effect to the audio.
  2096. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2097. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2098. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2099. The modulation depth defines the range the modulated delay is played before or after
  2100. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2101. sound tuned around the original one, like in a chorus where some vocals are slightly
  2102. off key.
  2103. It accepts the following parameters:
  2104. @table @option
  2105. @item in_gain
  2106. Set input gain. Default is 0.4.
  2107. @item out_gain
  2108. Set output gain. Default is 0.4.
  2109. @item delays
  2110. Set delays. A typical delay is around 40ms to 60ms.
  2111. @item decays
  2112. Set decays.
  2113. @item speeds
  2114. Set speeds.
  2115. @item depths
  2116. Set depths.
  2117. @end table
  2118. @subsection Examples
  2119. @itemize
  2120. @item
  2121. A single delay:
  2122. @example
  2123. chorus=0.7:0.9:55:0.4:0.25:2
  2124. @end example
  2125. @item
  2126. Two delays:
  2127. @example
  2128. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2129. @end example
  2130. @item
  2131. Fuller sounding chorus with three delays:
  2132. @example
  2133. 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
  2134. @end example
  2135. @end itemize
  2136. @section compand
  2137. Compress or expand the audio's dynamic range.
  2138. It accepts the following parameters:
  2139. @table @option
  2140. @item attacks
  2141. @item decays
  2142. A list of times in seconds for each channel over which the instantaneous level
  2143. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2144. increase of volume and @var{decays} refers to decrease of volume. For most
  2145. situations, the attack time (response to the audio getting louder) should be
  2146. shorter than the decay time, because the human ear is more sensitive to sudden
  2147. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2148. a typical value for decay is 0.8 seconds.
  2149. If specified number of attacks & decays is lower than number of channels, the last
  2150. set attack/decay will be used for all remaining channels.
  2151. @item points
  2152. A list of points for the transfer function, specified in dB relative to the
  2153. maximum possible signal amplitude. Each key points list must be defined using
  2154. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2155. @code{x0/y0 x1/y1 x2/y2 ....}
  2156. The input values must be in strictly increasing order but the transfer function
  2157. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2158. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2159. function are @code{-70/-70|-60/-20|1/0}.
  2160. @item soft-knee
  2161. Set the curve radius in dB for all joints. It defaults to 0.01.
  2162. @item gain
  2163. Set the additional gain in dB to be applied at all points on the transfer
  2164. function. This allows for easy adjustment of the overall gain.
  2165. It defaults to 0.
  2166. @item volume
  2167. Set an initial volume, in dB, to be assumed for each channel when filtering
  2168. starts. This permits the user to supply a nominal level initially, so that, for
  2169. example, a very large gain is not applied to initial signal levels before the
  2170. companding has begun to operate. A typical value for audio which is initially
  2171. quiet is -90 dB. It defaults to 0.
  2172. @item delay
  2173. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2174. delayed before being fed to the volume adjuster. Specifying a delay
  2175. approximately equal to the attack/decay times allows the filter to effectively
  2176. operate in predictive rather than reactive mode. It defaults to 0.
  2177. @end table
  2178. @subsection Examples
  2179. @itemize
  2180. @item
  2181. Make music with both quiet and loud passages suitable for listening to in a
  2182. noisy environment:
  2183. @example
  2184. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2185. @end example
  2186. Another example for audio with whisper and explosion parts:
  2187. @example
  2188. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2189. @end example
  2190. @item
  2191. A noise gate for when the noise is at a lower level than the signal:
  2192. @example
  2193. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2194. @end example
  2195. @item
  2196. Here is another noise gate, this time for when the noise is at a higher level
  2197. than the signal (making it, in some ways, similar to squelch):
  2198. @example
  2199. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2200. @end example
  2201. @item
  2202. 2:1 compression starting at -6dB:
  2203. @example
  2204. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2205. @end example
  2206. @item
  2207. 2:1 compression starting at -9dB:
  2208. @example
  2209. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2210. @end example
  2211. @item
  2212. 2:1 compression starting at -12dB:
  2213. @example
  2214. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2215. @end example
  2216. @item
  2217. 2:1 compression starting at -18dB:
  2218. @example
  2219. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2220. @end example
  2221. @item
  2222. 3:1 compression starting at -15dB:
  2223. @example
  2224. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2225. @end example
  2226. @item
  2227. Compressor/Gate:
  2228. @example
  2229. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2230. @end example
  2231. @item
  2232. Expander:
  2233. @example
  2234. 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
  2235. @end example
  2236. @item
  2237. Hard limiter at -6dB:
  2238. @example
  2239. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2240. @end example
  2241. @item
  2242. Hard limiter at -12dB:
  2243. @example
  2244. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2245. @end example
  2246. @item
  2247. Hard noise gate at -35 dB:
  2248. @example
  2249. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2250. @end example
  2251. @item
  2252. Soft limiter:
  2253. @example
  2254. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2255. @end example
  2256. @end itemize
  2257. @section compensationdelay
  2258. Compensation Delay Line is a metric based delay to compensate differing
  2259. positions of microphones or speakers.
  2260. For example, you have recorded guitar with two microphones placed in
  2261. different location. Because the front of sound wave has fixed speed in
  2262. normal conditions, the phasing of microphones can vary and depends on
  2263. their location and interposition. The best sound mix can be achieved when
  2264. these microphones are in phase (synchronized). Note that distance of
  2265. ~30 cm between microphones makes one microphone to capture signal in
  2266. antiphase to another microphone. That makes the final mix sounding moody.
  2267. This filter helps to solve phasing problems by adding different delays
  2268. to each microphone track and make them synchronized.
  2269. The best result can be reached when you take one track as base and
  2270. synchronize other tracks one by one with it.
  2271. Remember that synchronization/delay tolerance depends on sample rate, too.
  2272. Higher sample rates will give more tolerance.
  2273. It accepts the following parameters:
  2274. @table @option
  2275. @item mm
  2276. Set millimeters distance. This is compensation distance for fine tuning.
  2277. Default is 0.
  2278. @item cm
  2279. Set cm distance. This is compensation distance for tightening distance setup.
  2280. Default is 0.
  2281. @item m
  2282. Set meters distance. This is compensation distance for hard distance setup.
  2283. Default is 0.
  2284. @item dry
  2285. Set dry amount. Amount of unprocessed (dry) signal.
  2286. Default is 0.
  2287. @item wet
  2288. Set wet amount. Amount of processed (wet) signal.
  2289. Default is 1.
  2290. @item temp
  2291. Set temperature degree in Celsius. This is the temperature of the environment.
  2292. Default is 20.
  2293. @end table
  2294. @section crossfeed
  2295. Apply headphone crossfeed filter.
  2296. Crossfeed is the process of blending the left and right channels of stereo
  2297. audio recording.
  2298. It is mainly used to reduce extreme stereo separation of low frequencies.
  2299. The intent is to produce more speaker like sound to the listener.
  2300. The filter accepts the following options:
  2301. @table @option
  2302. @item strength
  2303. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2304. This sets gain of low shelf filter for side part of stereo image.
  2305. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2306. @item range
  2307. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2308. This sets cut off frequency of low shelf filter. Default is cut off near
  2309. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2310. @item level_in
  2311. Set input gain. Default is 0.9.
  2312. @item level_out
  2313. Set output gain. Default is 1.
  2314. @end table
  2315. @section crystalizer
  2316. Simple algorithm to expand audio dynamic range.
  2317. The filter accepts the following options:
  2318. @table @option
  2319. @item i
  2320. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2321. (unchanged sound) to 10.0 (maximum effect).
  2322. @item c
  2323. Enable clipping. By default is enabled.
  2324. @end table
  2325. @section dcshift
  2326. Apply a DC shift to the audio.
  2327. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2328. in the recording chain) from the audio. The effect of a DC offset is reduced
  2329. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2330. a signal has a DC offset.
  2331. @table @option
  2332. @item shift
  2333. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2334. the audio.
  2335. @item limitergain
  2336. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2337. used to prevent clipping.
  2338. @end table
  2339. @section deesser
  2340. Apply de-essing to the audio samples.
  2341. @table @option
  2342. @item i
  2343. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2344. Default is 0.
  2345. @item m
  2346. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2347. Default is 0.5.
  2348. @item f
  2349. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2350. Default is 0.5.
  2351. @item s
  2352. Set the output mode.
  2353. It accepts the following values:
  2354. @table @option
  2355. @item i
  2356. Pass input unchanged.
  2357. @item o
  2358. Pass ess filtered out.
  2359. @item e
  2360. Pass only ess.
  2361. Default value is @var{o}.
  2362. @end table
  2363. @end table
  2364. @section drmeter
  2365. Measure audio dynamic range.
  2366. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2367. is found in transition material. And anything less that 8 have very poor dynamics
  2368. and is very compressed.
  2369. The filter accepts the following options:
  2370. @table @option
  2371. @item length
  2372. Set window length in seconds used to split audio into segments of equal length.
  2373. Default is 3 seconds.
  2374. @end table
  2375. @section dynaudnorm
  2376. Dynamic Audio Normalizer.
  2377. This filter applies a certain amount of gain to the input audio in order
  2378. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2379. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2380. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2381. This allows for applying extra gain to the "quiet" sections of the audio
  2382. while avoiding distortions or clipping the "loud" sections. In other words:
  2383. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2384. sections, in the sense that the volume of each section is brought to the
  2385. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2386. this goal *without* applying "dynamic range compressing". It will retain 100%
  2387. of the dynamic range *within* each section of the audio file.
  2388. @table @option
  2389. @item f
  2390. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2391. Default is 500 milliseconds.
  2392. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2393. referred to as frames. This is required, because a peak magnitude has no
  2394. meaning for just a single sample value. Instead, we need to determine the
  2395. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2396. normalizer would simply use the peak magnitude of the complete file, the
  2397. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2398. frame. The length of a frame is specified in milliseconds. By default, the
  2399. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2400. been found to give good results with most files.
  2401. Note that the exact frame length, in number of samples, will be determined
  2402. automatically, based on the sampling rate of the individual input audio file.
  2403. @item g
  2404. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2405. number. Default is 31.
  2406. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2407. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2408. is specified in frames, centered around the current frame. For the sake of
  2409. simplicity, this must be an odd number. Consequently, the default value of 31
  2410. takes into account the current frame, as well as the 15 preceding frames and
  2411. the 15 subsequent frames. Using a larger window results in a stronger
  2412. smoothing effect and thus in less gain variation, i.e. slower gain
  2413. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2414. effect and thus in more gain variation, i.e. faster gain adaptation.
  2415. In other words, the more you increase this value, the more the Dynamic Audio
  2416. Normalizer will behave like a "traditional" normalization filter. On the
  2417. contrary, the more you decrease this value, the more the Dynamic Audio
  2418. Normalizer will behave like a dynamic range compressor.
  2419. @item p
  2420. Set the target peak value. This specifies the highest permissible magnitude
  2421. level for the normalized audio input. This filter will try to approach the
  2422. target peak magnitude as closely as possible, but at the same time it also
  2423. makes sure that the normalized signal will never exceed the peak magnitude.
  2424. A frame's maximum local gain factor is imposed directly by the target peak
  2425. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2426. It is not recommended to go above this value.
  2427. @item m
  2428. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2429. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2430. factor for each input frame, i.e. the maximum gain factor that does not
  2431. result in clipping or distortion. The maximum gain factor is determined by
  2432. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2433. additionally bounds the frame's maximum gain factor by a predetermined
  2434. (global) maximum gain factor. This is done in order to avoid excessive gain
  2435. factors in "silent" or almost silent frames. By default, the maximum gain
  2436. factor is 10.0, For most inputs the default value should be sufficient and
  2437. it usually is not recommended to increase this value. Though, for input
  2438. with an extremely low overall volume level, it may be necessary to allow even
  2439. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2440. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2441. Instead, a "sigmoid" threshold function will be applied. This way, the
  2442. gain factors will smoothly approach the threshold value, but never exceed that
  2443. value.
  2444. @item r
  2445. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2446. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2447. This means that the maximum local gain factor for each frame is defined
  2448. (only) by the frame's highest magnitude sample. This way, the samples can
  2449. be amplified as much as possible without exceeding the maximum signal
  2450. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2451. Normalizer can also take into account the frame's root mean square,
  2452. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2453. determine the power of a time-varying signal. It is therefore considered
  2454. that the RMS is a better approximation of the "perceived loudness" than
  2455. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2456. frames to a constant RMS value, a uniform "perceived loudness" can be
  2457. established. If a target RMS value has been specified, a frame's local gain
  2458. factor is defined as the factor that would result in exactly that RMS value.
  2459. Note, however, that the maximum local gain factor is still restricted by the
  2460. frame's highest magnitude sample, in order to prevent clipping.
  2461. @item n
  2462. Enable channels coupling. By default is enabled.
  2463. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2464. amount. This means the same gain factor will be applied to all channels, i.e.
  2465. the maximum possible gain factor is determined by the "loudest" channel.
  2466. However, in some recordings, it may happen that the volume of the different
  2467. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2468. In this case, this option can be used to disable the channel coupling. This way,
  2469. the gain factor will be determined independently for each channel, depending
  2470. only on the individual channel's highest magnitude sample. This allows for
  2471. harmonizing the volume of the different channels.
  2472. @item c
  2473. Enable DC bias correction. By default is disabled.
  2474. An audio signal (in the time domain) is a sequence of sample values.
  2475. In the Dynamic Audio Normalizer these sample values are represented in the
  2476. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2477. audio signal, or "waveform", should be centered around the zero point.
  2478. That means if we calculate the mean value of all samples in a file, or in a
  2479. single frame, then the result should be 0.0 or at least very close to that
  2480. value. If, however, there is a significant deviation of the mean value from
  2481. 0.0, in either positive or negative direction, this is referred to as a
  2482. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2483. Audio Normalizer provides optional DC bias correction.
  2484. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2485. the mean value, or "DC correction" offset, of each input frame and subtract
  2486. that value from all of the frame's sample values which ensures those samples
  2487. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2488. boundaries, the DC correction offset values will be interpolated smoothly
  2489. between neighbouring frames.
  2490. @item b
  2491. Enable alternative boundary mode. By default is disabled.
  2492. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2493. around each frame. This includes the preceding frames as well as the
  2494. subsequent frames. However, for the "boundary" frames, located at the very
  2495. beginning and at the very end of the audio file, not all neighbouring
  2496. frames are available. In particular, for the first few frames in the audio
  2497. file, the preceding frames are not known. And, similarly, for the last few
  2498. frames in the audio file, the subsequent frames are not known. Thus, the
  2499. question arises which gain factors should be assumed for the missing frames
  2500. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2501. to deal with this situation. The default boundary mode assumes a gain factor
  2502. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2503. "fade out" at the beginning and at the end of the input, respectively.
  2504. @item s
  2505. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2506. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2507. compression. This means that signal peaks will not be pruned and thus the
  2508. full dynamic range will be retained within each local neighbourhood. However,
  2509. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2510. normalization algorithm with a more "traditional" compression.
  2511. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2512. (thresholding) function. If (and only if) the compression feature is enabled,
  2513. all input frames will be processed by a soft knee thresholding function prior
  2514. to the actual normalization process. Put simply, the thresholding function is
  2515. going to prune all samples whose magnitude exceeds a certain threshold value.
  2516. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2517. value. Instead, the threshold value will be adjusted for each individual
  2518. frame.
  2519. In general, smaller parameters result in stronger compression, and vice versa.
  2520. Values below 3.0 are not recommended, because audible distortion may appear.
  2521. @end table
  2522. @section earwax
  2523. Make audio easier to listen to on headphones.
  2524. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2525. so that when listened to on headphones the stereo image is moved from
  2526. inside your head (standard for headphones) to outside and in front of
  2527. the listener (standard for speakers).
  2528. Ported from SoX.
  2529. @section equalizer
  2530. Apply a two-pole peaking equalisation (EQ) filter. With this
  2531. filter, the signal-level at and around a selected frequency can
  2532. be increased or decreased, whilst (unlike bandpass and bandreject
  2533. filters) that at all other frequencies is unchanged.
  2534. In order to produce complex equalisation curves, this filter can
  2535. be given several times, each with a different central frequency.
  2536. The filter accepts the following options:
  2537. @table @option
  2538. @item frequency, f
  2539. Set the filter's central frequency in Hz.
  2540. @item width_type, t
  2541. Set method to specify band-width of filter.
  2542. @table @option
  2543. @item h
  2544. Hz
  2545. @item q
  2546. Q-Factor
  2547. @item o
  2548. octave
  2549. @item s
  2550. slope
  2551. @item k
  2552. kHz
  2553. @end table
  2554. @item width, w
  2555. Specify the band-width of a filter in width_type units.
  2556. @item gain, g
  2557. Set the required gain or attenuation in dB.
  2558. Beware of clipping when using a positive gain.
  2559. @item channels, c
  2560. Specify which channels to filter, by default all available are filtered.
  2561. @end table
  2562. @subsection Examples
  2563. @itemize
  2564. @item
  2565. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2566. @example
  2567. equalizer=f=1000:t=h:width=200:g=-10
  2568. @end example
  2569. @item
  2570. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2571. @example
  2572. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2573. @end example
  2574. @end itemize
  2575. @subsection Commands
  2576. This filter supports the following commands:
  2577. @table @option
  2578. @item frequency, f
  2579. Change equalizer frequency.
  2580. Syntax for the command is : "@var{frequency}"
  2581. @item width_type, t
  2582. Change equalizer width_type.
  2583. Syntax for the command is : "@var{width_type}"
  2584. @item width, w
  2585. Change equalizer width.
  2586. Syntax for the command is : "@var{width}"
  2587. @item gain, g
  2588. Change equalizer gain.
  2589. Syntax for the command is : "@var{gain}"
  2590. @end table
  2591. @section extrastereo
  2592. Linearly increases the difference between left and right channels which
  2593. adds some sort of "live" effect to playback.
  2594. The filter accepts the following options:
  2595. @table @option
  2596. @item m
  2597. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2598. (average of both channels), with 1.0 sound will be unchanged, with
  2599. -1.0 left and right channels will be swapped.
  2600. @item c
  2601. Enable clipping. By default is enabled.
  2602. @end table
  2603. @section firequalizer
  2604. Apply FIR Equalization using arbitrary frequency response.
  2605. The filter accepts the following option:
  2606. @table @option
  2607. @item gain
  2608. Set gain curve equation (in dB). The expression can contain variables:
  2609. @table @option
  2610. @item f
  2611. the evaluated frequency
  2612. @item sr
  2613. sample rate
  2614. @item ch
  2615. channel number, set to 0 when multichannels evaluation is disabled
  2616. @item chid
  2617. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2618. multichannels evaluation is disabled
  2619. @item chs
  2620. number of channels
  2621. @item chlayout
  2622. channel_layout, see libavutil/channel_layout.h
  2623. @end table
  2624. and functions:
  2625. @table @option
  2626. @item gain_interpolate(f)
  2627. interpolate gain on frequency f based on gain_entry
  2628. @item cubic_interpolate(f)
  2629. same as gain_interpolate, but smoother
  2630. @end table
  2631. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2632. @item gain_entry
  2633. Set gain entry for gain_interpolate function. The expression can
  2634. contain functions:
  2635. @table @option
  2636. @item entry(f, g)
  2637. store gain entry at frequency f with value g
  2638. @end table
  2639. This option is also available as command.
  2640. @item delay
  2641. Set filter delay in seconds. Higher value means more accurate.
  2642. Default is @code{0.01}.
  2643. @item accuracy
  2644. Set filter accuracy in Hz. Lower value means more accurate.
  2645. Default is @code{5}.
  2646. @item wfunc
  2647. Set window function. Acceptable values are:
  2648. @table @option
  2649. @item rectangular
  2650. rectangular window, useful when gain curve is already smooth
  2651. @item hann
  2652. hann window (default)
  2653. @item hamming
  2654. hamming window
  2655. @item blackman
  2656. blackman window
  2657. @item nuttall3
  2658. 3-terms continuous 1st derivative nuttall window
  2659. @item mnuttall3
  2660. minimum 3-terms discontinuous nuttall window
  2661. @item nuttall
  2662. 4-terms continuous 1st derivative nuttall window
  2663. @item bnuttall
  2664. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2665. @item bharris
  2666. blackman-harris window
  2667. @item tukey
  2668. tukey window
  2669. @end table
  2670. @item fixed
  2671. If enabled, use fixed number of audio samples. This improves speed when
  2672. filtering with large delay. Default is disabled.
  2673. @item multi
  2674. Enable multichannels evaluation on gain. Default is disabled.
  2675. @item zero_phase
  2676. Enable zero phase mode by subtracting timestamp to compensate delay.
  2677. Default is disabled.
  2678. @item scale
  2679. Set scale used by gain. Acceptable values are:
  2680. @table @option
  2681. @item linlin
  2682. linear frequency, linear gain
  2683. @item linlog
  2684. linear frequency, logarithmic (in dB) gain (default)
  2685. @item loglin
  2686. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2687. @item loglog
  2688. logarithmic frequency, logarithmic gain
  2689. @end table
  2690. @item dumpfile
  2691. Set file for dumping, suitable for gnuplot.
  2692. @item dumpscale
  2693. Set scale for dumpfile. Acceptable values are same with scale option.
  2694. Default is linlog.
  2695. @item fft2
  2696. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2697. Default is disabled.
  2698. @item min_phase
  2699. Enable minimum phase impulse response. Default is disabled.
  2700. @end table
  2701. @subsection Examples
  2702. @itemize
  2703. @item
  2704. lowpass at 1000 Hz:
  2705. @example
  2706. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2707. @end example
  2708. @item
  2709. lowpass at 1000 Hz with gain_entry:
  2710. @example
  2711. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2712. @end example
  2713. @item
  2714. custom equalization:
  2715. @example
  2716. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2717. @end example
  2718. @item
  2719. higher delay with zero phase to compensate delay:
  2720. @example
  2721. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2722. @end example
  2723. @item
  2724. lowpass on left channel, highpass on right channel:
  2725. @example
  2726. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2727. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2728. @end example
  2729. @end itemize
  2730. @section flanger
  2731. Apply a flanging effect to the audio.
  2732. The filter accepts the following options:
  2733. @table @option
  2734. @item delay
  2735. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2736. @item depth
  2737. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2738. @item regen
  2739. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2740. Default value is 0.
  2741. @item width
  2742. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2743. Default value is 71.
  2744. @item speed
  2745. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2746. @item shape
  2747. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2748. Default value is @var{sinusoidal}.
  2749. @item phase
  2750. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2751. Default value is 25.
  2752. @item interp
  2753. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2754. Default is @var{linear}.
  2755. @end table
  2756. @section haas
  2757. Apply Haas effect to audio.
  2758. Note that this makes most sense to apply on mono signals.
  2759. With this filter applied to mono signals it give some directionality and
  2760. stretches its stereo image.
  2761. The filter accepts the following options:
  2762. @table @option
  2763. @item level_in
  2764. Set input level. By default is @var{1}, or 0dB
  2765. @item level_out
  2766. Set output level. By default is @var{1}, or 0dB.
  2767. @item side_gain
  2768. Set gain applied to side part of signal. By default is @var{1}.
  2769. @item middle_source
  2770. Set kind of middle source. Can be one of the following:
  2771. @table @samp
  2772. @item left
  2773. Pick left channel.
  2774. @item right
  2775. Pick right channel.
  2776. @item mid
  2777. Pick middle part signal of stereo image.
  2778. @item side
  2779. Pick side part signal of stereo image.
  2780. @end table
  2781. @item middle_phase
  2782. Change middle phase. By default is disabled.
  2783. @item left_delay
  2784. Set left channel delay. By default is @var{2.05} milliseconds.
  2785. @item left_balance
  2786. Set left channel balance. By default is @var{-1}.
  2787. @item left_gain
  2788. Set left channel gain. By default is @var{1}.
  2789. @item left_phase
  2790. Change left phase. By default is disabled.
  2791. @item right_delay
  2792. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2793. @item right_balance
  2794. Set right channel balance. By default is @var{1}.
  2795. @item right_gain
  2796. Set right channel gain. By default is @var{1}.
  2797. @item right_phase
  2798. Change right phase. By default is enabled.
  2799. @end table
  2800. @section hdcd
  2801. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2802. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2803. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2804. of HDCD, and detects the Transient Filter flag.
  2805. @example
  2806. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2807. @end example
  2808. When using the filter with wav, note the default encoding for wav is 16-bit,
  2809. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2810. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2811. @example
  2812. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2813. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2814. @end example
  2815. The filter accepts the following options:
  2816. @table @option
  2817. @item disable_autoconvert
  2818. Disable any automatic format conversion or resampling in the filter graph.
  2819. @item process_stereo
  2820. Process the stereo channels together. If target_gain does not match between
  2821. channels, consider it invalid and use the last valid target_gain.
  2822. @item cdt_ms
  2823. Set the code detect timer period in ms.
  2824. @item force_pe
  2825. Always extend peaks above -3dBFS even if PE isn't signaled.
  2826. @item analyze_mode
  2827. Replace audio with a solid tone and adjust the amplitude to signal some
  2828. specific aspect of the decoding process. The output file can be loaded in
  2829. an audio editor alongside the original to aid analysis.
  2830. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2831. Modes are:
  2832. @table @samp
  2833. @item 0, off
  2834. Disabled
  2835. @item 1, lle
  2836. Gain adjustment level at each sample
  2837. @item 2, pe
  2838. Samples where peak extend occurs
  2839. @item 3, cdt
  2840. Samples where the code detect timer is active
  2841. @item 4, tgm
  2842. Samples where the target gain does not match between channels
  2843. @end table
  2844. @end table
  2845. @section headphone
  2846. Apply head-related transfer functions (HRTFs) to create virtual
  2847. loudspeakers around the user for binaural listening via headphones.
  2848. The HRIRs are provided via additional streams, for each channel
  2849. one stereo input stream is needed.
  2850. The filter accepts the following options:
  2851. @table @option
  2852. @item map
  2853. Set mapping of input streams for convolution.
  2854. The argument is a '|'-separated list of channel names in order as they
  2855. are given as additional stream inputs for filter.
  2856. This also specify number of input streams. Number of input streams
  2857. must be not less than number of channels in first stream plus one.
  2858. @item gain
  2859. Set gain applied to audio. Value is in dB. Default is 0.
  2860. @item type
  2861. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2862. processing audio in time domain which is slow.
  2863. @var{freq} is processing audio in frequency domain which is fast.
  2864. Default is @var{freq}.
  2865. @item lfe
  2866. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2867. @item size
  2868. Set size of frame in number of samples which will be processed at once.
  2869. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2870. @item hrir
  2871. Set format of hrir stream.
  2872. Default value is @var{stereo}. Alternative value is @var{multich}.
  2873. If value is set to @var{stereo}, number of additional streams should
  2874. be greater or equal to number of input channels in first input stream.
  2875. Also each additional stream should have stereo number of channels.
  2876. If value is set to @var{multich}, number of additional streams should
  2877. be exactly one. Also number of input channels of additional stream
  2878. should be equal or greater than twice number of channels of first input
  2879. stream.
  2880. @end table
  2881. @subsection Examples
  2882. @itemize
  2883. @item
  2884. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2885. each amovie filter use stereo file with IR coefficients as input.
  2886. The files give coefficients for each position of virtual loudspeaker:
  2887. @example
  2888. ffmpeg -i input.wav
  2889. -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"
  2890. output.wav
  2891. @end example
  2892. @item
  2893. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2894. but now in @var{multich} @var{hrir} format.
  2895. @example
  2896. 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"
  2897. output.wav
  2898. @end example
  2899. @end itemize
  2900. @section highpass
  2901. Apply a high-pass filter with 3dB point frequency.
  2902. The filter can be either single-pole, or double-pole (the default).
  2903. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2904. The filter accepts the following options:
  2905. @table @option
  2906. @item frequency, f
  2907. Set frequency in Hz. Default is 3000.
  2908. @item poles, p
  2909. Set number of poles. Default is 2.
  2910. @item width_type, t
  2911. Set method to specify band-width of filter.
  2912. @table @option
  2913. @item h
  2914. Hz
  2915. @item q
  2916. Q-Factor
  2917. @item o
  2918. octave
  2919. @item s
  2920. slope
  2921. @item k
  2922. kHz
  2923. @end table
  2924. @item width, w
  2925. Specify the band-width of a filter in width_type units.
  2926. Applies only to double-pole filter.
  2927. The default is 0.707q and gives a Butterworth response.
  2928. @item channels, c
  2929. Specify which channels to filter, by default all available are filtered.
  2930. @end table
  2931. @subsection Commands
  2932. This filter supports the following commands:
  2933. @table @option
  2934. @item frequency, f
  2935. Change highpass frequency.
  2936. Syntax for the command is : "@var{frequency}"
  2937. @item width_type, t
  2938. Change highpass width_type.
  2939. Syntax for the command is : "@var{width_type}"
  2940. @item width, w
  2941. Change highpass width.
  2942. Syntax for the command is : "@var{width}"
  2943. @end table
  2944. @section join
  2945. Join multiple input streams into one multi-channel stream.
  2946. It accepts the following parameters:
  2947. @table @option
  2948. @item inputs
  2949. The number of input streams. It defaults to 2.
  2950. @item channel_layout
  2951. The desired output channel layout. It defaults to stereo.
  2952. @item map
  2953. Map channels from inputs to output. The argument is a '|'-separated list of
  2954. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2955. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2956. can be either the name of the input channel (e.g. FL for front left) or its
  2957. index in the specified input stream. @var{out_channel} is the name of the output
  2958. channel.
  2959. @end table
  2960. The filter will attempt to guess the mappings when they are not specified
  2961. explicitly. It does so by first trying to find an unused matching input channel
  2962. and if that fails it picks the first unused input channel.
  2963. Join 3 inputs (with properly set channel layouts):
  2964. @example
  2965. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2966. @end example
  2967. Build a 5.1 output from 6 single-channel streams:
  2968. @example
  2969. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2970. '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'
  2971. out
  2972. @end example
  2973. @section ladspa
  2974. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2975. To enable compilation of this filter you need to configure FFmpeg with
  2976. @code{--enable-ladspa}.
  2977. @table @option
  2978. @item file, f
  2979. Specifies the name of LADSPA plugin library to load. If the environment
  2980. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2981. each one of the directories specified by the colon separated list in
  2982. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2983. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2984. @file{/usr/lib/ladspa/}.
  2985. @item plugin, p
  2986. Specifies the plugin within the library. Some libraries contain only
  2987. one plugin, but others contain many of them. If this is not set filter
  2988. will list all available plugins within the specified library.
  2989. @item controls, c
  2990. Set the '|' separated list of controls which are zero or more floating point
  2991. values that determine the behavior of the loaded plugin (for example delay,
  2992. threshold or gain).
  2993. Controls need to be defined using the following syntax:
  2994. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2995. @var{valuei} is the value set on the @var{i}-th control.
  2996. Alternatively they can be also defined using the following syntax:
  2997. @var{value0}|@var{value1}|@var{value2}|..., where
  2998. @var{valuei} is the value set on the @var{i}-th control.
  2999. If @option{controls} is set to @code{help}, all available controls and
  3000. their valid ranges are printed.
  3001. @item sample_rate, s
  3002. Specify the sample rate, default to 44100. Only used if plugin have
  3003. zero inputs.
  3004. @item nb_samples, n
  3005. Set the number of samples per channel per each output frame, default
  3006. is 1024. Only used if plugin have zero inputs.
  3007. @item duration, d
  3008. Set the minimum duration of the sourced audio. See
  3009. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3010. for the accepted syntax.
  3011. Note that the resulting duration may be greater than the specified duration,
  3012. as the generated audio is always cut at the end of a complete frame.
  3013. If not specified, or the expressed duration is negative, the audio is
  3014. supposed to be generated forever.
  3015. Only used if plugin have zero inputs.
  3016. @end table
  3017. @subsection Examples
  3018. @itemize
  3019. @item
  3020. List all available plugins within amp (LADSPA example plugin) library:
  3021. @example
  3022. ladspa=file=amp
  3023. @end example
  3024. @item
  3025. List all available controls and their valid ranges for @code{vcf_notch}
  3026. plugin from @code{VCF} library:
  3027. @example
  3028. ladspa=f=vcf:p=vcf_notch:c=help
  3029. @end example
  3030. @item
  3031. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3032. plugin library:
  3033. @example
  3034. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3035. @end example
  3036. @item
  3037. Add reverberation to the audio using TAP-plugins
  3038. (Tom's Audio Processing plugins):
  3039. @example
  3040. ladspa=file=tap_reverb:tap_reverb
  3041. @end example
  3042. @item
  3043. Generate white noise, with 0.2 amplitude:
  3044. @example
  3045. ladspa=file=cmt:noise_source_white:c=c0=.2
  3046. @end example
  3047. @item
  3048. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3049. @code{C* Audio Plugin Suite} (CAPS) library:
  3050. @example
  3051. ladspa=file=caps:Click:c=c1=20'
  3052. @end example
  3053. @item
  3054. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3055. @example
  3056. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3057. @end example
  3058. @item
  3059. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3060. @code{SWH Plugins} collection:
  3061. @example
  3062. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3063. @end example
  3064. @item
  3065. Attenuate low frequencies using Multiband EQ from Steve Harris
  3066. @code{SWH Plugins} collection:
  3067. @example
  3068. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3069. @end example
  3070. @item
  3071. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3072. (CAPS) library:
  3073. @example
  3074. ladspa=caps:Narrower
  3075. @end example
  3076. @item
  3077. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3078. @example
  3079. ladspa=caps:White:.2
  3080. @end example
  3081. @item
  3082. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3083. @example
  3084. ladspa=caps:Fractal:c=c1=1
  3085. @end example
  3086. @item
  3087. Dynamic volume normalization using @code{VLevel} plugin:
  3088. @example
  3089. ladspa=vlevel-ladspa:vlevel_mono
  3090. @end example
  3091. @end itemize
  3092. @subsection Commands
  3093. This filter supports the following commands:
  3094. @table @option
  3095. @item cN
  3096. Modify the @var{N}-th control value.
  3097. If the specified value is not valid, it is ignored and prior one is kept.
  3098. @end table
  3099. @section loudnorm
  3100. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3101. Support for both single pass (livestreams, files) and double pass (files) modes.
  3102. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3103. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3104. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3105. The filter accepts the following options:
  3106. @table @option
  3107. @item I, i
  3108. Set integrated loudness target.
  3109. Range is -70.0 - -5.0. Default value is -24.0.
  3110. @item LRA, lra
  3111. Set loudness range target.
  3112. Range is 1.0 - 20.0. Default value is 7.0.
  3113. @item TP, tp
  3114. Set maximum true peak.
  3115. Range is -9.0 - +0.0. Default value is -2.0.
  3116. @item measured_I, measured_i
  3117. Measured IL of input file.
  3118. Range is -99.0 - +0.0.
  3119. @item measured_LRA, measured_lra
  3120. Measured LRA of input file.
  3121. Range is 0.0 - 99.0.
  3122. @item measured_TP, measured_tp
  3123. Measured true peak of input file.
  3124. Range is -99.0 - +99.0.
  3125. @item measured_thresh
  3126. Measured threshold of input file.
  3127. Range is -99.0 - +0.0.
  3128. @item offset
  3129. Set offset gain. Gain is applied before the true-peak limiter.
  3130. Range is -99.0 - +99.0. Default is +0.0.
  3131. @item linear
  3132. Normalize linearly if possible.
  3133. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3134. to be specified in order to use this mode.
  3135. Options are true or false. Default is true.
  3136. @item dual_mono
  3137. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3138. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3139. If set to @code{true}, this option will compensate for this effect.
  3140. Multi-channel input files are not affected by this option.
  3141. Options are true or false. Default is false.
  3142. @item print_format
  3143. Set print format for stats. Options are summary, json, or none.
  3144. Default value is none.
  3145. @end table
  3146. @section lowpass
  3147. Apply a low-pass filter with 3dB point frequency.
  3148. The filter can be either single-pole or double-pole (the default).
  3149. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3150. The filter accepts the following options:
  3151. @table @option
  3152. @item frequency, f
  3153. Set frequency in Hz. Default is 500.
  3154. @item poles, p
  3155. Set number of poles. Default is 2.
  3156. @item width_type, t
  3157. Set method to specify band-width of filter.
  3158. @table @option
  3159. @item h
  3160. Hz
  3161. @item q
  3162. Q-Factor
  3163. @item o
  3164. octave
  3165. @item s
  3166. slope
  3167. @item k
  3168. kHz
  3169. @end table
  3170. @item width, w
  3171. Specify the band-width of a filter in width_type units.
  3172. Applies only to double-pole filter.
  3173. The default is 0.707q and gives a Butterworth response.
  3174. @item channels, c
  3175. Specify which channels to filter, by default all available are filtered.
  3176. @end table
  3177. @subsection Examples
  3178. @itemize
  3179. @item
  3180. Lowpass only LFE channel, it LFE is not present it does nothing:
  3181. @example
  3182. lowpass=c=LFE
  3183. @end example
  3184. @end itemize
  3185. @subsection Commands
  3186. This filter supports the following commands:
  3187. @table @option
  3188. @item frequency, f
  3189. Change lowpass frequency.
  3190. Syntax for the command is : "@var{frequency}"
  3191. @item width_type, t
  3192. Change lowpass width_type.
  3193. Syntax for the command is : "@var{width_type}"
  3194. @item width, w
  3195. Change lowpass width.
  3196. Syntax for the command is : "@var{width}"
  3197. @end table
  3198. @section lv2
  3199. Load a LV2 (LADSPA Version 2) plugin.
  3200. To enable compilation of this filter you need to configure FFmpeg with
  3201. @code{--enable-lv2}.
  3202. @table @option
  3203. @item plugin, p
  3204. Specifies the plugin URI. You may need to escape ':'.
  3205. @item controls, c
  3206. Set the '|' separated list of controls which are zero or more floating point
  3207. values that determine the behavior of the loaded plugin (for example delay,
  3208. threshold or gain).
  3209. If @option{controls} is set to @code{help}, all available controls and
  3210. their valid ranges are printed.
  3211. @item sample_rate, s
  3212. Specify the sample rate, default to 44100. Only used if plugin have
  3213. zero inputs.
  3214. @item nb_samples, n
  3215. Set the number of samples per channel per each output frame, default
  3216. is 1024. Only used if plugin have zero inputs.
  3217. @item duration, d
  3218. Set the minimum duration of the sourced audio. See
  3219. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3220. for the accepted syntax.
  3221. Note that the resulting duration may be greater than the specified duration,
  3222. as the generated audio is always cut at the end of a complete frame.
  3223. If not specified, or the expressed duration is negative, the audio is
  3224. supposed to be generated forever.
  3225. Only used if plugin have zero inputs.
  3226. @end table
  3227. @subsection Examples
  3228. @itemize
  3229. @item
  3230. Apply bass enhancer plugin from Calf:
  3231. @example
  3232. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3233. @end example
  3234. @item
  3235. Apply vinyl plugin from Calf:
  3236. @example
  3237. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3238. @end example
  3239. @item
  3240. Apply bit crusher plugin from ArtyFX:
  3241. @example
  3242. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3243. @end example
  3244. @end itemize
  3245. @section mcompand
  3246. Multiband Compress or expand the audio's dynamic range.
  3247. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3248. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3249. response when absent compander action.
  3250. It accepts the following parameters:
  3251. @table @option
  3252. @item args
  3253. This option syntax is:
  3254. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3255. For explanation of each item refer to compand filter documentation.
  3256. @end table
  3257. @anchor{pan}
  3258. @section pan
  3259. Mix channels with specific gain levels. The filter accepts the output
  3260. channel layout followed by a set of channels definitions.
  3261. This filter is also designed to efficiently remap the channels of an audio
  3262. stream.
  3263. The filter accepts parameters of the form:
  3264. "@var{l}|@var{outdef}|@var{outdef}|..."
  3265. @table @option
  3266. @item l
  3267. output channel layout or number of channels
  3268. @item outdef
  3269. output channel specification, of the form:
  3270. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3271. @item out_name
  3272. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3273. number (c0, c1, etc.)
  3274. @item gain
  3275. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3276. @item in_name
  3277. input channel to use, see out_name for details; it is not possible to mix
  3278. named and numbered input channels
  3279. @end table
  3280. If the `=' in a channel specification is replaced by `<', then the gains for
  3281. that specification will be renormalized so that the total is 1, thus
  3282. avoiding clipping noise.
  3283. @subsection Mixing examples
  3284. For example, if you want to down-mix from stereo to mono, but with a bigger
  3285. factor for the left channel:
  3286. @example
  3287. pan=1c|c0=0.9*c0+0.1*c1
  3288. @end example
  3289. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3290. 7-channels surround:
  3291. @example
  3292. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3293. @end example
  3294. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3295. that should be preferred (see "-ac" option) unless you have very specific
  3296. needs.
  3297. @subsection Remapping examples
  3298. The channel remapping will be effective if, and only if:
  3299. @itemize
  3300. @item gain coefficients are zeroes or ones,
  3301. @item only one input per channel output,
  3302. @end itemize
  3303. If all these conditions are satisfied, the filter will notify the user ("Pure
  3304. channel mapping detected"), and use an optimized and lossless method to do the
  3305. remapping.
  3306. For example, if you have a 5.1 source and want a stereo audio stream by
  3307. dropping the extra channels:
  3308. @example
  3309. pan="stereo| c0=FL | c1=FR"
  3310. @end example
  3311. Given the same source, you can also switch front left and front right channels
  3312. and keep the input channel layout:
  3313. @example
  3314. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3315. @end example
  3316. If the input is a stereo audio stream, you can mute the front left channel (and
  3317. still keep the stereo channel layout) with:
  3318. @example
  3319. pan="stereo|c1=c1"
  3320. @end example
  3321. Still with a stereo audio stream input, you can copy the right channel in both
  3322. front left and right:
  3323. @example
  3324. pan="stereo| c0=FR | c1=FR"
  3325. @end example
  3326. @section replaygain
  3327. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3328. outputs it unchanged.
  3329. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3330. @section resample
  3331. Convert the audio sample format, sample rate and channel layout. It is
  3332. not meant to be used directly.
  3333. @section rubberband
  3334. Apply time-stretching and pitch-shifting with librubberband.
  3335. To enable compilation of this filter, you need to configure FFmpeg with
  3336. @code{--enable-librubberband}.
  3337. The filter accepts the following options:
  3338. @table @option
  3339. @item tempo
  3340. Set tempo scale factor.
  3341. @item pitch
  3342. Set pitch scale factor.
  3343. @item transients
  3344. Set transients detector.
  3345. Possible values are:
  3346. @table @var
  3347. @item crisp
  3348. @item mixed
  3349. @item smooth
  3350. @end table
  3351. @item detector
  3352. Set detector.
  3353. Possible values are:
  3354. @table @var
  3355. @item compound
  3356. @item percussive
  3357. @item soft
  3358. @end table
  3359. @item phase
  3360. Set phase.
  3361. Possible values are:
  3362. @table @var
  3363. @item laminar
  3364. @item independent
  3365. @end table
  3366. @item window
  3367. Set processing window size.
  3368. Possible values are:
  3369. @table @var
  3370. @item standard
  3371. @item short
  3372. @item long
  3373. @end table
  3374. @item smoothing
  3375. Set smoothing.
  3376. Possible values are:
  3377. @table @var
  3378. @item off
  3379. @item on
  3380. @end table
  3381. @item formant
  3382. Enable formant preservation when shift pitching.
  3383. Possible values are:
  3384. @table @var
  3385. @item shifted
  3386. @item preserved
  3387. @end table
  3388. @item pitchq
  3389. Set pitch quality.
  3390. Possible values are:
  3391. @table @var
  3392. @item quality
  3393. @item speed
  3394. @item consistency
  3395. @end table
  3396. @item channels
  3397. Set channels.
  3398. Possible values are:
  3399. @table @var
  3400. @item apart
  3401. @item together
  3402. @end table
  3403. @end table
  3404. @section sidechaincompress
  3405. This filter acts like normal compressor but has the ability to compress
  3406. detected signal using second input signal.
  3407. It needs two input streams and returns one output stream.
  3408. First input stream will be processed depending on second stream signal.
  3409. The filtered signal then can be filtered with other filters in later stages of
  3410. processing. See @ref{pan} and @ref{amerge} filter.
  3411. The filter accepts the following options:
  3412. @table @option
  3413. @item level_in
  3414. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3415. @item mode
  3416. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3417. Default is @code{downward}.
  3418. @item threshold
  3419. If a signal of second stream raises above this level it will affect the gain
  3420. reduction of first stream.
  3421. By default is 0.125. Range is between 0.00097563 and 1.
  3422. @item ratio
  3423. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3424. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3425. Default is 2. Range is between 1 and 20.
  3426. @item attack
  3427. Amount of milliseconds the signal has to rise above the threshold before gain
  3428. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3429. @item release
  3430. Amount of milliseconds the signal has to fall below the threshold before
  3431. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3432. @item makeup
  3433. Set the amount by how much signal will be amplified after processing.
  3434. Default is 1. Range is from 1 to 64.
  3435. @item knee
  3436. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3437. Default is 2.82843. Range is between 1 and 8.
  3438. @item link
  3439. Choose if the @code{average} level between all channels of side-chain stream
  3440. or the louder(@code{maximum}) channel of side-chain stream affects the
  3441. reduction. Default is @code{average}.
  3442. @item detection
  3443. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3444. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3445. @item level_sc
  3446. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3447. @item mix
  3448. How much to use compressed signal in output. Default is 1.
  3449. Range is between 0 and 1.
  3450. @end table
  3451. @subsection Examples
  3452. @itemize
  3453. @item
  3454. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3455. depending on the signal of 2nd input and later compressed signal to be
  3456. merged with 2nd input:
  3457. @example
  3458. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3459. @end example
  3460. @end itemize
  3461. @section sidechaingate
  3462. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3463. filter the detected signal before sending it to the gain reduction stage.
  3464. Normally a gate uses the full range signal to detect a level above the
  3465. threshold.
  3466. For example: If you cut all lower frequencies from your sidechain signal
  3467. the gate will decrease the volume of your track only if not enough highs
  3468. appear. With this technique you are able to reduce the resonation of a
  3469. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3470. guitar.
  3471. It needs two input streams and returns one output stream.
  3472. First input stream will be processed depending on second stream signal.
  3473. The filter accepts the following options:
  3474. @table @option
  3475. @item level_in
  3476. Set input level before filtering.
  3477. Default is 1. Allowed range is from 0.015625 to 64.
  3478. @item mode
  3479. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3480. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3481. will be amplified, expanding dynamic range in upward direction.
  3482. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3483. @item range
  3484. Set the level of gain reduction when the signal is below the threshold.
  3485. Default is 0.06125. Allowed range is from 0 to 1.
  3486. Setting this to 0 disables reduction and then filter behaves like expander.
  3487. @item threshold
  3488. If a signal rises above this level the gain reduction is released.
  3489. Default is 0.125. Allowed range is from 0 to 1.
  3490. @item ratio
  3491. Set a ratio about which the signal is reduced.
  3492. Default is 2. Allowed range is from 1 to 9000.
  3493. @item attack
  3494. Amount of milliseconds the signal has to rise above the threshold before gain
  3495. reduction stops.
  3496. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3497. @item release
  3498. Amount of milliseconds the signal has to fall below the threshold before the
  3499. reduction is increased again. Default is 250 milliseconds.
  3500. Allowed range is from 0.01 to 9000.
  3501. @item makeup
  3502. Set amount of amplification of signal after processing.
  3503. Default is 1. Allowed range is from 1 to 64.
  3504. @item knee
  3505. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3506. Default is 2.828427125. Allowed range is from 1 to 8.
  3507. @item detection
  3508. Choose if exact signal should be taken for detection or an RMS like one.
  3509. Default is rms. Can be peak or rms.
  3510. @item link
  3511. Choose if the average level between all channels or the louder channel affects
  3512. the reduction.
  3513. Default is average. Can be average or maximum.
  3514. @item level_sc
  3515. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3516. @end table
  3517. @section silencedetect
  3518. Detect silence in an audio stream.
  3519. This filter logs a message when it detects that the input audio volume is less
  3520. or equal to a noise tolerance value for a duration greater or equal to the
  3521. minimum detected noise duration.
  3522. The printed times and duration are expressed in seconds.
  3523. The filter accepts the following options:
  3524. @table @option
  3525. @item noise, n
  3526. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3527. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3528. @item duration, d
  3529. Set silence duration until notification (default is 2 seconds).
  3530. @item mono, m
  3531. Process each channel separately, instead of combined. By default is disabled.
  3532. @end table
  3533. @subsection Examples
  3534. @itemize
  3535. @item
  3536. Detect 5 seconds of silence with -50dB noise tolerance:
  3537. @example
  3538. silencedetect=n=-50dB:d=5
  3539. @end example
  3540. @item
  3541. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3542. tolerance in @file{silence.mp3}:
  3543. @example
  3544. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3545. @end example
  3546. @end itemize
  3547. @section silenceremove
  3548. Remove silence from the beginning, middle or end of the audio.
  3549. The filter accepts the following options:
  3550. @table @option
  3551. @item start_periods
  3552. This value is used to indicate if audio should be trimmed at beginning of
  3553. the audio. A value of zero indicates no silence should be trimmed from the
  3554. beginning. When specifying a non-zero value, it trims audio up until it
  3555. finds non-silence. Normally, when trimming silence from beginning of audio
  3556. the @var{start_periods} will be @code{1} but it can be increased to higher
  3557. values to trim all audio up to specific count of non-silence periods.
  3558. Default value is @code{0}.
  3559. @item start_duration
  3560. Specify the amount of time that non-silence must be detected before it stops
  3561. trimming audio. By increasing the duration, bursts of noises can be treated
  3562. as silence and trimmed off. Default value is @code{0}.
  3563. @item start_threshold
  3564. This indicates what sample value should be treated as silence. For digital
  3565. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3566. you may wish to increase the value to account for background noise.
  3567. Can be specified in dB (in case "dB" is appended to the specified value)
  3568. or amplitude ratio. Default value is @code{0}.
  3569. @item start_silence
  3570. Specify max duration of silence at beginning that will be kept after
  3571. trimming. Default is 0, which is equal to trimming all samples detected
  3572. as silence.
  3573. @item start_mode
  3574. Specify mode of detection of silence end in start of multi-channel audio.
  3575. Can be @var{any} or @var{all}. Default is @var{any}.
  3576. With @var{any}, any sample that is detected as non-silence will cause
  3577. stopped trimming of silence.
  3578. With @var{all}, only if all channels are detected as non-silence will cause
  3579. stopped trimming of silence.
  3580. @item stop_periods
  3581. Set the count for trimming silence from the end of audio.
  3582. To remove silence from the middle of a file, specify a @var{stop_periods}
  3583. that is negative. This value is then treated as a positive value and is
  3584. used to indicate the effect should restart processing as specified by
  3585. @var{start_periods}, making it suitable for removing periods of silence
  3586. in the middle of the audio.
  3587. Default value is @code{0}.
  3588. @item stop_duration
  3589. Specify a duration of silence that must exist before audio is not copied any
  3590. more. By specifying a higher duration, silence that is wanted can be left in
  3591. the audio.
  3592. Default value is @code{0}.
  3593. @item stop_threshold
  3594. This is the same as @option{start_threshold} but for trimming silence from
  3595. the end of audio.
  3596. Can be specified in dB (in case "dB" is appended to the specified value)
  3597. or amplitude ratio. Default value is @code{0}.
  3598. @item stop_silence
  3599. Specify max duration of silence at end that will be kept after
  3600. trimming. Default is 0, which is equal to trimming all samples detected
  3601. as silence.
  3602. @item stop_mode
  3603. Specify mode of detection of silence start in end of multi-channel audio.
  3604. Can be @var{any} or @var{all}. Default is @var{any}.
  3605. With @var{any}, any sample that is detected as non-silence will cause
  3606. stopped trimming of silence.
  3607. With @var{all}, only if all channels are detected as non-silence will cause
  3608. stopped trimming of silence.
  3609. @item detection
  3610. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3611. and works better with digital silence which is exactly 0.
  3612. Default value is @code{rms}.
  3613. @item window
  3614. Set duration in number of seconds used to calculate size of window in number
  3615. of samples for detecting silence.
  3616. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3617. @end table
  3618. @subsection Examples
  3619. @itemize
  3620. @item
  3621. The following example shows how this filter can be used to start a recording
  3622. that does not contain the delay at the start which usually occurs between
  3623. pressing the record button and the start of the performance:
  3624. @example
  3625. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3626. @end example
  3627. @item
  3628. Trim all silence encountered from beginning to end where there is more than 1
  3629. second of silence in audio:
  3630. @example
  3631. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3632. @end example
  3633. @end itemize
  3634. @section sofalizer
  3635. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3636. loudspeakers around the user for binaural listening via headphones (audio
  3637. formats up to 9 channels supported).
  3638. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3639. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3640. Austrian Academy of Sciences.
  3641. To enable compilation of this filter you need to configure FFmpeg with
  3642. @code{--enable-libmysofa}.
  3643. The filter accepts the following options:
  3644. @table @option
  3645. @item sofa
  3646. Set the SOFA file used for rendering.
  3647. @item gain
  3648. Set gain applied to audio. Value is in dB. Default is 0.
  3649. @item rotation
  3650. Set rotation of virtual loudspeakers in deg. Default is 0.
  3651. @item elevation
  3652. Set elevation of virtual speakers in deg. Default is 0.
  3653. @item radius
  3654. Set distance in meters between loudspeakers and the listener with near-field
  3655. HRTFs. Default is 1.
  3656. @item type
  3657. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3658. processing audio in time domain which is slow.
  3659. @var{freq} is processing audio in frequency domain which is fast.
  3660. Default is @var{freq}.
  3661. @item speakers
  3662. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3663. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3664. Each virtual loudspeaker is described with short channel name following with
  3665. azimuth and elevation in degrees.
  3666. Each virtual loudspeaker description is separated by '|'.
  3667. For example to override front left and front right channel positions use:
  3668. 'speakers=FL 45 15|FR 345 15'.
  3669. Descriptions with unrecognised channel names are ignored.
  3670. @item lfegain
  3671. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3672. @item framesize
  3673. Set custom frame size in number of samples. Default is 1024.
  3674. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3675. is set to @var{freq}.
  3676. @item normalize
  3677. Should all IRs be normalized upon importing SOFA file.
  3678. By default is enabled.
  3679. @item interpolate
  3680. Should nearest IRs be interpolated with neighbor IRs if exact position
  3681. does not match. By default is disabled.
  3682. @item minphase
  3683. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3684. @item anglestep
  3685. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3686. @item radstep
  3687. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3688. @end table
  3689. @subsection Examples
  3690. @itemize
  3691. @item
  3692. Using ClubFritz6 sofa file:
  3693. @example
  3694. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3695. @end example
  3696. @item
  3697. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3698. @example
  3699. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3700. @end example
  3701. @item
  3702. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3703. and also with custom gain:
  3704. @example
  3705. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3706. @end example
  3707. @end itemize
  3708. @section stereotools
  3709. This filter has some handy utilities to manage stereo signals, for converting
  3710. M/S stereo recordings to L/R signal while having control over the parameters
  3711. or spreading the stereo image of master track.
  3712. The filter accepts the following options:
  3713. @table @option
  3714. @item level_in
  3715. Set input level before filtering for both channels. Defaults is 1.
  3716. Allowed range is from 0.015625 to 64.
  3717. @item level_out
  3718. Set output level after filtering for both channels. Defaults is 1.
  3719. Allowed range is from 0.015625 to 64.
  3720. @item balance_in
  3721. Set input balance between both channels. Default is 0.
  3722. Allowed range is from -1 to 1.
  3723. @item balance_out
  3724. Set output balance between both channels. Default is 0.
  3725. Allowed range is from -1 to 1.
  3726. @item softclip
  3727. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3728. clipping. Disabled by default.
  3729. @item mutel
  3730. Mute the left channel. Disabled by default.
  3731. @item muter
  3732. Mute the right channel. Disabled by default.
  3733. @item phasel
  3734. Change the phase of the left channel. Disabled by default.
  3735. @item phaser
  3736. Change the phase of the right channel. Disabled by default.
  3737. @item mode
  3738. Set stereo mode. Available values are:
  3739. @table @samp
  3740. @item lr>lr
  3741. Left/Right to Left/Right, this is default.
  3742. @item lr>ms
  3743. Left/Right to Mid/Side.
  3744. @item ms>lr
  3745. Mid/Side to Left/Right.
  3746. @item lr>ll
  3747. Left/Right to Left/Left.
  3748. @item lr>rr
  3749. Left/Right to Right/Right.
  3750. @item lr>l+r
  3751. Left/Right to Left + Right.
  3752. @item lr>rl
  3753. Left/Right to Right/Left.
  3754. @item ms>ll
  3755. Mid/Side to Left/Left.
  3756. @item ms>rr
  3757. Mid/Side to Right/Right.
  3758. @end table
  3759. @item slev
  3760. Set level of side signal. Default is 1.
  3761. Allowed range is from 0.015625 to 64.
  3762. @item sbal
  3763. Set balance of side signal. Default is 0.
  3764. Allowed range is from -1 to 1.
  3765. @item mlev
  3766. Set level of the middle signal. Default is 1.
  3767. Allowed range is from 0.015625 to 64.
  3768. @item mpan
  3769. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3770. @item base
  3771. Set stereo base between mono and inversed channels. Default is 0.
  3772. Allowed range is from -1 to 1.
  3773. @item delay
  3774. Set delay in milliseconds how much to delay left from right channel and
  3775. vice versa. Default is 0. Allowed range is from -20 to 20.
  3776. @item sclevel
  3777. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3778. @item phase
  3779. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3780. @item bmode_in, bmode_out
  3781. Set balance mode for balance_in/balance_out option.
  3782. Can be one of the following:
  3783. @table @samp
  3784. @item balance
  3785. Classic balance mode. Attenuate one channel at time.
  3786. Gain is raised up to 1.
  3787. @item amplitude
  3788. Similar as classic mode above but gain is raised up to 2.
  3789. @item power
  3790. Equal power distribution, from -6dB to +6dB range.
  3791. @end table
  3792. @end table
  3793. @subsection Examples
  3794. @itemize
  3795. @item
  3796. Apply karaoke like effect:
  3797. @example
  3798. stereotools=mlev=0.015625
  3799. @end example
  3800. @item
  3801. Convert M/S signal to L/R:
  3802. @example
  3803. "stereotools=mode=ms>lr"
  3804. @end example
  3805. @end itemize
  3806. @section stereowiden
  3807. This filter enhance the stereo effect by suppressing signal common to both
  3808. channels and by delaying the signal of left into right and vice versa,
  3809. thereby widening the stereo effect.
  3810. The filter accepts the following options:
  3811. @table @option
  3812. @item delay
  3813. Time in milliseconds of the delay of left signal into right and vice versa.
  3814. Default is 20 milliseconds.
  3815. @item feedback
  3816. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3817. effect of left signal in right output and vice versa which gives widening
  3818. effect. Default is 0.3.
  3819. @item crossfeed
  3820. Cross feed of left into right with inverted phase. This helps in suppressing
  3821. the mono. If the value is 1 it will cancel all the signal common to both
  3822. channels. Default is 0.3.
  3823. @item drymix
  3824. Set level of input signal of original channel. Default is 0.8.
  3825. @end table
  3826. @section superequalizer
  3827. Apply 18 band equalizer.
  3828. The filter accepts the following options:
  3829. @table @option
  3830. @item 1b
  3831. Set 65Hz band gain.
  3832. @item 2b
  3833. Set 92Hz band gain.
  3834. @item 3b
  3835. Set 131Hz band gain.
  3836. @item 4b
  3837. Set 185Hz band gain.
  3838. @item 5b
  3839. Set 262Hz band gain.
  3840. @item 6b
  3841. Set 370Hz band gain.
  3842. @item 7b
  3843. Set 523Hz band gain.
  3844. @item 8b
  3845. Set 740Hz band gain.
  3846. @item 9b
  3847. Set 1047Hz band gain.
  3848. @item 10b
  3849. Set 1480Hz band gain.
  3850. @item 11b
  3851. Set 2093Hz band gain.
  3852. @item 12b
  3853. Set 2960Hz band gain.
  3854. @item 13b
  3855. Set 4186Hz band gain.
  3856. @item 14b
  3857. Set 5920Hz band gain.
  3858. @item 15b
  3859. Set 8372Hz band gain.
  3860. @item 16b
  3861. Set 11840Hz band gain.
  3862. @item 17b
  3863. Set 16744Hz band gain.
  3864. @item 18b
  3865. Set 20000Hz band gain.
  3866. @end table
  3867. @section surround
  3868. Apply audio surround upmix filter.
  3869. This filter allows to produce multichannel output from audio stream.
  3870. The filter accepts the following options:
  3871. @table @option
  3872. @item chl_out
  3873. Set output channel layout. By default, this is @var{5.1}.
  3874. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3875. for the required syntax.
  3876. @item chl_in
  3877. Set input channel layout. By default, this is @var{stereo}.
  3878. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3879. for the required syntax.
  3880. @item level_in
  3881. Set input volume level. By default, this is @var{1}.
  3882. @item level_out
  3883. Set output volume level. By default, this is @var{1}.
  3884. @item lfe
  3885. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3886. @item lfe_low
  3887. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3888. @item lfe_high
  3889. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3890. @item lfe_mode
  3891. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  3892. In @var{add} mode, LFE channel is created from input audio and added to output.
  3893. In @var{sub} mode, LFE channel is created from input audio and added to output but
  3894. also all non-LFE output channels are subtracted with output LFE channel.
  3895. @item angle
  3896. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  3897. Default is @var{90}.
  3898. @item fc_in
  3899. Set front center input volume. By default, this is @var{1}.
  3900. @item fc_out
  3901. Set front center output volume. By default, this is @var{1}.
  3902. @item fl_in
  3903. Set front left input volume. By default, this is @var{1}.
  3904. @item fl_out
  3905. Set front left output volume. By default, this is @var{1}.
  3906. @item fr_in
  3907. Set front right input volume. By default, this is @var{1}.
  3908. @item fr_out
  3909. Set front right output volume. By default, this is @var{1}.
  3910. @item sl_in
  3911. Set side left input volume. By default, this is @var{1}.
  3912. @item sl_out
  3913. Set side left output volume. By default, this is @var{1}.
  3914. @item sr_in
  3915. Set side right input volume. By default, this is @var{1}.
  3916. @item sr_out
  3917. Set side right output volume. By default, this is @var{1}.
  3918. @item bl_in
  3919. Set back left input volume. By default, this is @var{1}.
  3920. @item bl_out
  3921. Set back left output volume. By default, this is @var{1}.
  3922. @item br_in
  3923. Set back right input volume. By default, this is @var{1}.
  3924. @item br_out
  3925. Set back right output volume. By default, this is @var{1}.
  3926. @item bc_in
  3927. Set back center input volume. By default, this is @var{1}.
  3928. @item bc_out
  3929. Set back center output volume. By default, this is @var{1}.
  3930. @item lfe_in
  3931. Set LFE input volume. By default, this is @var{1}.
  3932. @item lfe_out
  3933. Set LFE output volume. By default, this is @var{1}.
  3934. @item allx
  3935. Set spread usage of stereo image across X axis for all channels.
  3936. @item ally
  3937. Set spread usage of stereo image across Y axis for all channels.
  3938. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  3939. Set spread usage of stereo image across X axis for each channel.
  3940. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  3941. Set spread usage of stereo image across Y axis for each channel.
  3942. @item win_size
  3943. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  3944. @item win_func
  3945. Set window function.
  3946. It accepts the following values:
  3947. @table @samp
  3948. @item rect
  3949. @item bartlett
  3950. @item hann, hanning
  3951. @item hamming
  3952. @item blackman
  3953. @item welch
  3954. @item flattop
  3955. @item bharris
  3956. @item bnuttall
  3957. @item bhann
  3958. @item sine
  3959. @item nuttall
  3960. @item lanczos
  3961. @item gauss
  3962. @item tukey
  3963. @item dolph
  3964. @item cauchy
  3965. @item parzen
  3966. @item poisson
  3967. @item bohman
  3968. @end table
  3969. Default is @code{hann}.
  3970. @item overlap
  3971. Set window overlap. If set to 1, the recommended overlap for selected
  3972. window function will be picked. Default is @code{0.5}.
  3973. @end table
  3974. @section treble, highshelf
  3975. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3976. shelving filter with a response similar to that of a standard
  3977. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3978. The filter accepts the following options:
  3979. @table @option
  3980. @item gain, g
  3981. Give the gain at whichever is the lower of ~22 kHz and the
  3982. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3983. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3984. @item frequency, f
  3985. Set the filter's central frequency and so can be used
  3986. to extend or reduce the frequency range to be boosted or cut.
  3987. The default value is @code{3000} Hz.
  3988. @item width_type, t
  3989. Set method to specify band-width of filter.
  3990. @table @option
  3991. @item h
  3992. Hz
  3993. @item q
  3994. Q-Factor
  3995. @item o
  3996. octave
  3997. @item s
  3998. slope
  3999. @item k
  4000. kHz
  4001. @end table
  4002. @item width, w
  4003. Determine how steep is the filter's shelf transition.
  4004. @item channels, c
  4005. Specify which channels to filter, by default all available are filtered.
  4006. @end table
  4007. @subsection Commands
  4008. This filter supports the following commands:
  4009. @table @option
  4010. @item frequency, f
  4011. Change treble frequency.
  4012. Syntax for the command is : "@var{frequency}"
  4013. @item width_type, t
  4014. Change treble width_type.
  4015. Syntax for the command is : "@var{width_type}"
  4016. @item width, w
  4017. Change treble width.
  4018. Syntax for the command is : "@var{width}"
  4019. @item gain, g
  4020. Change treble gain.
  4021. Syntax for the command is : "@var{gain}"
  4022. @end table
  4023. @section tremolo
  4024. Sinusoidal amplitude modulation.
  4025. The filter accepts the following options:
  4026. @table @option
  4027. @item f
  4028. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4029. (20 Hz or lower) will result in a tremolo effect.
  4030. This filter may also be used as a ring modulator by specifying
  4031. a modulation frequency higher than 20 Hz.
  4032. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4033. @item d
  4034. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4035. Default value is 0.5.
  4036. @end table
  4037. @section vibrato
  4038. Sinusoidal phase modulation.
  4039. The filter accepts the following options:
  4040. @table @option
  4041. @item f
  4042. Modulation frequency in Hertz.
  4043. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4044. @item d
  4045. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4046. Default value is 0.5.
  4047. @end table
  4048. @section volume
  4049. Adjust the input audio volume.
  4050. It accepts the following parameters:
  4051. @table @option
  4052. @item volume
  4053. Set audio volume expression.
  4054. Output values are clipped to the maximum value.
  4055. The output audio volume is given by the relation:
  4056. @example
  4057. @var{output_volume} = @var{volume} * @var{input_volume}
  4058. @end example
  4059. The default value for @var{volume} is "1.0".
  4060. @item precision
  4061. This parameter represents the mathematical precision.
  4062. It determines which input sample formats will be allowed, which affects the
  4063. precision of the volume scaling.
  4064. @table @option
  4065. @item fixed
  4066. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4067. @item float
  4068. 32-bit floating-point; this limits input sample format to FLT. (default)
  4069. @item double
  4070. 64-bit floating-point; this limits input sample format to DBL.
  4071. @end table
  4072. @item replaygain
  4073. Choose the behaviour on encountering ReplayGain side data in input frames.
  4074. @table @option
  4075. @item drop
  4076. Remove ReplayGain side data, ignoring its contents (the default).
  4077. @item ignore
  4078. Ignore ReplayGain side data, but leave it in the frame.
  4079. @item track
  4080. Prefer the track gain, if present.
  4081. @item album
  4082. Prefer the album gain, if present.
  4083. @end table
  4084. @item replaygain_preamp
  4085. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4086. Default value for @var{replaygain_preamp} is 0.0.
  4087. @item eval
  4088. Set when the volume expression is evaluated.
  4089. It accepts the following values:
  4090. @table @samp
  4091. @item once
  4092. only evaluate expression once during the filter initialization, or
  4093. when the @samp{volume} command is sent
  4094. @item frame
  4095. evaluate expression for each incoming frame
  4096. @end table
  4097. Default value is @samp{once}.
  4098. @end table
  4099. The volume expression can contain the following parameters.
  4100. @table @option
  4101. @item n
  4102. frame number (starting at zero)
  4103. @item nb_channels
  4104. number of channels
  4105. @item nb_consumed_samples
  4106. number of samples consumed by the filter
  4107. @item nb_samples
  4108. number of samples in the current frame
  4109. @item pos
  4110. original frame position in the file
  4111. @item pts
  4112. frame PTS
  4113. @item sample_rate
  4114. sample rate
  4115. @item startpts
  4116. PTS at start of stream
  4117. @item startt
  4118. time at start of stream
  4119. @item t
  4120. frame time
  4121. @item tb
  4122. timestamp timebase
  4123. @item volume
  4124. last set volume value
  4125. @end table
  4126. Note that when @option{eval} is set to @samp{once} only the
  4127. @var{sample_rate} and @var{tb} variables are available, all other
  4128. variables will evaluate to NAN.
  4129. @subsection Commands
  4130. This filter supports the following commands:
  4131. @table @option
  4132. @item volume
  4133. Modify the volume expression.
  4134. The command accepts the same syntax of the corresponding option.
  4135. If the specified expression is not valid, it is kept at its current
  4136. value.
  4137. @item replaygain_noclip
  4138. Prevent clipping by limiting the gain applied.
  4139. Default value for @var{replaygain_noclip} is 1.
  4140. @end table
  4141. @subsection Examples
  4142. @itemize
  4143. @item
  4144. Halve the input audio volume:
  4145. @example
  4146. volume=volume=0.5
  4147. volume=volume=1/2
  4148. volume=volume=-6.0206dB
  4149. @end example
  4150. In all the above example the named key for @option{volume} can be
  4151. omitted, for example like in:
  4152. @example
  4153. volume=0.5
  4154. @end example
  4155. @item
  4156. Increase input audio power by 6 decibels using fixed-point precision:
  4157. @example
  4158. volume=volume=6dB:precision=fixed
  4159. @end example
  4160. @item
  4161. Fade volume after time 10 with an annihilation period of 5 seconds:
  4162. @example
  4163. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4164. @end example
  4165. @end itemize
  4166. @section volumedetect
  4167. Detect the volume of the input video.
  4168. The filter has no parameters. The input is not modified. Statistics about
  4169. the volume will be printed in the log when the input stream end is reached.
  4170. In particular it will show the mean volume (root mean square), maximum
  4171. volume (on a per-sample basis), and the beginning of a histogram of the
  4172. registered volume values (from the maximum value to a cumulated 1/1000 of
  4173. the samples).
  4174. All volumes are in decibels relative to the maximum PCM value.
  4175. @subsection Examples
  4176. Here is an excerpt of the output:
  4177. @example
  4178. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4179. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4180. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4181. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4182. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4183. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4184. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4185. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4186. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4187. @end example
  4188. It means that:
  4189. @itemize
  4190. @item
  4191. The mean square energy is approximately -27 dB, or 10^-2.7.
  4192. @item
  4193. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4194. @item
  4195. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4196. @end itemize
  4197. In other words, raising the volume by +4 dB does not cause any clipping,
  4198. raising it by +5 dB causes clipping for 6 samples, etc.
  4199. @c man end AUDIO FILTERS
  4200. @chapter Audio Sources
  4201. @c man begin AUDIO SOURCES
  4202. Below is a description of the currently available audio sources.
  4203. @section abuffer
  4204. Buffer audio frames, and make them available to the filter chain.
  4205. This source is mainly intended for a programmatic use, in particular
  4206. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4207. It accepts the following parameters:
  4208. @table @option
  4209. @item time_base
  4210. The timebase which will be used for timestamps of submitted frames. It must be
  4211. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4212. @item sample_rate
  4213. The sample rate of the incoming audio buffers.
  4214. @item sample_fmt
  4215. The sample format of the incoming audio buffers.
  4216. Either a sample format name or its corresponding integer representation from
  4217. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4218. @item channel_layout
  4219. The channel layout of the incoming audio buffers.
  4220. Either a channel layout name from channel_layout_map in
  4221. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4222. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4223. @item channels
  4224. The number of channels of the incoming audio buffers.
  4225. If both @var{channels} and @var{channel_layout} are specified, then they
  4226. must be consistent.
  4227. @end table
  4228. @subsection Examples
  4229. @example
  4230. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4231. @end example
  4232. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4233. Since the sample format with name "s16p" corresponds to the number
  4234. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4235. equivalent to:
  4236. @example
  4237. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4238. @end example
  4239. @section aevalsrc
  4240. Generate an audio signal specified by an expression.
  4241. This source accepts in input one or more expressions (one for each
  4242. channel), which are evaluated and used to generate a corresponding
  4243. audio signal.
  4244. This source accepts the following options:
  4245. @table @option
  4246. @item exprs
  4247. Set the '|'-separated expressions list for each separate channel. In case the
  4248. @option{channel_layout} option is not specified, the selected channel layout
  4249. depends on the number of provided expressions. Otherwise the last
  4250. specified expression is applied to the remaining output channels.
  4251. @item channel_layout, c
  4252. Set the channel layout. The number of channels in the specified layout
  4253. must be equal to the number of specified expressions.
  4254. @item duration, d
  4255. Set the minimum duration of the sourced audio. See
  4256. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4257. for the accepted syntax.
  4258. Note that the resulting duration may be greater than the specified
  4259. duration, as the generated audio is always cut at the end of a
  4260. complete frame.
  4261. If not specified, or the expressed duration is negative, the audio is
  4262. supposed to be generated forever.
  4263. @item nb_samples, n
  4264. Set the number of samples per channel per each output frame,
  4265. default to 1024.
  4266. @item sample_rate, s
  4267. Specify the sample rate, default to 44100.
  4268. @end table
  4269. Each expression in @var{exprs} can contain the following constants:
  4270. @table @option
  4271. @item n
  4272. number of the evaluated sample, starting from 0
  4273. @item t
  4274. time of the evaluated sample expressed in seconds, starting from 0
  4275. @item s
  4276. sample rate
  4277. @end table
  4278. @subsection Examples
  4279. @itemize
  4280. @item
  4281. Generate silence:
  4282. @example
  4283. aevalsrc=0
  4284. @end example
  4285. @item
  4286. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4287. 8000 Hz:
  4288. @example
  4289. aevalsrc="sin(440*2*PI*t):s=8000"
  4290. @end example
  4291. @item
  4292. Generate a two channels signal, specify the channel layout (Front
  4293. Center + Back Center) explicitly:
  4294. @example
  4295. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4296. @end example
  4297. @item
  4298. Generate white noise:
  4299. @example
  4300. aevalsrc="-2+random(0)"
  4301. @end example
  4302. @item
  4303. Generate an amplitude modulated signal:
  4304. @example
  4305. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4306. @end example
  4307. @item
  4308. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4309. @example
  4310. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4311. @end example
  4312. @end itemize
  4313. @section anullsrc
  4314. The null audio source, return unprocessed audio frames. It is mainly useful
  4315. as a template and to be employed in analysis / debugging tools, or as
  4316. the source for filters which ignore the input data (for example the sox
  4317. synth filter).
  4318. This source accepts the following options:
  4319. @table @option
  4320. @item channel_layout, cl
  4321. Specifies the channel layout, and can be either an integer or a string
  4322. representing a channel layout. The default value of @var{channel_layout}
  4323. is "stereo".
  4324. Check the channel_layout_map definition in
  4325. @file{libavutil/channel_layout.c} for the mapping between strings and
  4326. channel layout values.
  4327. @item sample_rate, r
  4328. Specifies the sample rate, and defaults to 44100.
  4329. @item nb_samples, n
  4330. Set the number of samples per requested frames.
  4331. @end table
  4332. @subsection Examples
  4333. @itemize
  4334. @item
  4335. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4336. @example
  4337. anullsrc=r=48000:cl=4
  4338. @end example
  4339. @item
  4340. Do the same operation with a more obvious syntax:
  4341. @example
  4342. anullsrc=r=48000:cl=mono
  4343. @end example
  4344. @end itemize
  4345. All the parameters need to be explicitly defined.
  4346. @section flite
  4347. Synthesize a voice utterance using the libflite library.
  4348. To enable compilation of this filter you need to configure FFmpeg with
  4349. @code{--enable-libflite}.
  4350. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4351. The filter accepts the following options:
  4352. @table @option
  4353. @item list_voices
  4354. If set to 1, list the names of the available voices and exit
  4355. immediately. Default value is 0.
  4356. @item nb_samples, n
  4357. Set the maximum number of samples per frame. Default value is 512.
  4358. @item textfile
  4359. Set the filename containing the text to speak.
  4360. @item text
  4361. Set the text to speak.
  4362. @item voice, v
  4363. Set the voice to use for the speech synthesis. Default value is
  4364. @code{kal}. See also the @var{list_voices} option.
  4365. @end table
  4366. @subsection Examples
  4367. @itemize
  4368. @item
  4369. Read from file @file{speech.txt}, and synthesize the text using the
  4370. standard flite voice:
  4371. @example
  4372. flite=textfile=speech.txt
  4373. @end example
  4374. @item
  4375. Read the specified text selecting the @code{slt} voice:
  4376. @example
  4377. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4378. @end example
  4379. @item
  4380. Input text to ffmpeg:
  4381. @example
  4382. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4383. @end example
  4384. @item
  4385. Make @file{ffplay} speak the specified text, using @code{flite} and
  4386. the @code{lavfi} device:
  4387. @example
  4388. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4389. @end example
  4390. @end itemize
  4391. For more information about libflite, check:
  4392. @url{http://www.festvox.org/flite/}
  4393. @section anoisesrc
  4394. Generate a noise audio signal.
  4395. The filter accepts the following options:
  4396. @table @option
  4397. @item sample_rate, r
  4398. Specify the sample rate. Default value is 48000 Hz.
  4399. @item amplitude, a
  4400. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4401. is 1.0.
  4402. @item duration, d
  4403. Specify the duration of the generated audio stream. Not specifying this option
  4404. results in noise with an infinite length.
  4405. @item color, colour, c
  4406. Specify the color of noise. Available noise colors are white, pink, brown,
  4407. blue and violet. Default color is white.
  4408. @item seed, s
  4409. Specify a value used to seed the PRNG.
  4410. @item nb_samples, n
  4411. Set the number of samples per each output frame, default is 1024.
  4412. @end table
  4413. @subsection Examples
  4414. @itemize
  4415. @item
  4416. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4417. @example
  4418. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4419. @end example
  4420. @end itemize
  4421. @section hilbert
  4422. Generate odd-tap Hilbert transform FIR coefficients.
  4423. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4424. the signal by 90 degrees.
  4425. This is used in many matrix coding schemes and for analytic signal generation.
  4426. The process is often written as a multiplication by i (or j), the imaginary unit.
  4427. The filter accepts the following options:
  4428. @table @option
  4429. @item sample_rate, s
  4430. Set sample rate, default is 44100.
  4431. @item taps, t
  4432. Set length of FIR filter, default is 22051.
  4433. @item nb_samples, n
  4434. Set number of samples per each frame.
  4435. @item win_func, w
  4436. Set window function to be used when generating FIR coefficients.
  4437. @end table
  4438. @section sinc
  4439. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4440. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4441. The filter accepts the following options:
  4442. @table @option
  4443. @item sample_rate, r
  4444. Set sample rate, default is 44100.
  4445. @item nb_samples, n
  4446. Set number of samples per each frame. Default is 1024.
  4447. @item hp
  4448. Set high-pass frequency. Default is 0.
  4449. @item lp
  4450. Set low-pass frequency. Default is 0.
  4451. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4452. is higher than 0 then filter will create band-pass filter coefficients,
  4453. otherwise band-reject filter coefficients.
  4454. @item phase
  4455. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4456. @item beta
  4457. Set Kaiser window beta.
  4458. @item att
  4459. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4460. @item round
  4461. Enable rounding, by default is disabled.
  4462. @item hptaps
  4463. Set number of taps for high-pass filter.
  4464. @item lptaps
  4465. Set number of taps for low-pass filter.
  4466. @end table
  4467. @section sine
  4468. Generate an audio signal made of a sine wave with amplitude 1/8.
  4469. The audio signal is bit-exact.
  4470. The filter accepts the following options:
  4471. @table @option
  4472. @item frequency, f
  4473. Set the carrier frequency. Default is 440 Hz.
  4474. @item beep_factor, b
  4475. Enable a periodic beep every second with frequency @var{beep_factor} times
  4476. the carrier frequency. Default is 0, meaning the beep is disabled.
  4477. @item sample_rate, r
  4478. Specify the sample rate, default is 44100.
  4479. @item duration, d
  4480. Specify the duration of the generated audio stream.
  4481. @item samples_per_frame
  4482. Set the number of samples per output frame.
  4483. The expression can contain the following constants:
  4484. @table @option
  4485. @item n
  4486. The (sequential) number of the output audio frame, starting from 0.
  4487. @item pts
  4488. The PTS (Presentation TimeStamp) of the output audio frame,
  4489. expressed in @var{TB} units.
  4490. @item t
  4491. The PTS of the output audio frame, expressed in seconds.
  4492. @item TB
  4493. The timebase of the output audio frames.
  4494. @end table
  4495. Default is @code{1024}.
  4496. @end table
  4497. @subsection Examples
  4498. @itemize
  4499. @item
  4500. Generate a simple 440 Hz sine wave:
  4501. @example
  4502. sine
  4503. @end example
  4504. @item
  4505. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4506. @example
  4507. sine=220:4:d=5
  4508. sine=f=220:b=4:d=5
  4509. sine=frequency=220:beep_factor=4:duration=5
  4510. @end example
  4511. @item
  4512. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4513. pattern:
  4514. @example
  4515. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4516. @end example
  4517. @end itemize
  4518. @c man end AUDIO SOURCES
  4519. @chapter Audio Sinks
  4520. @c man begin AUDIO SINKS
  4521. Below is a description of the currently available audio sinks.
  4522. @section abuffersink
  4523. Buffer audio frames, and make them available to the end of filter chain.
  4524. This sink is mainly intended for programmatic use, in particular
  4525. through the interface defined in @file{libavfilter/buffersink.h}
  4526. or the options system.
  4527. It accepts a pointer to an AVABufferSinkContext structure, which
  4528. defines the incoming buffers' formats, to be passed as the opaque
  4529. parameter to @code{avfilter_init_filter} for initialization.
  4530. @section anullsink
  4531. Null audio sink; do absolutely nothing with the input audio. It is
  4532. mainly useful as a template and for use in analysis / debugging
  4533. tools.
  4534. @c man end AUDIO SINKS
  4535. @chapter Video Filters
  4536. @c man begin VIDEO FILTERS
  4537. When you configure your FFmpeg build, you can disable any of the
  4538. existing filters using @code{--disable-filters}.
  4539. The configure output will show the video filters included in your
  4540. build.
  4541. Below is a description of the currently available video filters.
  4542. @section alphaextract
  4543. Extract the alpha component from the input as a grayscale video. This
  4544. is especially useful with the @var{alphamerge} filter.
  4545. @section alphamerge
  4546. Add or replace the alpha component of the primary input with the
  4547. grayscale value of a second input. This is intended for use with
  4548. @var{alphaextract} to allow the transmission or storage of frame
  4549. sequences that have alpha in a format that doesn't support an alpha
  4550. channel.
  4551. For example, to reconstruct full frames from a normal YUV-encoded video
  4552. and a separate video created with @var{alphaextract}, you might use:
  4553. @example
  4554. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4555. @end example
  4556. Since this filter is designed for reconstruction, it operates on frame
  4557. sequences without considering timestamps, and terminates when either
  4558. input reaches end of stream. This will cause problems if your encoding
  4559. pipeline drops frames. If you're trying to apply an image as an
  4560. overlay to a video stream, consider the @var{overlay} filter instead.
  4561. @section amplify
  4562. Amplify differences between current pixel and pixels of adjacent frames in
  4563. same pixel location.
  4564. This filter accepts the following options:
  4565. @table @option
  4566. @item radius
  4567. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4568. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4569. @item factor
  4570. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4571. @item threshold
  4572. Set threshold for difference amplification. Any difference greater or equal to
  4573. this value will not alter source pixel. Default is 10.
  4574. Allowed range is from 0 to 65535.
  4575. @item tolerance
  4576. Set tolerance for difference amplification. Any difference lower to
  4577. this value will not alter source pixel. Default is 0.
  4578. Allowed range is from 0 to 65535.
  4579. @item low
  4580. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4581. This option controls maximum possible value that will decrease source pixel value.
  4582. @item high
  4583. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4584. This option controls maximum possible value that will increase source pixel value.
  4585. @item planes
  4586. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4587. @end table
  4588. @section ass
  4589. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4590. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4591. Substation Alpha) subtitles files.
  4592. This filter accepts the following option in addition to the common options from
  4593. the @ref{subtitles} filter:
  4594. @table @option
  4595. @item shaping
  4596. Set the shaping engine
  4597. Available values are:
  4598. @table @samp
  4599. @item auto
  4600. The default libass shaping engine, which is the best available.
  4601. @item simple
  4602. Fast, font-agnostic shaper that can do only substitutions
  4603. @item complex
  4604. Slower shaper using OpenType for substitutions and positioning
  4605. @end table
  4606. The default is @code{auto}.
  4607. @end table
  4608. @section atadenoise
  4609. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4610. The filter accepts the following options:
  4611. @table @option
  4612. @item 0a
  4613. Set threshold A for 1st plane. Default is 0.02.
  4614. Valid range is 0 to 0.3.
  4615. @item 0b
  4616. Set threshold B for 1st plane. Default is 0.04.
  4617. Valid range is 0 to 5.
  4618. @item 1a
  4619. Set threshold A for 2nd plane. Default is 0.02.
  4620. Valid range is 0 to 0.3.
  4621. @item 1b
  4622. Set threshold B for 2nd plane. Default is 0.04.
  4623. Valid range is 0 to 5.
  4624. @item 2a
  4625. Set threshold A for 3rd plane. Default is 0.02.
  4626. Valid range is 0 to 0.3.
  4627. @item 2b
  4628. Set threshold B for 3rd plane. Default is 0.04.
  4629. Valid range is 0 to 5.
  4630. Threshold A is designed to react on abrupt changes in the input signal and
  4631. threshold B is designed to react on continuous changes in the input signal.
  4632. @item s
  4633. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4634. number in range [5, 129].
  4635. @item p
  4636. Set what planes of frame filter will use for averaging. Default is all.
  4637. @end table
  4638. @section avgblur
  4639. Apply average blur filter.
  4640. The filter accepts the following options:
  4641. @table @option
  4642. @item sizeX
  4643. Set horizontal radius size.
  4644. @item planes
  4645. Set which planes to filter. By default all planes are filtered.
  4646. @item sizeY
  4647. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4648. Default is @code{0}.
  4649. @end table
  4650. @section bbox
  4651. Compute the bounding box for the non-black pixels in the input frame
  4652. luminance plane.
  4653. This filter computes the bounding box containing all the pixels with a
  4654. luminance value greater than the minimum allowed value.
  4655. The parameters describing the bounding box are printed on the filter
  4656. log.
  4657. The filter accepts the following option:
  4658. @table @option
  4659. @item min_val
  4660. Set the minimal luminance value. Default is @code{16}.
  4661. @end table
  4662. @section bitplanenoise
  4663. Show and measure bit plane noise.
  4664. The filter accepts the following options:
  4665. @table @option
  4666. @item bitplane
  4667. Set which plane to analyze. Default is @code{1}.
  4668. @item filter
  4669. Filter out noisy pixels from @code{bitplane} set above.
  4670. Default is disabled.
  4671. @end table
  4672. @section blackdetect
  4673. Detect video intervals that are (almost) completely black. Can be
  4674. useful to detect chapter transitions, commercials, or invalid
  4675. recordings. Output lines contains the time for the start, end and
  4676. duration of the detected black interval expressed in seconds.
  4677. In order to display the output lines, you need to set the loglevel at
  4678. least to the AV_LOG_INFO value.
  4679. The filter accepts the following options:
  4680. @table @option
  4681. @item black_min_duration, d
  4682. Set the minimum detected black duration expressed in seconds. It must
  4683. be a non-negative floating point number.
  4684. Default value is 2.0.
  4685. @item picture_black_ratio_th, pic_th
  4686. Set the threshold for considering a picture "black".
  4687. Express the minimum value for the ratio:
  4688. @example
  4689. @var{nb_black_pixels} / @var{nb_pixels}
  4690. @end example
  4691. for which a picture is considered black.
  4692. Default value is 0.98.
  4693. @item pixel_black_th, pix_th
  4694. Set the threshold for considering a pixel "black".
  4695. The threshold expresses the maximum pixel luminance value for which a
  4696. pixel is considered "black". The provided value is scaled according to
  4697. the following equation:
  4698. @example
  4699. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4700. @end example
  4701. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4702. the input video format, the range is [0-255] for YUV full-range
  4703. formats and [16-235] for YUV non full-range formats.
  4704. Default value is 0.10.
  4705. @end table
  4706. The following example sets the maximum pixel threshold to the minimum
  4707. value, and detects only black intervals of 2 or more seconds:
  4708. @example
  4709. blackdetect=d=2:pix_th=0.00
  4710. @end example
  4711. @section blackframe
  4712. Detect frames that are (almost) completely black. Can be useful to
  4713. detect chapter transitions or commercials. Output lines consist of
  4714. the frame number of the detected frame, the percentage of blackness,
  4715. the position in the file if known or -1 and the timestamp in seconds.
  4716. In order to display the output lines, you need to set the loglevel at
  4717. least to the AV_LOG_INFO value.
  4718. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4719. The value represents the percentage of pixels in the picture that
  4720. are below the threshold value.
  4721. It accepts the following parameters:
  4722. @table @option
  4723. @item amount
  4724. The percentage of the pixels that have to be below the threshold; it defaults to
  4725. @code{98}.
  4726. @item threshold, thresh
  4727. The threshold below which a pixel value is considered black; it defaults to
  4728. @code{32}.
  4729. @end table
  4730. @section blend, tblend
  4731. Blend two video frames into each other.
  4732. The @code{blend} filter takes two input streams and outputs one
  4733. stream, the first input is the "top" layer and second input is
  4734. "bottom" layer. By default, the output terminates when the longest input terminates.
  4735. The @code{tblend} (time blend) filter takes two consecutive frames
  4736. from one single stream, and outputs the result obtained by blending
  4737. the new frame on top of the old frame.
  4738. A description of the accepted options follows.
  4739. @table @option
  4740. @item c0_mode
  4741. @item c1_mode
  4742. @item c2_mode
  4743. @item c3_mode
  4744. @item all_mode
  4745. Set blend mode for specific pixel component or all pixel components in case
  4746. of @var{all_mode}. Default value is @code{normal}.
  4747. Available values for component modes are:
  4748. @table @samp
  4749. @item addition
  4750. @item grainmerge
  4751. @item and
  4752. @item average
  4753. @item burn
  4754. @item darken
  4755. @item difference
  4756. @item grainextract
  4757. @item divide
  4758. @item dodge
  4759. @item freeze
  4760. @item exclusion
  4761. @item extremity
  4762. @item glow
  4763. @item hardlight
  4764. @item hardmix
  4765. @item heat
  4766. @item lighten
  4767. @item linearlight
  4768. @item multiply
  4769. @item multiply128
  4770. @item negation
  4771. @item normal
  4772. @item or
  4773. @item overlay
  4774. @item phoenix
  4775. @item pinlight
  4776. @item reflect
  4777. @item screen
  4778. @item softlight
  4779. @item subtract
  4780. @item vividlight
  4781. @item xor
  4782. @end table
  4783. @item c0_opacity
  4784. @item c1_opacity
  4785. @item c2_opacity
  4786. @item c3_opacity
  4787. @item all_opacity
  4788. Set blend opacity for specific pixel component or all pixel components in case
  4789. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4790. @item c0_expr
  4791. @item c1_expr
  4792. @item c2_expr
  4793. @item c3_expr
  4794. @item all_expr
  4795. Set blend expression for specific pixel component or all pixel components in case
  4796. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4797. The expressions can use the following variables:
  4798. @table @option
  4799. @item N
  4800. The sequential number of the filtered frame, starting from @code{0}.
  4801. @item X
  4802. @item Y
  4803. the coordinates of the current sample
  4804. @item W
  4805. @item H
  4806. the width and height of currently filtered plane
  4807. @item SW
  4808. @item SH
  4809. Width and height scale for the plane being filtered. It is the
  4810. ratio between the dimensions of the current plane to the luma plane,
  4811. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4812. the luma plane and @code{0.5,0.5} for the chroma planes.
  4813. @item T
  4814. Time of the current frame, expressed in seconds.
  4815. @item TOP, A
  4816. Value of pixel component at current location for first video frame (top layer).
  4817. @item BOTTOM, B
  4818. Value of pixel component at current location for second video frame (bottom layer).
  4819. @end table
  4820. @end table
  4821. The @code{blend} filter also supports the @ref{framesync} options.
  4822. @subsection Examples
  4823. @itemize
  4824. @item
  4825. Apply transition from bottom layer to top layer in first 10 seconds:
  4826. @example
  4827. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4828. @end example
  4829. @item
  4830. Apply linear horizontal transition from top layer to bottom layer:
  4831. @example
  4832. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4833. @end example
  4834. @item
  4835. Apply 1x1 checkerboard effect:
  4836. @example
  4837. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4838. @end example
  4839. @item
  4840. Apply uncover left effect:
  4841. @example
  4842. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4843. @end example
  4844. @item
  4845. Apply uncover down effect:
  4846. @example
  4847. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4848. @end example
  4849. @item
  4850. Apply uncover up-left effect:
  4851. @example
  4852. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4853. @end example
  4854. @item
  4855. Split diagonally video and shows top and bottom layer on each side:
  4856. @example
  4857. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4858. @end example
  4859. @item
  4860. Display differences between the current and the previous frame:
  4861. @example
  4862. tblend=all_mode=grainextract
  4863. @end example
  4864. @end itemize
  4865. @section bm3d
  4866. Denoise frames using Block-Matching 3D algorithm.
  4867. The filter accepts the following options.
  4868. @table @option
  4869. @item sigma
  4870. Set denoising strength. Default value is 1.
  4871. Allowed range is from 0 to 999.9.
  4872. The denoising algorithm is very sensitive to sigma, so adjust it
  4873. according to the source.
  4874. @item block
  4875. Set local patch size. This sets dimensions in 2D.
  4876. @item bstep
  4877. Set sliding step for processing blocks. Default value is 4.
  4878. Allowed range is from 1 to 64.
  4879. Smaller values allows processing more reference blocks and is slower.
  4880. @item group
  4881. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4882. When set to 1, no block matching is done. Larger values allows more blocks
  4883. in single group.
  4884. Allowed range is from 1 to 256.
  4885. @item range
  4886. Set radius for search block matching. Default is 9.
  4887. Allowed range is from 1 to INT32_MAX.
  4888. @item mstep
  4889. Set step between two search locations for block matching. Default is 1.
  4890. Allowed range is from 1 to 64. Smaller is slower.
  4891. @item thmse
  4892. Set threshold of mean square error for block matching. Valid range is 0 to
  4893. INT32_MAX.
  4894. @item hdthr
  4895. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4896. Larger values results in stronger hard-thresholding filtering in frequency
  4897. domain.
  4898. @item estim
  4899. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4900. Default is @code{basic}.
  4901. @item ref
  4902. If enabled, filter will use 2nd stream for block matching.
  4903. Default is disabled for @code{basic} value of @var{estim} option,
  4904. and always enabled if value of @var{estim} is @code{final}.
  4905. @item planes
  4906. Set planes to filter. Default is all available except alpha.
  4907. @end table
  4908. @subsection Examples
  4909. @itemize
  4910. @item
  4911. Basic filtering with bm3d:
  4912. @example
  4913. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4914. @end example
  4915. @item
  4916. Same as above, but filtering only luma:
  4917. @example
  4918. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4919. @end example
  4920. @item
  4921. Same as above, but with both estimation modes:
  4922. @example
  4923. 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
  4924. @end example
  4925. @item
  4926. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4927. @example
  4928. 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
  4929. @end example
  4930. @end itemize
  4931. @section boxblur
  4932. Apply a boxblur algorithm to the input video.
  4933. It accepts the following parameters:
  4934. @table @option
  4935. @item luma_radius, lr
  4936. @item luma_power, lp
  4937. @item chroma_radius, cr
  4938. @item chroma_power, cp
  4939. @item alpha_radius, ar
  4940. @item alpha_power, ap
  4941. @end table
  4942. A description of the accepted options follows.
  4943. @table @option
  4944. @item luma_radius, lr
  4945. @item chroma_radius, cr
  4946. @item alpha_radius, ar
  4947. Set an expression for the box radius in pixels used for blurring the
  4948. corresponding input plane.
  4949. The radius value must be a non-negative number, and must not be
  4950. greater than the value of the expression @code{min(w,h)/2} for the
  4951. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4952. planes.
  4953. Default value for @option{luma_radius} is "2". If not specified,
  4954. @option{chroma_radius} and @option{alpha_radius} default to the
  4955. corresponding value set for @option{luma_radius}.
  4956. The expressions can contain the following constants:
  4957. @table @option
  4958. @item w
  4959. @item h
  4960. The input width and height in pixels.
  4961. @item cw
  4962. @item ch
  4963. The input chroma image width and height in pixels.
  4964. @item hsub
  4965. @item vsub
  4966. The horizontal and vertical chroma subsample values. For example, for the
  4967. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4968. @end table
  4969. @item luma_power, lp
  4970. @item chroma_power, cp
  4971. @item alpha_power, ap
  4972. Specify how many times the boxblur filter is applied to the
  4973. corresponding plane.
  4974. Default value for @option{luma_power} is 2. If not specified,
  4975. @option{chroma_power} and @option{alpha_power} default to the
  4976. corresponding value set for @option{luma_power}.
  4977. A value of 0 will disable the effect.
  4978. @end table
  4979. @subsection Examples
  4980. @itemize
  4981. @item
  4982. Apply a boxblur filter with the luma, chroma, and alpha radii
  4983. set to 2:
  4984. @example
  4985. boxblur=luma_radius=2:luma_power=1
  4986. boxblur=2:1
  4987. @end example
  4988. @item
  4989. Set the luma radius to 2, and alpha and chroma radius to 0:
  4990. @example
  4991. boxblur=2:1:cr=0:ar=0
  4992. @end example
  4993. @item
  4994. Set the luma and chroma radii to a fraction of the video dimension:
  4995. @example
  4996. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4997. @end example
  4998. @end itemize
  4999. @section bwdif
  5000. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5001. Deinterlacing Filter").
  5002. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5003. interpolation algorithms.
  5004. It accepts the following parameters:
  5005. @table @option
  5006. @item mode
  5007. The interlacing mode to adopt. It accepts one of the following values:
  5008. @table @option
  5009. @item 0, send_frame
  5010. Output one frame for each frame.
  5011. @item 1, send_field
  5012. Output one frame for each field.
  5013. @end table
  5014. The default value is @code{send_field}.
  5015. @item parity
  5016. The picture field parity assumed for the input interlaced video. It accepts one
  5017. of the following values:
  5018. @table @option
  5019. @item 0, tff
  5020. Assume the top field is first.
  5021. @item 1, bff
  5022. Assume the bottom field is first.
  5023. @item -1, auto
  5024. Enable automatic detection of field parity.
  5025. @end table
  5026. The default value is @code{auto}.
  5027. If the interlacing is unknown or the decoder does not export this information,
  5028. top field first will be assumed.
  5029. @item deint
  5030. Specify which frames to deinterlace. Accept one of the following
  5031. values:
  5032. @table @option
  5033. @item 0, all
  5034. Deinterlace all frames.
  5035. @item 1, interlaced
  5036. Only deinterlace frames marked as interlaced.
  5037. @end table
  5038. The default value is @code{all}.
  5039. @end table
  5040. @section chromahold
  5041. Remove all color information for all colors except for certain one.
  5042. The filter accepts the following options:
  5043. @table @option
  5044. @item color
  5045. The color which will not be replaced with neutral chroma.
  5046. @item similarity
  5047. Similarity percentage with the above color.
  5048. 0.01 matches only the exact key color, while 1.0 matches everything.
  5049. @item blend
  5050. Blend percentage.
  5051. 0.0 makes pixels either fully gray, or not gray at all.
  5052. Higher values result in more preserved color.
  5053. @item yuv
  5054. Signals that the color passed is already in YUV instead of RGB.
  5055. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5056. This can be used to pass exact YUV values as hexadecimal numbers.
  5057. @end table
  5058. @section chromakey
  5059. YUV colorspace color/chroma keying.
  5060. The filter accepts the following options:
  5061. @table @option
  5062. @item color
  5063. The color which will be replaced with transparency.
  5064. @item similarity
  5065. Similarity percentage with the key color.
  5066. 0.01 matches only the exact key color, while 1.0 matches everything.
  5067. @item blend
  5068. Blend percentage.
  5069. 0.0 makes pixels either fully transparent, or not transparent at all.
  5070. Higher values result in semi-transparent pixels, with a higher transparency
  5071. the more similar the pixels color is to the key color.
  5072. @item yuv
  5073. Signals that the color passed is already in YUV instead of RGB.
  5074. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5075. This can be used to pass exact YUV values as hexadecimal numbers.
  5076. @end table
  5077. @subsection Examples
  5078. @itemize
  5079. @item
  5080. Make every green pixel in the input image transparent:
  5081. @example
  5082. ffmpeg -i input.png -vf chromakey=green out.png
  5083. @end example
  5084. @item
  5085. Overlay a greenscreen-video on top of a static black background.
  5086. @example
  5087. 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
  5088. @end example
  5089. @end itemize
  5090. @section chromashift
  5091. Shift chroma pixels horizontally and/or vertically.
  5092. The filter accepts the following options:
  5093. @table @option
  5094. @item cbh
  5095. Set amount to shift chroma-blue horizontally.
  5096. @item cbv
  5097. Set amount to shift chroma-blue vertically.
  5098. @item crh
  5099. Set amount to shift chroma-red horizontally.
  5100. @item crv
  5101. Set amount to shift chroma-red vertically.
  5102. @item edge
  5103. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5104. @end table
  5105. @section ciescope
  5106. Display CIE color diagram with pixels overlaid onto it.
  5107. The filter accepts the following options:
  5108. @table @option
  5109. @item system
  5110. Set color system.
  5111. @table @samp
  5112. @item ntsc, 470m
  5113. @item ebu, 470bg
  5114. @item smpte
  5115. @item 240m
  5116. @item apple
  5117. @item widergb
  5118. @item cie1931
  5119. @item rec709, hdtv
  5120. @item uhdtv, rec2020
  5121. @end table
  5122. @item cie
  5123. Set CIE system.
  5124. @table @samp
  5125. @item xyy
  5126. @item ucs
  5127. @item luv
  5128. @end table
  5129. @item gamuts
  5130. Set what gamuts to draw.
  5131. See @code{system} option for available values.
  5132. @item size, s
  5133. Set ciescope size, by default set to 512.
  5134. @item intensity, i
  5135. Set intensity used to map input pixel values to CIE diagram.
  5136. @item contrast
  5137. Set contrast used to draw tongue colors that are out of active color system gamut.
  5138. @item corrgamma
  5139. Correct gamma displayed on scope, by default enabled.
  5140. @item showwhite
  5141. Show white point on CIE diagram, by default disabled.
  5142. @item gamma
  5143. Set input gamma. Used only with XYZ input color space.
  5144. @end table
  5145. @section codecview
  5146. Visualize information exported by some codecs.
  5147. Some codecs can export information through frames using side-data or other
  5148. means. For example, some MPEG based codecs export motion vectors through the
  5149. @var{export_mvs} flag in the codec @option{flags2} option.
  5150. The filter accepts the following option:
  5151. @table @option
  5152. @item mv
  5153. Set motion vectors to visualize.
  5154. Available flags for @var{mv} are:
  5155. @table @samp
  5156. @item pf
  5157. forward predicted MVs of P-frames
  5158. @item bf
  5159. forward predicted MVs of B-frames
  5160. @item bb
  5161. backward predicted MVs of B-frames
  5162. @end table
  5163. @item qp
  5164. Display quantization parameters using the chroma planes.
  5165. @item mv_type, mvt
  5166. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5167. Available flags for @var{mv_type} are:
  5168. @table @samp
  5169. @item fp
  5170. forward predicted MVs
  5171. @item bp
  5172. backward predicted MVs
  5173. @end table
  5174. @item frame_type, ft
  5175. Set frame type to visualize motion vectors of.
  5176. Available flags for @var{frame_type} are:
  5177. @table @samp
  5178. @item if
  5179. intra-coded frames (I-frames)
  5180. @item pf
  5181. predicted frames (P-frames)
  5182. @item bf
  5183. bi-directionally predicted frames (B-frames)
  5184. @end table
  5185. @end table
  5186. @subsection Examples
  5187. @itemize
  5188. @item
  5189. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5190. @example
  5191. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5192. @end example
  5193. @item
  5194. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5195. @example
  5196. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5197. @end example
  5198. @end itemize
  5199. @section colorbalance
  5200. Modify intensity of primary colors (red, green and blue) of input frames.
  5201. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5202. regions for the red-cyan, green-magenta or blue-yellow balance.
  5203. A positive adjustment value shifts the balance towards the primary color, a negative
  5204. value towards the complementary color.
  5205. The filter accepts the following options:
  5206. @table @option
  5207. @item rs
  5208. @item gs
  5209. @item bs
  5210. Adjust red, green and blue shadows (darkest pixels).
  5211. @item rm
  5212. @item gm
  5213. @item bm
  5214. Adjust red, green and blue midtones (medium pixels).
  5215. @item rh
  5216. @item gh
  5217. @item bh
  5218. Adjust red, green and blue highlights (brightest pixels).
  5219. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5220. @end table
  5221. @subsection Examples
  5222. @itemize
  5223. @item
  5224. Add red color cast to shadows:
  5225. @example
  5226. colorbalance=rs=.3
  5227. @end example
  5228. @end itemize
  5229. @section colorkey
  5230. RGB colorspace color keying.
  5231. The filter accepts the following options:
  5232. @table @option
  5233. @item color
  5234. The color which will be replaced with transparency.
  5235. @item similarity
  5236. Similarity percentage with the key color.
  5237. 0.01 matches only the exact key color, while 1.0 matches everything.
  5238. @item blend
  5239. Blend percentage.
  5240. 0.0 makes pixels either fully transparent, or not transparent at all.
  5241. Higher values result in semi-transparent pixels, with a higher transparency
  5242. the more similar the pixels color is to the key color.
  5243. @end table
  5244. @subsection Examples
  5245. @itemize
  5246. @item
  5247. Make every green pixel in the input image transparent:
  5248. @example
  5249. ffmpeg -i input.png -vf colorkey=green out.png
  5250. @end example
  5251. @item
  5252. Overlay a greenscreen-video on top of a static background image.
  5253. @example
  5254. 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
  5255. @end example
  5256. @end itemize
  5257. @section colorhold
  5258. Remove all color information for all RGB colors except for certain one.
  5259. The filter accepts the following options:
  5260. @table @option
  5261. @item color
  5262. The color which will not be replaced with neutral gray.
  5263. @item similarity
  5264. Similarity percentage with the above color.
  5265. 0.01 matches only the exact key color, while 1.0 matches everything.
  5266. @item blend
  5267. Blend percentage. 0.0 makes pixels fully gray.
  5268. Higher values result in more preserved color.
  5269. @end table
  5270. @section colorlevels
  5271. Adjust video input frames using levels.
  5272. The filter accepts the following options:
  5273. @table @option
  5274. @item rimin
  5275. @item gimin
  5276. @item bimin
  5277. @item aimin
  5278. Adjust red, green, blue and alpha input black point.
  5279. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5280. @item rimax
  5281. @item gimax
  5282. @item bimax
  5283. @item aimax
  5284. Adjust red, green, blue and alpha input white point.
  5285. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5286. Input levels are used to lighten highlights (bright tones), darken shadows
  5287. (dark tones), change the balance of bright and dark tones.
  5288. @item romin
  5289. @item gomin
  5290. @item bomin
  5291. @item aomin
  5292. Adjust red, green, blue and alpha output black point.
  5293. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5294. @item romax
  5295. @item gomax
  5296. @item bomax
  5297. @item aomax
  5298. Adjust red, green, blue and alpha output white point.
  5299. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5300. Output levels allows manual selection of a constrained output level range.
  5301. @end table
  5302. @subsection Examples
  5303. @itemize
  5304. @item
  5305. Make video output darker:
  5306. @example
  5307. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5308. @end example
  5309. @item
  5310. Increase contrast:
  5311. @example
  5312. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5313. @end example
  5314. @item
  5315. Make video output lighter:
  5316. @example
  5317. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5318. @end example
  5319. @item
  5320. Increase brightness:
  5321. @example
  5322. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5323. @end example
  5324. @end itemize
  5325. @section colorchannelmixer
  5326. Adjust video input frames by re-mixing color channels.
  5327. This filter modifies a color channel by adding the values associated to
  5328. the other channels of the same pixels. For example if the value to
  5329. modify is red, the output value will be:
  5330. @example
  5331. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5332. @end example
  5333. The filter accepts the following options:
  5334. @table @option
  5335. @item rr
  5336. @item rg
  5337. @item rb
  5338. @item ra
  5339. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5340. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5341. @item gr
  5342. @item gg
  5343. @item gb
  5344. @item ga
  5345. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5346. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5347. @item br
  5348. @item bg
  5349. @item bb
  5350. @item ba
  5351. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5352. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5353. @item ar
  5354. @item ag
  5355. @item ab
  5356. @item aa
  5357. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5358. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5359. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5360. @end table
  5361. @subsection Examples
  5362. @itemize
  5363. @item
  5364. Convert source to grayscale:
  5365. @example
  5366. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5367. @end example
  5368. @item
  5369. Simulate sepia tones:
  5370. @example
  5371. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5372. @end example
  5373. @end itemize
  5374. @section colormatrix
  5375. Convert color matrix.
  5376. The filter accepts the following options:
  5377. @table @option
  5378. @item src
  5379. @item dst
  5380. Specify the source and destination color matrix. Both values must be
  5381. specified.
  5382. The accepted values are:
  5383. @table @samp
  5384. @item bt709
  5385. BT.709
  5386. @item fcc
  5387. FCC
  5388. @item bt601
  5389. BT.601
  5390. @item bt470
  5391. BT.470
  5392. @item bt470bg
  5393. BT.470BG
  5394. @item smpte170m
  5395. SMPTE-170M
  5396. @item smpte240m
  5397. SMPTE-240M
  5398. @item bt2020
  5399. BT.2020
  5400. @end table
  5401. @end table
  5402. For example to convert from BT.601 to SMPTE-240M, use the command:
  5403. @example
  5404. colormatrix=bt601:smpte240m
  5405. @end example
  5406. @section colorspace
  5407. Convert colorspace, transfer characteristics or color primaries.
  5408. Input video needs to have an even size.
  5409. The filter accepts the following options:
  5410. @table @option
  5411. @anchor{all}
  5412. @item all
  5413. Specify all color properties at once.
  5414. The accepted values are:
  5415. @table @samp
  5416. @item bt470m
  5417. BT.470M
  5418. @item bt470bg
  5419. BT.470BG
  5420. @item bt601-6-525
  5421. BT.601-6 525
  5422. @item bt601-6-625
  5423. BT.601-6 625
  5424. @item bt709
  5425. BT.709
  5426. @item smpte170m
  5427. SMPTE-170M
  5428. @item smpte240m
  5429. SMPTE-240M
  5430. @item bt2020
  5431. BT.2020
  5432. @end table
  5433. @anchor{space}
  5434. @item space
  5435. Specify output colorspace.
  5436. The accepted values are:
  5437. @table @samp
  5438. @item bt709
  5439. BT.709
  5440. @item fcc
  5441. FCC
  5442. @item bt470bg
  5443. BT.470BG or BT.601-6 625
  5444. @item smpte170m
  5445. SMPTE-170M or BT.601-6 525
  5446. @item smpte240m
  5447. SMPTE-240M
  5448. @item ycgco
  5449. YCgCo
  5450. @item bt2020ncl
  5451. BT.2020 with non-constant luminance
  5452. @end table
  5453. @anchor{trc}
  5454. @item trc
  5455. Specify output transfer characteristics.
  5456. The accepted values are:
  5457. @table @samp
  5458. @item bt709
  5459. BT.709
  5460. @item bt470m
  5461. BT.470M
  5462. @item bt470bg
  5463. BT.470BG
  5464. @item gamma22
  5465. Constant gamma of 2.2
  5466. @item gamma28
  5467. Constant gamma of 2.8
  5468. @item smpte170m
  5469. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5470. @item smpte240m
  5471. SMPTE-240M
  5472. @item srgb
  5473. SRGB
  5474. @item iec61966-2-1
  5475. iec61966-2-1
  5476. @item iec61966-2-4
  5477. iec61966-2-4
  5478. @item xvycc
  5479. xvycc
  5480. @item bt2020-10
  5481. BT.2020 for 10-bits content
  5482. @item bt2020-12
  5483. BT.2020 for 12-bits content
  5484. @end table
  5485. @anchor{primaries}
  5486. @item primaries
  5487. Specify output color primaries.
  5488. The accepted values are:
  5489. @table @samp
  5490. @item bt709
  5491. BT.709
  5492. @item bt470m
  5493. BT.470M
  5494. @item bt470bg
  5495. BT.470BG or BT.601-6 625
  5496. @item smpte170m
  5497. SMPTE-170M or BT.601-6 525
  5498. @item smpte240m
  5499. SMPTE-240M
  5500. @item film
  5501. film
  5502. @item smpte431
  5503. SMPTE-431
  5504. @item smpte432
  5505. SMPTE-432
  5506. @item bt2020
  5507. BT.2020
  5508. @item jedec-p22
  5509. JEDEC P22 phosphors
  5510. @end table
  5511. @anchor{range}
  5512. @item range
  5513. Specify output color range.
  5514. The accepted values are:
  5515. @table @samp
  5516. @item tv
  5517. TV (restricted) range
  5518. @item mpeg
  5519. MPEG (restricted) range
  5520. @item pc
  5521. PC (full) range
  5522. @item jpeg
  5523. JPEG (full) range
  5524. @end table
  5525. @item format
  5526. Specify output color format.
  5527. The accepted values are:
  5528. @table @samp
  5529. @item yuv420p
  5530. YUV 4:2:0 planar 8-bits
  5531. @item yuv420p10
  5532. YUV 4:2:0 planar 10-bits
  5533. @item yuv420p12
  5534. YUV 4:2:0 planar 12-bits
  5535. @item yuv422p
  5536. YUV 4:2:2 planar 8-bits
  5537. @item yuv422p10
  5538. YUV 4:2:2 planar 10-bits
  5539. @item yuv422p12
  5540. YUV 4:2:2 planar 12-bits
  5541. @item yuv444p
  5542. YUV 4:4:4 planar 8-bits
  5543. @item yuv444p10
  5544. YUV 4:4:4 planar 10-bits
  5545. @item yuv444p12
  5546. YUV 4:4:4 planar 12-bits
  5547. @end table
  5548. @item fast
  5549. Do a fast conversion, which skips gamma/primary correction. This will take
  5550. significantly less CPU, but will be mathematically incorrect. To get output
  5551. compatible with that produced by the colormatrix filter, use fast=1.
  5552. @item dither
  5553. Specify dithering mode.
  5554. The accepted values are:
  5555. @table @samp
  5556. @item none
  5557. No dithering
  5558. @item fsb
  5559. Floyd-Steinberg dithering
  5560. @end table
  5561. @item wpadapt
  5562. Whitepoint adaptation mode.
  5563. The accepted values are:
  5564. @table @samp
  5565. @item bradford
  5566. Bradford whitepoint adaptation
  5567. @item vonkries
  5568. von Kries whitepoint adaptation
  5569. @item identity
  5570. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5571. @end table
  5572. @item iall
  5573. Override all input properties at once. Same accepted values as @ref{all}.
  5574. @item ispace
  5575. Override input colorspace. Same accepted values as @ref{space}.
  5576. @item iprimaries
  5577. Override input color primaries. Same accepted values as @ref{primaries}.
  5578. @item itrc
  5579. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5580. @item irange
  5581. Override input color range. Same accepted values as @ref{range}.
  5582. @end table
  5583. The filter converts the transfer characteristics, color space and color
  5584. primaries to the specified user values. The output value, if not specified,
  5585. is set to a default value based on the "all" property. If that property is
  5586. also not specified, the filter will log an error. The output color range and
  5587. format default to the same value as the input color range and format. The
  5588. input transfer characteristics, color space, color primaries and color range
  5589. should be set on the input data. If any of these are missing, the filter will
  5590. log an error and no conversion will take place.
  5591. For example to convert the input to SMPTE-240M, use the command:
  5592. @example
  5593. colorspace=smpte240m
  5594. @end example
  5595. @section convolution
  5596. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5597. The filter accepts the following options:
  5598. @table @option
  5599. @item 0m
  5600. @item 1m
  5601. @item 2m
  5602. @item 3m
  5603. Set matrix for each plane.
  5604. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5605. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5606. @item 0rdiv
  5607. @item 1rdiv
  5608. @item 2rdiv
  5609. @item 3rdiv
  5610. Set multiplier for calculated value for each plane.
  5611. If unset or 0, it will be sum of all matrix elements.
  5612. @item 0bias
  5613. @item 1bias
  5614. @item 2bias
  5615. @item 3bias
  5616. Set bias for each plane. This value is added to the result of the multiplication.
  5617. Useful for making the overall image brighter or darker. Default is 0.0.
  5618. @item 0mode
  5619. @item 1mode
  5620. @item 2mode
  5621. @item 3mode
  5622. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5623. Default is @var{square}.
  5624. @end table
  5625. @subsection Examples
  5626. @itemize
  5627. @item
  5628. Apply sharpen:
  5629. @example
  5630. 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"
  5631. @end example
  5632. @item
  5633. Apply blur:
  5634. @example
  5635. 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"
  5636. @end example
  5637. @item
  5638. Apply edge enhance:
  5639. @example
  5640. 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"
  5641. @end example
  5642. @item
  5643. Apply edge detect:
  5644. @example
  5645. 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"
  5646. @end example
  5647. @item
  5648. Apply laplacian edge detector which includes diagonals:
  5649. @example
  5650. 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"
  5651. @end example
  5652. @item
  5653. Apply emboss:
  5654. @example
  5655. 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"
  5656. @end example
  5657. @end itemize
  5658. @section convolve
  5659. Apply 2D convolution of video stream in frequency domain using second stream
  5660. as impulse.
  5661. The filter accepts the following options:
  5662. @table @option
  5663. @item planes
  5664. Set which planes to process.
  5665. @item impulse
  5666. Set which impulse video frames will be processed, can be @var{first}
  5667. or @var{all}. Default is @var{all}.
  5668. @end table
  5669. The @code{convolve} filter also supports the @ref{framesync} options.
  5670. @section copy
  5671. Copy the input video source unchanged to the output. This is mainly useful for
  5672. testing purposes.
  5673. @anchor{coreimage}
  5674. @section coreimage
  5675. Video filtering on GPU using Apple's CoreImage API on OSX.
  5676. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5677. processed by video hardware. However, software-based OpenGL implementations
  5678. exist which means there is no guarantee for hardware processing. It depends on
  5679. the respective OSX.
  5680. There are many filters and image generators provided by Apple that come with a
  5681. large variety of options. The filter has to be referenced by its name along
  5682. with its options.
  5683. The coreimage filter accepts the following options:
  5684. @table @option
  5685. @item list_filters
  5686. List all available filters and generators along with all their respective
  5687. options as well as possible minimum and maximum values along with the default
  5688. values.
  5689. @example
  5690. list_filters=true
  5691. @end example
  5692. @item filter
  5693. Specify all filters by their respective name and options.
  5694. Use @var{list_filters} to determine all valid filter names and options.
  5695. Numerical options are specified by a float value and are automatically clamped
  5696. to their respective value range. Vector and color options have to be specified
  5697. by a list of space separated float values. Character escaping has to be done.
  5698. A special option name @code{default} is available to use default options for a
  5699. filter.
  5700. It is required to specify either @code{default} or at least one of the filter options.
  5701. All omitted options are used with their default values.
  5702. The syntax of the filter string is as follows:
  5703. @example
  5704. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5705. @end example
  5706. @item output_rect
  5707. Specify a rectangle where the output of the filter chain is copied into the
  5708. input image. It is given by a list of space separated float values:
  5709. @example
  5710. output_rect=x\ y\ width\ height
  5711. @end example
  5712. If not given, the output rectangle equals the dimensions of the input image.
  5713. The output rectangle is automatically cropped at the borders of the input
  5714. image. Negative values are valid for each component.
  5715. @example
  5716. output_rect=25\ 25\ 100\ 100
  5717. @end example
  5718. @end table
  5719. Several filters can be chained for successive processing without GPU-HOST
  5720. transfers allowing for fast processing of complex filter chains.
  5721. Currently, only filters with zero (generators) or exactly one (filters) input
  5722. image and one output image are supported. Also, transition filters are not yet
  5723. usable as intended.
  5724. Some filters generate output images with additional padding depending on the
  5725. respective filter kernel. The padding is automatically removed to ensure the
  5726. filter output has the same size as the input image.
  5727. For image generators, the size of the output image is determined by the
  5728. previous output image of the filter chain or the input image of the whole
  5729. filterchain, respectively. The generators do not use the pixel information of
  5730. this image to generate their output. However, the generated output is
  5731. blended onto this image, resulting in partial or complete coverage of the
  5732. output image.
  5733. The @ref{coreimagesrc} video source can be used for generating input images
  5734. which are directly fed into the filter chain. By using it, providing input
  5735. images by another video source or an input video is not required.
  5736. @subsection Examples
  5737. @itemize
  5738. @item
  5739. List all filters available:
  5740. @example
  5741. coreimage=list_filters=true
  5742. @end example
  5743. @item
  5744. Use the CIBoxBlur filter with default options to blur an image:
  5745. @example
  5746. coreimage=filter=CIBoxBlur@@default
  5747. @end example
  5748. @item
  5749. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5750. its center at 100x100 and a radius of 50 pixels:
  5751. @example
  5752. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5753. @end example
  5754. @item
  5755. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5756. given as complete and escaped command-line for Apple's standard bash shell:
  5757. @example
  5758. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5759. @end example
  5760. @end itemize
  5761. @section crop
  5762. Crop the input video to given dimensions.
  5763. It accepts the following parameters:
  5764. @table @option
  5765. @item w, out_w
  5766. The width of the output video. It defaults to @code{iw}.
  5767. This expression is evaluated only once during the filter
  5768. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5769. @item h, out_h
  5770. The height of the output video. It defaults to @code{ih}.
  5771. This expression is evaluated only once during the filter
  5772. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5773. @item x
  5774. The horizontal position, in the input video, of the left edge of the output
  5775. video. It defaults to @code{(in_w-out_w)/2}.
  5776. This expression is evaluated per-frame.
  5777. @item y
  5778. The vertical position, in the input video, of the top edge of the output video.
  5779. It defaults to @code{(in_h-out_h)/2}.
  5780. This expression is evaluated per-frame.
  5781. @item keep_aspect
  5782. If set to 1 will force the output display aspect ratio
  5783. to be the same of the input, by changing the output sample aspect
  5784. ratio. It defaults to 0.
  5785. @item exact
  5786. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5787. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5788. It defaults to 0.
  5789. @end table
  5790. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5791. expressions containing the following constants:
  5792. @table @option
  5793. @item x
  5794. @item y
  5795. The computed values for @var{x} and @var{y}. They are evaluated for
  5796. each new frame.
  5797. @item in_w
  5798. @item in_h
  5799. The input width and height.
  5800. @item iw
  5801. @item ih
  5802. These are the same as @var{in_w} and @var{in_h}.
  5803. @item out_w
  5804. @item out_h
  5805. The output (cropped) width and height.
  5806. @item ow
  5807. @item oh
  5808. These are the same as @var{out_w} and @var{out_h}.
  5809. @item a
  5810. same as @var{iw} / @var{ih}
  5811. @item sar
  5812. input sample aspect ratio
  5813. @item dar
  5814. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5815. @item hsub
  5816. @item vsub
  5817. horizontal and vertical chroma subsample values. For example for the
  5818. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5819. @item n
  5820. The number of the input frame, starting from 0.
  5821. @item pos
  5822. the position in the file of the input frame, NAN if unknown
  5823. @item t
  5824. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5825. @end table
  5826. The expression for @var{out_w} may depend on the value of @var{out_h},
  5827. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5828. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5829. evaluated after @var{out_w} and @var{out_h}.
  5830. The @var{x} and @var{y} parameters specify the expressions for the
  5831. position of the top-left corner of the output (non-cropped) area. They
  5832. are evaluated for each frame. If the evaluated value is not valid, it
  5833. is approximated to the nearest valid value.
  5834. The expression for @var{x} may depend on @var{y}, and the expression
  5835. for @var{y} may depend on @var{x}.
  5836. @subsection Examples
  5837. @itemize
  5838. @item
  5839. Crop area with size 100x100 at position (12,34).
  5840. @example
  5841. crop=100:100:12:34
  5842. @end example
  5843. Using named options, the example above becomes:
  5844. @example
  5845. crop=w=100:h=100:x=12:y=34
  5846. @end example
  5847. @item
  5848. Crop the central input area with size 100x100:
  5849. @example
  5850. crop=100:100
  5851. @end example
  5852. @item
  5853. Crop the central input area with size 2/3 of the input video:
  5854. @example
  5855. crop=2/3*in_w:2/3*in_h
  5856. @end example
  5857. @item
  5858. Crop the input video central square:
  5859. @example
  5860. crop=out_w=in_h
  5861. crop=in_h
  5862. @end example
  5863. @item
  5864. Delimit the rectangle with the top-left corner placed at position
  5865. 100:100 and the right-bottom corner corresponding to the right-bottom
  5866. corner of the input image.
  5867. @example
  5868. crop=in_w-100:in_h-100:100:100
  5869. @end example
  5870. @item
  5871. Crop 10 pixels from the left and right borders, and 20 pixels from
  5872. the top and bottom borders
  5873. @example
  5874. crop=in_w-2*10:in_h-2*20
  5875. @end example
  5876. @item
  5877. Keep only the bottom right quarter of the input image:
  5878. @example
  5879. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5880. @end example
  5881. @item
  5882. Crop height for getting Greek harmony:
  5883. @example
  5884. crop=in_w:1/PHI*in_w
  5885. @end example
  5886. @item
  5887. Apply trembling effect:
  5888. @example
  5889. 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)
  5890. @end example
  5891. @item
  5892. Apply erratic camera effect depending on timestamp:
  5893. @example
  5894. 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)"
  5895. @end example
  5896. @item
  5897. Set x depending on the value of y:
  5898. @example
  5899. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5900. @end example
  5901. @end itemize
  5902. @subsection Commands
  5903. This filter supports the following commands:
  5904. @table @option
  5905. @item w, out_w
  5906. @item h, out_h
  5907. @item x
  5908. @item y
  5909. Set width/height of the output video and the horizontal/vertical position
  5910. in the input video.
  5911. The command accepts the same syntax of the corresponding option.
  5912. If the specified expression is not valid, it is kept at its current
  5913. value.
  5914. @end table
  5915. @section cropdetect
  5916. Auto-detect the crop size.
  5917. It calculates the necessary cropping parameters and prints the
  5918. recommended parameters via the logging system. The detected dimensions
  5919. correspond to the non-black area of the input video.
  5920. It accepts the following parameters:
  5921. @table @option
  5922. @item limit
  5923. Set higher black value threshold, which can be optionally specified
  5924. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5925. value greater to the set value is considered non-black. It defaults to 24.
  5926. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5927. on the bitdepth of the pixel format.
  5928. @item round
  5929. The value which the width/height should be divisible by. It defaults to
  5930. 16. The offset is automatically adjusted to center the video. Use 2 to
  5931. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5932. encoding to most video codecs.
  5933. @item reset_count, reset
  5934. Set the counter that determines after how many frames cropdetect will
  5935. reset the previously detected largest video area and start over to
  5936. detect the current optimal crop area. Default value is 0.
  5937. This can be useful when channel logos distort the video area. 0
  5938. indicates 'never reset', and returns the largest area encountered during
  5939. playback.
  5940. @end table
  5941. @anchor{cue}
  5942. @section cue
  5943. Delay video filtering until a given wallclock timestamp. The filter first
  5944. passes on @option{preroll} amount of frames, then it buffers at most
  5945. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5946. it forwards the buffered frames and also any subsequent frames coming in its
  5947. input.
  5948. The filter can be used synchronize the output of multiple ffmpeg processes for
  5949. realtime output devices like decklink. By putting the delay in the filtering
  5950. chain and pre-buffering frames the process can pass on data to output almost
  5951. immediately after the target wallclock timestamp is reached.
  5952. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5953. some use cases.
  5954. @table @option
  5955. @item cue
  5956. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5957. @item preroll
  5958. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5959. @item buffer
  5960. The maximum duration of content to buffer before waiting for the cue expressed
  5961. in seconds. Default is 0.
  5962. @end table
  5963. @anchor{curves}
  5964. @section curves
  5965. Apply color adjustments using curves.
  5966. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5967. component (red, green and blue) has its values defined by @var{N} key points
  5968. tied from each other using a smooth curve. The x-axis represents the pixel
  5969. values from the input frame, and the y-axis the new pixel values to be set for
  5970. the output frame.
  5971. By default, a component curve is defined by the two points @var{(0;0)} and
  5972. @var{(1;1)}. This creates a straight line where each original pixel value is
  5973. "adjusted" to its own value, which means no change to the image.
  5974. The filter allows you to redefine these two points and add some more. A new
  5975. curve (using a natural cubic spline interpolation) will be define to pass
  5976. smoothly through all these new coordinates. The new defined points needs to be
  5977. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5978. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5979. the vector spaces, the values will be clipped accordingly.
  5980. The filter accepts the following options:
  5981. @table @option
  5982. @item preset
  5983. Select one of the available color presets. This option can be used in addition
  5984. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5985. options takes priority on the preset values.
  5986. Available presets are:
  5987. @table @samp
  5988. @item none
  5989. @item color_negative
  5990. @item cross_process
  5991. @item darker
  5992. @item increase_contrast
  5993. @item lighter
  5994. @item linear_contrast
  5995. @item medium_contrast
  5996. @item negative
  5997. @item strong_contrast
  5998. @item vintage
  5999. @end table
  6000. Default is @code{none}.
  6001. @item master, m
  6002. Set the master key points. These points will define a second pass mapping. It
  6003. is sometimes called a "luminance" or "value" mapping. It can be used with
  6004. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6005. post-processing LUT.
  6006. @item red, r
  6007. Set the key points for the red component.
  6008. @item green, g
  6009. Set the key points for the green component.
  6010. @item blue, b
  6011. Set the key points for the blue component.
  6012. @item all
  6013. Set the key points for all components (not including master).
  6014. Can be used in addition to the other key points component
  6015. options. In this case, the unset component(s) will fallback on this
  6016. @option{all} setting.
  6017. @item psfile
  6018. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6019. @item plot
  6020. Save Gnuplot script of the curves in specified file.
  6021. @end table
  6022. To avoid some filtergraph syntax conflicts, each key points list need to be
  6023. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6024. @subsection Examples
  6025. @itemize
  6026. @item
  6027. Increase slightly the middle level of blue:
  6028. @example
  6029. curves=blue='0/0 0.5/0.58 1/1'
  6030. @end example
  6031. @item
  6032. Vintage effect:
  6033. @example
  6034. 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'
  6035. @end example
  6036. Here we obtain the following coordinates for each components:
  6037. @table @var
  6038. @item red
  6039. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6040. @item green
  6041. @code{(0;0) (0.50;0.48) (1;1)}
  6042. @item blue
  6043. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6044. @end table
  6045. @item
  6046. The previous example can also be achieved with the associated built-in preset:
  6047. @example
  6048. curves=preset=vintage
  6049. @end example
  6050. @item
  6051. Or simply:
  6052. @example
  6053. curves=vintage
  6054. @end example
  6055. @item
  6056. Use a Photoshop preset and redefine the points of the green component:
  6057. @example
  6058. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6059. @end example
  6060. @item
  6061. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6062. and @command{gnuplot}:
  6063. @example
  6064. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6065. gnuplot -p /tmp/curves.plt
  6066. @end example
  6067. @end itemize
  6068. @section datascope
  6069. Video data analysis filter.
  6070. This filter shows hexadecimal pixel values of part of video.
  6071. The filter accepts the following options:
  6072. @table @option
  6073. @item size, s
  6074. Set output video size.
  6075. @item x
  6076. Set x offset from where to pick pixels.
  6077. @item y
  6078. Set y offset from where to pick pixels.
  6079. @item mode
  6080. Set scope mode, can be one of the following:
  6081. @table @samp
  6082. @item mono
  6083. Draw hexadecimal pixel values with white color on black background.
  6084. @item color
  6085. Draw hexadecimal pixel values with input video pixel color on black
  6086. background.
  6087. @item color2
  6088. Draw hexadecimal pixel values on color background picked from input video,
  6089. the text color is picked in such way so its always visible.
  6090. @end table
  6091. @item axis
  6092. Draw rows and columns numbers on left and top of video.
  6093. @item opacity
  6094. Set background opacity.
  6095. @end table
  6096. @section dctdnoiz
  6097. Denoise frames using 2D DCT (frequency domain filtering).
  6098. This filter is not designed for real time.
  6099. The filter accepts the following options:
  6100. @table @option
  6101. @item sigma, s
  6102. Set the noise sigma constant.
  6103. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6104. coefficient (absolute value) below this threshold with be dropped.
  6105. If you need a more advanced filtering, see @option{expr}.
  6106. Default is @code{0}.
  6107. @item overlap
  6108. Set number overlapping pixels for each block. Since the filter can be slow, you
  6109. may want to reduce this value, at the cost of a less effective filter and the
  6110. risk of various artefacts.
  6111. If the overlapping value doesn't permit processing the whole input width or
  6112. height, a warning will be displayed and according borders won't be denoised.
  6113. Default value is @var{blocksize}-1, which is the best possible setting.
  6114. @item expr, e
  6115. Set the coefficient factor expression.
  6116. For each coefficient of a DCT block, this expression will be evaluated as a
  6117. multiplier value for the coefficient.
  6118. If this is option is set, the @option{sigma} option will be ignored.
  6119. The absolute value of the coefficient can be accessed through the @var{c}
  6120. variable.
  6121. @item n
  6122. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6123. @var{blocksize}, which is the width and height of the processed blocks.
  6124. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6125. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6126. on the speed processing. Also, a larger block size does not necessarily means a
  6127. better de-noising.
  6128. @end table
  6129. @subsection Examples
  6130. Apply a denoise with a @option{sigma} of @code{4.5}:
  6131. @example
  6132. dctdnoiz=4.5
  6133. @end example
  6134. The same operation can be achieved using the expression system:
  6135. @example
  6136. dctdnoiz=e='gte(c, 4.5*3)'
  6137. @end example
  6138. Violent denoise using a block size of @code{16x16}:
  6139. @example
  6140. dctdnoiz=15:n=4
  6141. @end example
  6142. @section deband
  6143. Remove banding artifacts from input video.
  6144. It works by replacing banded pixels with average value of referenced pixels.
  6145. The filter accepts the following options:
  6146. @table @option
  6147. @item 1thr
  6148. @item 2thr
  6149. @item 3thr
  6150. @item 4thr
  6151. Set banding detection threshold for each plane. Default is 0.02.
  6152. Valid range is 0.00003 to 0.5.
  6153. If difference between current pixel and reference pixel is less than threshold,
  6154. it will be considered as banded.
  6155. @item range, r
  6156. Banding detection range in pixels. Default is 16. If positive, random number
  6157. in range 0 to set value will be used. If negative, exact absolute value
  6158. will be used.
  6159. The range defines square of four pixels around current pixel.
  6160. @item direction, d
  6161. Set direction in radians from which four pixel will be compared. If positive,
  6162. random direction from 0 to set direction will be picked. If negative, exact of
  6163. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6164. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6165. column.
  6166. @item blur, b
  6167. If enabled, current pixel is compared with average value of all four
  6168. surrounding pixels. The default is enabled. If disabled current pixel is
  6169. compared with all four surrounding pixels. The pixel is considered banded
  6170. if only all four differences with surrounding pixels are less than threshold.
  6171. @item coupling, c
  6172. If enabled, current pixel is changed if and only if all pixel components are banded,
  6173. e.g. banding detection threshold is triggered for all color components.
  6174. The default is disabled.
  6175. @end table
  6176. @section deblock
  6177. Remove blocking artifacts from input video.
  6178. The filter accepts the following options:
  6179. @table @option
  6180. @item filter
  6181. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6182. This controls what kind of deblocking is applied.
  6183. @item block
  6184. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6185. @item alpha
  6186. @item beta
  6187. @item gamma
  6188. @item delta
  6189. Set blocking detection thresholds. Allowed range is 0 to 1.
  6190. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6191. Using higher threshold gives more deblocking strength.
  6192. Setting @var{alpha} controls threshold detection at exact edge of block.
  6193. Remaining options controls threshold detection near the edge. Each one for
  6194. below/above or left/right. Setting any of those to @var{0} disables
  6195. deblocking.
  6196. @item planes
  6197. Set planes to filter. Default is to filter all available planes.
  6198. @end table
  6199. @subsection Examples
  6200. @itemize
  6201. @item
  6202. Deblock using weak filter and block size of 4 pixels.
  6203. @example
  6204. deblock=filter=weak:block=4
  6205. @end example
  6206. @item
  6207. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6208. deblocking more edges.
  6209. @example
  6210. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6211. @end example
  6212. @item
  6213. Similar as above, but filter only first plane.
  6214. @example
  6215. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6216. @end example
  6217. @item
  6218. Similar as above, but filter only second and third plane.
  6219. @example
  6220. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6221. @end example
  6222. @end itemize
  6223. @anchor{decimate}
  6224. @section decimate
  6225. Drop duplicated frames at regular intervals.
  6226. The filter accepts the following options:
  6227. @table @option
  6228. @item cycle
  6229. Set the number of frames from which one will be dropped. Setting this to
  6230. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6231. Default is @code{5}.
  6232. @item dupthresh
  6233. Set the threshold for duplicate detection. If the difference metric for a frame
  6234. is less than or equal to this value, then it is declared as duplicate. Default
  6235. is @code{1.1}
  6236. @item scthresh
  6237. Set scene change threshold. Default is @code{15}.
  6238. @item blockx
  6239. @item blocky
  6240. Set the size of the x and y-axis blocks used during metric calculations.
  6241. Larger blocks give better noise suppression, but also give worse detection of
  6242. small movements. Must be a power of two. Default is @code{32}.
  6243. @item ppsrc
  6244. Mark main input as a pre-processed input and activate clean source input
  6245. stream. This allows the input to be pre-processed with various filters to help
  6246. the metrics calculation while keeping the frame selection lossless. When set to
  6247. @code{1}, the first stream is for the pre-processed input, and the second
  6248. stream is the clean source from where the kept frames are chosen. Default is
  6249. @code{0}.
  6250. @item chroma
  6251. Set whether or not chroma is considered in the metric calculations. Default is
  6252. @code{1}.
  6253. @end table
  6254. @section deconvolve
  6255. Apply 2D deconvolution of video stream in frequency domain using second stream
  6256. as impulse.
  6257. The filter accepts the following options:
  6258. @table @option
  6259. @item planes
  6260. Set which planes to process.
  6261. @item impulse
  6262. Set which impulse video frames will be processed, can be @var{first}
  6263. or @var{all}. Default is @var{all}.
  6264. @item noise
  6265. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6266. and height are not same and not power of 2 or if stream prior to convolving
  6267. had noise.
  6268. @end table
  6269. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6270. @section dedot
  6271. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6272. It accepts the following options:
  6273. @table @option
  6274. @item m
  6275. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6276. @var{rainbows} for cross-color reduction.
  6277. @item lt
  6278. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6279. @item tl
  6280. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6281. @item tc
  6282. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6283. @item ct
  6284. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6285. @end table
  6286. @section deflate
  6287. Apply deflate effect to the video.
  6288. This filter replaces the pixel by the local(3x3) average by taking into account
  6289. only values lower than the pixel.
  6290. It accepts the following options:
  6291. @table @option
  6292. @item threshold0
  6293. @item threshold1
  6294. @item threshold2
  6295. @item threshold3
  6296. Limit the maximum change for each plane, default is 65535.
  6297. If 0, plane will remain unchanged.
  6298. @end table
  6299. @section deflicker
  6300. Remove temporal frame luminance variations.
  6301. It accepts the following options:
  6302. @table @option
  6303. @item size, s
  6304. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6305. @item mode, m
  6306. Set averaging mode to smooth temporal luminance variations.
  6307. Available values are:
  6308. @table @samp
  6309. @item am
  6310. Arithmetic mean
  6311. @item gm
  6312. Geometric mean
  6313. @item hm
  6314. Harmonic mean
  6315. @item qm
  6316. Quadratic mean
  6317. @item cm
  6318. Cubic mean
  6319. @item pm
  6320. Power mean
  6321. @item median
  6322. Median
  6323. @end table
  6324. @item bypass
  6325. Do not actually modify frame. Useful when one only wants metadata.
  6326. @end table
  6327. @section dejudder
  6328. Remove judder produced by partially interlaced telecined content.
  6329. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6330. source was partially telecined content then the output of @code{pullup,dejudder}
  6331. will have a variable frame rate. May change the recorded frame rate of the
  6332. container. Aside from that change, this filter will not affect constant frame
  6333. rate video.
  6334. The option available in this filter is:
  6335. @table @option
  6336. @item cycle
  6337. Specify the length of the window over which the judder repeats.
  6338. Accepts any integer greater than 1. Useful values are:
  6339. @table @samp
  6340. @item 4
  6341. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6342. @item 5
  6343. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6344. @item 20
  6345. If a mixture of the two.
  6346. @end table
  6347. The default is @samp{4}.
  6348. @end table
  6349. @section delogo
  6350. Suppress a TV station logo by a simple interpolation of the surrounding
  6351. pixels. Just set a rectangle covering the logo and watch it disappear
  6352. (and sometimes something even uglier appear - your mileage may vary).
  6353. It accepts the following parameters:
  6354. @table @option
  6355. @item x
  6356. @item y
  6357. Specify the top left corner coordinates of the logo. They must be
  6358. specified.
  6359. @item w
  6360. @item h
  6361. Specify the width and height of the logo to clear. They must be
  6362. specified.
  6363. @item band, t
  6364. Specify the thickness of the fuzzy edge of the rectangle (added to
  6365. @var{w} and @var{h}). The default value is 1. This option is
  6366. deprecated, setting higher values should no longer be necessary and
  6367. is not recommended.
  6368. @item show
  6369. When set to 1, a green rectangle is drawn on the screen to simplify
  6370. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6371. The default value is 0.
  6372. The rectangle is drawn on the outermost pixels which will be (partly)
  6373. replaced with interpolated values. The values of the next pixels
  6374. immediately outside this rectangle in each direction will be used to
  6375. compute the interpolated pixel values inside the rectangle.
  6376. @end table
  6377. @subsection Examples
  6378. @itemize
  6379. @item
  6380. Set a rectangle covering the area with top left corner coordinates 0,0
  6381. and size 100x77, and a band of size 10:
  6382. @example
  6383. delogo=x=0:y=0:w=100:h=77:band=10
  6384. @end example
  6385. @end itemize
  6386. @section derain
  6387. Remove the rain in the input image/video by applying the derain methods based on
  6388. convolutional neural networks. Supported models:
  6389. @itemize
  6390. @item
  6391. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6392. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6393. @end itemize
  6394. Training scripts as well as scripts for model generation are provided in
  6395. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6396. The filter accepts the following options:
  6397. @table @option
  6398. @item dnn_backend
  6399. Specify which DNN backend to use for model loading and execution. This option accepts
  6400. the following values:
  6401. @table @samp
  6402. @item native
  6403. Native implementation of DNN loading and execution.
  6404. @end table
  6405. Default value is @samp{native}.
  6406. @item model
  6407. Set path to model file specifying network architecture and its parameters.
  6408. Note that different backends use different file formats. TensorFlow backend
  6409. can load files for both formats, while native backend can load files for only
  6410. its format.
  6411. @end table
  6412. @section deshake
  6413. Attempt to fix small changes in horizontal and/or vertical shift. This
  6414. filter helps remove camera shake from hand-holding a camera, bumping a
  6415. tripod, moving on a vehicle, etc.
  6416. The filter accepts the following options:
  6417. @table @option
  6418. @item x
  6419. @item y
  6420. @item w
  6421. @item h
  6422. Specify a rectangular area where to limit the search for motion
  6423. vectors.
  6424. If desired the search for motion vectors can be limited to a
  6425. rectangular area of the frame defined by its top left corner, width
  6426. and height. These parameters have the same meaning as the drawbox
  6427. filter which can be used to visualise the position of the bounding
  6428. box.
  6429. This is useful when simultaneous movement of subjects within the frame
  6430. might be confused for camera motion by the motion vector search.
  6431. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6432. then the full frame is used. This allows later options to be set
  6433. without specifying the bounding box for the motion vector search.
  6434. Default - search the whole frame.
  6435. @item rx
  6436. @item ry
  6437. Specify the maximum extent of movement in x and y directions in the
  6438. range 0-64 pixels. Default 16.
  6439. @item edge
  6440. Specify how to generate pixels to fill blanks at the edge of the
  6441. frame. Available values are:
  6442. @table @samp
  6443. @item blank, 0
  6444. Fill zeroes at blank locations
  6445. @item original, 1
  6446. Original image at blank locations
  6447. @item clamp, 2
  6448. Extruded edge value at blank locations
  6449. @item mirror, 3
  6450. Mirrored edge at blank locations
  6451. @end table
  6452. Default value is @samp{mirror}.
  6453. @item blocksize
  6454. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6455. default 8.
  6456. @item contrast
  6457. Specify the contrast threshold for blocks. Only blocks with more than
  6458. the specified contrast (difference between darkest and lightest
  6459. pixels) will be considered. Range 1-255, default 125.
  6460. @item search
  6461. Specify the search strategy. Available values are:
  6462. @table @samp
  6463. @item exhaustive, 0
  6464. Set exhaustive search
  6465. @item less, 1
  6466. Set less exhaustive search.
  6467. @end table
  6468. Default value is @samp{exhaustive}.
  6469. @item filename
  6470. If set then a detailed log of the motion search is written to the
  6471. specified file.
  6472. @end table
  6473. @section despill
  6474. Remove unwanted contamination of foreground colors, caused by reflected color of
  6475. greenscreen or bluescreen.
  6476. This filter accepts the following options:
  6477. @table @option
  6478. @item type
  6479. Set what type of despill to use.
  6480. @item mix
  6481. Set how spillmap will be generated.
  6482. @item expand
  6483. Set how much to get rid of still remaining spill.
  6484. @item red
  6485. Controls amount of red in spill area.
  6486. @item green
  6487. Controls amount of green in spill area.
  6488. Should be -1 for greenscreen.
  6489. @item blue
  6490. Controls amount of blue in spill area.
  6491. Should be -1 for bluescreen.
  6492. @item brightness
  6493. Controls brightness of spill area, preserving colors.
  6494. @item alpha
  6495. Modify alpha from generated spillmap.
  6496. @end table
  6497. @section detelecine
  6498. Apply an exact inverse of the telecine operation. It requires a predefined
  6499. pattern specified using the pattern option which must be the same as that passed
  6500. to the telecine filter.
  6501. This filter accepts the following options:
  6502. @table @option
  6503. @item first_field
  6504. @table @samp
  6505. @item top, t
  6506. top field first
  6507. @item bottom, b
  6508. bottom field first
  6509. The default value is @code{top}.
  6510. @end table
  6511. @item pattern
  6512. A string of numbers representing the pulldown pattern you wish to apply.
  6513. The default value is @code{23}.
  6514. @item start_frame
  6515. A number representing position of the first frame with respect to the telecine
  6516. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6517. @end table
  6518. @section dilation
  6519. Apply dilation effect to the video.
  6520. This filter replaces the pixel by the local(3x3) maximum.
  6521. It accepts the following options:
  6522. @table @option
  6523. @item threshold0
  6524. @item threshold1
  6525. @item threshold2
  6526. @item threshold3
  6527. Limit the maximum change for each plane, default is 65535.
  6528. If 0, plane will remain unchanged.
  6529. @item coordinates
  6530. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6531. pixels are used.
  6532. Flags to local 3x3 coordinates maps like this:
  6533. 1 2 3
  6534. 4 5
  6535. 6 7 8
  6536. @end table
  6537. @section displace
  6538. Displace pixels as indicated by second and third input stream.
  6539. It takes three input streams and outputs one stream, the first input is the
  6540. source, and second and third input are displacement maps.
  6541. The second input specifies how much to displace pixels along the
  6542. x-axis, while the third input specifies how much to displace pixels
  6543. along the y-axis.
  6544. If one of displacement map streams terminates, last frame from that
  6545. displacement map will be used.
  6546. Note that once generated, displacements maps can be reused over and over again.
  6547. A description of the accepted options follows.
  6548. @table @option
  6549. @item edge
  6550. Set displace behavior for pixels that are out of range.
  6551. Available values are:
  6552. @table @samp
  6553. @item blank
  6554. Missing pixels are replaced by black pixels.
  6555. @item smear
  6556. Adjacent pixels will spread out to replace missing pixels.
  6557. @item wrap
  6558. Out of range pixels are wrapped so they point to pixels of other side.
  6559. @item mirror
  6560. Out of range pixels will be replaced with mirrored pixels.
  6561. @end table
  6562. Default is @samp{smear}.
  6563. @end table
  6564. @subsection Examples
  6565. @itemize
  6566. @item
  6567. Add ripple effect to rgb input of video size hd720:
  6568. @example
  6569. 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
  6570. @end example
  6571. @item
  6572. Add wave effect to rgb input of video size hd720:
  6573. @example
  6574. 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
  6575. @end example
  6576. @end itemize
  6577. @section drawbox
  6578. Draw a colored box on the input image.
  6579. It accepts the following parameters:
  6580. @table @option
  6581. @item x
  6582. @item y
  6583. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6584. @item width, w
  6585. @item height, h
  6586. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6587. the input width and height. It defaults to 0.
  6588. @item color, c
  6589. Specify the color of the box to write. For the general syntax of this option,
  6590. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6591. value @code{invert} is used, the box edge color is the same as the
  6592. video with inverted luma.
  6593. @item thickness, t
  6594. The expression which sets the thickness of the box edge.
  6595. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6596. See below for the list of accepted constants.
  6597. @item replace
  6598. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6599. will overwrite the video's color and alpha pixels.
  6600. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6601. @end table
  6602. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6603. following constants:
  6604. @table @option
  6605. @item dar
  6606. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6607. @item hsub
  6608. @item vsub
  6609. horizontal and vertical chroma subsample values. For example for the
  6610. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6611. @item in_h, ih
  6612. @item in_w, iw
  6613. The input width and height.
  6614. @item sar
  6615. The input sample aspect ratio.
  6616. @item x
  6617. @item y
  6618. The x and y offset coordinates where the box is drawn.
  6619. @item w
  6620. @item h
  6621. The width and height of the drawn box.
  6622. @item t
  6623. The thickness of the drawn box.
  6624. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6625. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6626. @end table
  6627. @subsection Examples
  6628. @itemize
  6629. @item
  6630. Draw a black box around the edge of the input image:
  6631. @example
  6632. drawbox
  6633. @end example
  6634. @item
  6635. Draw a box with color red and an opacity of 50%:
  6636. @example
  6637. drawbox=10:20:200:60:red@@0.5
  6638. @end example
  6639. The previous example can be specified as:
  6640. @example
  6641. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6642. @end example
  6643. @item
  6644. Fill the box with pink color:
  6645. @example
  6646. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6647. @end example
  6648. @item
  6649. Draw a 2-pixel red 2.40:1 mask:
  6650. @example
  6651. 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
  6652. @end example
  6653. @end itemize
  6654. @section drawgrid
  6655. Draw a grid on the input image.
  6656. It accepts the following parameters:
  6657. @table @option
  6658. @item x
  6659. @item y
  6660. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6661. @item width, w
  6662. @item height, h
  6663. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6664. input width and height, respectively, minus @code{thickness}, so image gets
  6665. framed. Default to 0.
  6666. @item color, c
  6667. Specify the color of the grid. For the general syntax of this option,
  6668. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6669. value @code{invert} is used, the grid color is the same as the
  6670. video with inverted luma.
  6671. @item thickness, t
  6672. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6673. See below for the list of accepted constants.
  6674. @item replace
  6675. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6676. will overwrite the video's color and alpha pixels.
  6677. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6678. @end table
  6679. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6680. following constants:
  6681. @table @option
  6682. @item dar
  6683. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6684. @item hsub
  6685. @item vsub
  6686. horizontal and vertical chroma subsample values. For example for the
  6687. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6688. @item in_h, ih
  6689. @item in_w, iw
  6690. The input grid cell width and height.
  6691. @item sar
  6692. The input sample aspect ratio.
  6693. @item x
  6694. @item y
  6695. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6696. @item w
  6697. @item h
  6698. The width and height of the drawn cell.
  6699. @item t
  6700. The thickness of the drawn cell.
  6701. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6702. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6703. @end table
  6704. @subsection Examples
  6705. @itemize
  6706. @item
  6707. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6708. @example
  6709. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6710. @end example
  6711. @item
  6712. Draw a white 3x3 grid with an opacity of 50%:
  6713. @example
  6714. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6715. @end example
  6716. @end itemize
  6717. @anchor{drawtext}
  6718. @section drawtext
  6719. Draw a text string or text from a specified file on top of a video, using the
  6720. libfreetype library.
  6721. To enable compilation of this filter, you need to configure FFmpeg with
  6722. @code{--enable-libfreetype}.
  6723. To enable default font fallback and the @var{font} option you need to
  6724. configure FFmpeg with @code{--enable-libfontconfig}.
  6725. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6726. @code{--enable-libfribidi}.
  6727. @subsection Syntax
  6728. It accepts the following parameters:
  6729. @table @option
  6730. @item box
  6731. Used to draw a box around text using the background color.
  6732. The value must be either 1 (enable) or 0 (disable).
  6733. The default value of @var{box} is 0.
  6734. @item boxborderw
  6735. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6736. The default value of @var{boxborderw} is 0.
  6737. @item boxcolor
  6738. The color to be used for drawing box around text. For the syntax of this
  6739. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6740. The default value of @var{boxcolor} is "white".
  6741. @item line_spacing
  6742. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6743. The default value of @var{line_spacing} is 0.
  6744. @item borderw
  6745. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6746. The default value of @var{borderw} is 0.
  6747. @item bordercolor
  6748. Set the color to be used for drawing border around text. For the syntax of this
  6749. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6750. The default value of @var{bordercolor} is "black".
  6751. @item expansion
  6752. Select how the @var{text} is expanded. Can be either @code{none},
  6753. @code{strftime} (deprecated) or
  6754. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6755. below for details.
  6756. @item basetime
  6757. Set a start time for the count. Value is in microseconds. Only applied
  6758. in the deprecated strftime expansion mode. To emulate in normal expansion
  6759. mode use the @code{pts} function, supplying the start time (in seconds)
  6760. as the second argument.
  6761. @item fix_bounds
  6762. If true, check and fix text coords to avoid clipping.
  6763. @item fontcolor
  6764. The color to be used for drawing fonts. For the syntax of this option, check
  6765. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6766. The default value of @var{fontcolor} is "black".
  6767. @item fontcolor_expr
  6768. String which is expanded the same way as @var{text} to obtain dynamic
  6769. @var{fontcolor} value. By default this option has empty value and is not
  6770. processed. When this option is set, it overrides @var{fontcolor} option.
  6771. @item font
  6772. The font family to be used for drawing text. By default Sans.
  6773. @item fontfile
  6774. The font file to be used for drawing text. The path must be included.
  6775. This parameter is mandatory if the fontconfig support is disabled.
  6776. @item alpha
  6777. Draw the text applying alpha blending. The value can
  6778. be a number between 0.0 and 1.0.
  6779. The expression accepts the same variables @var{x, y} as well.
  6780. The default value is 1.
  6781. Please see @var{fontcolor_expr}.
  6782. @item fontsize
  6783. The font size to be used for drawing text.
  6784. The default value of @var{fontsize} is 16.
  6785. @item text_shaping
  6786. If set to 1, attempt to shape the text (for example, reverse the order of
  6787. right-to-left text and join Arabic characters) before drawing it.
  6788. Otherwise, just draw the text exactly as given.
  6789. By default 1 (if supported).
  6790. @item ft_load_flags
  6791. The flags to be used for loading the fonts.
  6792. The flags map the corresponding flags supported by libfreetype, and are
  6793. a combination of the following values:
  6794. @table @var
  6795. @item default
  6796. @item no_scale
  6797. @item no_hinting
  6798. @item render
  6799. @item no_bitmap
  6800. @item vertical_layout
  6801. @item force_autohint
  6802. @item crop_bitmap
  6803. @item pedantic
  6804. @item ignore_global_advance_width
  6805. @item no_recurse
  6806. @item ignore_transform
  6807. @item monochrome
  6808. @item linear_design
  6809. @item no_autohint
  6810. @end table
  6811. Default value is "default".
  6812. For more information consult the documentation for the FT_LOAD_*
  6813. libfreetype flags.
  6814. @item shadowcolor
  6815. The color to be used for drawing a shadow behind the drawn text. For the
  6816. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6817. ffmpeg-utils manual,ffmpeg-utils}.
  6818. The default value of @var{shadowcolor} is "black".
  6819. @item shadowx
  6820. @item shadowy
  6821. The x and y offsets for the text shadow position with respect to the
  6822. position of the text. They can be either positive or negative
  6823. values. The default value for both is "0".
  6824. @item start_number
  6825. The starting frame number for the n/frame_num variable. The default value
  6826. is "0".
  6827. @item tabsize
  6828. The size in number of spaces to use for rendering the tab.
  6829. Default value is 4.
  6830. @item timecode
  6831. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6832. format. It can be used with or without text parameter. @var{timecode_rate}
  6833. option must be specified.
  6834. @item timecode_rate, rate, r
  6835. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6836. integer. Minimum value is "1".
  6837. Drop-frame timecode is supported for frame rates 30 & 60.
  6838. @item tc24hmax
  6839. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6840. Default is 0 (disabled).
  6841. @item text
  6842. The text string to be drawn. The text must be a sequence of UTF-8
  6843. encoded characters.
  6844. This parameter is mandatory if no file is specified with the parameter
  6845. @var{textfile}.
  6846. @item textfile
  6847. A text file containing text to be drawn. The text must be a sequence
  6848. of UTF-8 encoded characters.
  6849. This parameter is mandatory if no text string is specified with the
  6850. parameter @var{text}.
  6851. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6852. @item reload
  6853. If set to 1, the @var{textfile} will be reloaded before each frame.
  6854. Be sure to update it atomically, or it may be read partially, or even fail.
  6855. @item x
  6856. @item y
  6857. The expressions which specify the offsets where text will be drawn
  6858. within the video frame. They are relative to the top/left border of the
  6859. output image.
  6860. The default value of @var{x} and @var{y} is "0".
  6861. See below for the list of accepted constants and functions.
  6862. @end table
  6863. The parameters for @var{x} and @var{y} are expressions containing the
  6864. following constants and functions:
  6865. @table @option
  6866. @item dar
  6867. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6868. @item hsub
  6869. @item vsub
  6870. horizontal and vertical chroma subsample values. For example for the
  6871. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6872. @item line_h, lh
  6873. the height of each text line
  6874. @item main_h, h, H
  6875. the input height
  6876. @item main_w, w, W
  6877. the input width
  6878. @item max_glyph_a, ascent
  6879. the maximum distance from the baseline to the highest/upper grid
  6880. coordinate used to place a glyph outline point, for all the rendered
  6881. glyphs.
  6882. It is a positive value, due to the grid's orientation with the Y axis
  6883. upwards.
  6884. @item max_glyph_d, descent
  6885. the maximum distance from the baseline to the lowest grid coordinate
  6886. used to place a glyph outline point, for all the rendered glyphs.
  6887. This is a negative value, due to the grid's orientation, with the Y axis
  6888. upwards.
  6889. @item max_glyph_h
  6890. maximum glyph height, that is the maximum height for all the glyphs
  6891. contained in the rendered text, it is equivalent to @var{ascent} -
  6892. @var{descent}.
  6893. @item max_glyph_w
  6894. maximum glyph width, that is the maximum width for all the glyphs
  6895. contained in the rendered text
  6896. @item n
  6897. the number of input frame, starting from 0
  6898. @item rand(min, max)
  6899. return a random number included between @var{min} and @var{max}
  6900. @item sar
  6901. The input sample aspect ratio.
  6902. @item t
  6903. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6904. @item text_h, th
  6905. the height of the rendered text
  6906. @item text_w, tw
  6907. the width of the rendered text
  6908. @item x
  6909. @item y
  6910. the x and y offset coordinates where the text is drawn.
  6911. These parameters allow the @var{x} and @var{y} expressions to refer
  6912. to each other, so you can for example specify @code{y=x/dar}.
  6913. @item pict_type
  6914. A one character description of the current frame's picture type.
  6915. @item pkt_pos
  6916. The current packet's position in the input file or stream
  6917. (in bytes, from the start of the input). A value of -1 indicates
  6918. this info is not available.
  6919. @item pkt_duration
  6920. The current packet's duration, in seconds.
  6921. @item pkt_size
  6922. The current packet's size (in bytes).
  6923. @end table
  6924. @anchor{drawtext_expansion}
  6925. @subsection Text expansion
  6926. If @option{expansion} is set to @code{strftime},
  6927. the filter recognizes strftime() sequences in the provided text and
  6928. expands them accordingly. Check the documentation of strftime(). This
  6929. feature is deprecated.
  6930. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6931. If @option{expansion} is set to @code{normal} (which is the default),
  6932. the following expansion mechanism is used.
  6933. The backslash character @samp{\}, followed by any character, always expands to
  6934. the second character.
  6935. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6936. braces is a function name, possibly followed by arguments separated by ':'.
  6937. If the arguments contain special characters or delimiters (':' or '@}'),
  6938. they should be escaped.
  6939. Note that they probably must also be escaped as the value for the
  6940. @option{text} option in the filter argument string and as the filter
  6941. argument in the filtergraph description, and possibly also for the shell,
  6942. that makes up to four levels of escaping; using a text file avoids these
  6943. problems.
  6944. The following functions are available:
  6945. @table @command
  6946. @item expr, e
  6947. The expression evaluation result.
  6948. It must take one argument specifying the expression to be evaluated,
  6949. which accepts the same constants and functions as the @var{x} and
  6950. @var{y} values. Note that not all constants should be used, for
  6951. example the text size is not known when evaluating the expression, so
  6952. the constants @var{text_w} and @var{text_h} will have an undefined
  6953. value.
  6954. @item expr_int_format, eif
  6955. Evaluate the expression's value and output as formatted integer.
  6956. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6957. The second argument specifies the output format. Allowed values are @samp{x},
  6958. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6959. @code{printf} function.
  6960. The third parameter is optional and sets the number of positions taken by the output.
  6961. It can be used to add padding with zeros from the left.
  6962. @item gmtime
  6963. The time at which the filter is running, expressed in UTC.
  6964. It can accept an argument: a strftime() format string.
  6965. @item localtime
  6966. The time at which the filter is running, expressed in the local time zone.
  6967. It can accept an argument: a strftime() format string.
  6968. @item metadata
  6969. Frame metadata. Takes one or two arguments.
  6970. The first argument is mandatory and specifies the metadata key.
  6971. The second argument is optional and specifies a default value, used when the
  6972. metadata key is not found or empty.
  6973. Available metadata can be identified by inspecting entries
  6974. starting with TAG included within each frame section
  6975. printed by running @code{ffprobe -show_frames}.
  6976. String metadata generated in filters leading to
  6977. the drawtext filter are also available.
  6978. @item n, frame_num
  6979. The frame number, starting from 0.
  6980. @item pict_type
  6981. A one character description of the current picture type.
  6982. @item pts
  6983. The timestamp of the current frame.
  6984. It can take up to three arguments.
  6985. The first argument is the format of the timestamp; it defaults to @code{flt}
  6986. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6987. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6988. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6989. @code{localtime} stands for the timestamp of the frame formatted as
  6990. local time zone time.
  6991. The second argument is an offset added to the timestamp.
  6992. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6993. supplied to present the hour part of the formatted timestamp in 24h format
  6994. (00-23).
  6995. If the format is set to @code{localtime} or @code{gmtime},
  6996. a third argument may be supplied: a strftime() format string.
  6997. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6998. @end table
  6999. @subsection Commands
  7000. This filter supports altering parameters via commands:
  7001. @table @option
  7002. @item reinit
  7003. Alter existing filter parameters.
  7004. Syntax for the argument is the same as for filter invocation, e.g.
  7005. @example
  7006. fontsize=56:fontcolor=green:text='Hello World'
  7007. @end example
  7008. Full filter invocation with sendcmd would look like this:
  7009. @example
  7010. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7011. @end example
  7012. @end table
  7013. If the entire argument can't be parsed or applied as valid values then the filter will
  7014. continue with its existing parameters.
  7015. @subsection Examples
  7016. @itemize
  7017. @item
  7018. Draw "Test Text" with font FreeSerif, using the default values for the
  7019. optional parameters.
  7020. @example
  7021. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7022. @end example
  7023. @item
  7024. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7025. and y=50 (counting from the top-left corner of the screen), text is
  7026. yellow with a red box around it. Both the text and the box have an
  7027. opacity of 20%.
  7028. @example
  7029. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7030. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7031. @end example
  7032. Note that the double quotes are not necessary if spaces are not used
  7033. within the parameter list.
  7034. @item
  7035. Show the text at the center of the video frame:
  7036. @example
  7037. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7038. @end example
  7039. @item
  7040. Show the text at a random position, switching to a new position every 30 seconds:
  7041. @example
  7042. 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)"
  7043. @end example
  7044. @item
  7045. Show a text line sliding from right to left in the last row of the video
  7046. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7047. with no newlines.
  7048. @example
  7049. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7050. @end example
  7051. @item
  7052. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7053. @example
  7054. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7055. @end example
  7056. @item
  7057. Draw a single green letter "g", at the center of the input video.
  7058. The glyph baseline is placed at half screen height.
  7059. @example
  7060. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7061. @end example
  7062. @item
  7063. Show text for 1 second every 3 seconds:
  7064. @example
  7065. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7066. @end example
  7067. @item
  7068. Use fontconfig to set the font. Note that the colons need to be escaped.
  7069. @example
  7070. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7071. @end example
  7072. @item
  7073. Print the date of a real-time encoding (see strftime(3)):
  7074. @example
  7075. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7076. @end example
  7077. @item
  7078. Show text fading in and out (appearing/disappearing):
  7079. @example
  7080. #!/bin/sh
  7081. DS=1.0 # display start
  7082. DE=10.0 # display end
  7083. FID=1.5 # fade in duration
  7084. FOD=5 # fade out duration
  7085. 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 @}"
  7086. @end example
  7087. @item
  7088. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7089. and the @option{fontsize} value are included in the @option{y} offset.
  7090. @example
  7091. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7092. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7093. @end example
  7094. @end itemize
  7095. For more information about libfreetype, check:
  7096. @url{http://www.freetype.org/}.
  7097. For more information about fontconfig, check:
  7098. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7099. For more information about libfribidi, check:
  7100. @url{http://fribidi.org/}.
  7101. @section edgedetect
  7102. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7103. The filter accepts the following options:
  7104. @table @option
  7105. @item low
  7106. @item high
  7107. Set low and high threshold values used by the Canny thresholding
  7108. algorithm.
  7109. The high threshold selects the "strong" edge pixels, which are then
  7110. connected through 8-connectivity with the "weak" edge pixels selected
  7111. by the low threshold.
  7112. @var{low} and @var{high} threshold values must be chosen in the range
  7113. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7114. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7115. is @code{50/255}.
  7116. @item mode
  7117. Define the drawing mode.
  7118. @table @samp
  7119. @item wires
  7120. Draw white/gray wires on black background.
  7121. @item colormix
  7122. Mix the colors to create a paint/cartoon effect.
  7123. @item canny
  7124. Apply Canny edge detector on all selected planes.
  7125. @end table
  7126. Default value is @var{wires}.
  7127. @item planes
  7128. Select planes for filtering. By default all available planes are filtered.
  7129. @end table
  7130. @subsection Examples
  7131. @itemize
  7132. @item
  7133. Standard edge detection with custom values for the hysteresis thresholding:
  7134. @example
  7135. edgedetect=low=0.1:high=0.4
  7136. @end example
  7137. @item
  7138. Painting effect without thresholding:
  7139. @example
  7140. edgedetect=mode=colormix:high=0
  7141. @end example
  7142. @end itemize
  7143. @section eq
  7144. Set brightness, contrast, saturation and approximate gamma adjustment.
  7145. The filter accepts the following options:
  7146. @table @option
  7147. @item contrast
  7148. Set the contrast expression. The value must be a float value in range
  7149. @code{-2.0} to @code{2.0}. The default value is "1".
  7150. @item brightness
  7151. Set the brightness expression. The value must be a float value in
  7152. range @code{-1.0} to @code{1.0}. The default value is "0".
  7153. @item saturation
  7154. Set the saturation expression. The value must be a float in
  7155. range @code{0.0} to @code{3.0}. The default value is "1".
  7156. @item gamma
  7157. Set the gamma expression. The value must be a float in range
  7158. @code{0.1} to @code{10.0}. The default value is "1".
  7159. @item gamma_r
  7160. Set the gamma expression for red. The value must be a float in
  7161. range @code{0.1} to @code{10.0}. The default value is "1".
  7162. @item gamma_g
  7163. Set the gamma expression for green. The value must be a float in range
  7164. @code{0.1} to @code{10.0}. The default value is "1".
  7165. @item gamma_b
  7166. Set the gamma expression for blue. The value must be a float in range
  7167. @code{0.1} to @code{10.0}. The default value is "1".
  7168. @item gamma_weight
  7169. Set the gamma weight expression. It can be used to reduce the effect
  7170. of a high gamma value on bright image areas, e.g. keep them from
  7171. getting overamplified and just plain white. The value must be a float
  7172. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7173. gamma correction all the way down while @code{1.0} leaves it at its
  7174. full strength. Default is "1".
  7175. @item eval
  7176. Set when the expressions for brightness, contrast, saturation and
  7177. gamma expressions are evaluated.
  7178. It accepts the following values:
  7179. @table @samp
  7180. @item init
  7181. only evaluate expressions once during the filter initialization or
  7182. when a command is processed
  7183. @item frame
  7184. evaluate expressions for each incoming frame
  7185. @end table
  7186. Default value is @samp{init}.
  7187. @end table
  7188. The expressions accept the following parameters:
  7189. @table @option
  7190. @item n
  7191. frame count of the input frame starting from 0
  7192. @item pos
  7193. byte position of the corresponding packet in the input file, NAN if
  7194. unspecified
  7195. @item r
  7196. frame rate of the input video, NAN if the input frame rate is unknown
  7197. @item t
  7198. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7199. @end table
  7200. @subsection Commands
  7201. The filter supports the following commands:
  7202. @table @option
  7203. @item contrast
  7204. Set the contrast expression.
  7205. @item brightness
  7206. Set the brightness expression.
  7207. @item saturation
  7208. Set the saturation expression.
  7209. @item gamma
  7210. Set the gamma expression.
  7211. @item gamma_r
  7212. Set the gamma_r expression.
  7213. @item gamma_g
  7214. Set gamma_g expression.
  7215. @item gamma_b
  7216. Set gamma_b expression.
  7217. @item gamma_weight
  7218. Set gamma_weight expression.
  7219. The command accepts the same syntax of the corresponding option.
  7220. If the specified expression is not valid, it is kept at its current
  7221. value.
  7222. @end table
  7223. @section erosion
  7224. Apply erosion effect to the video.
  7225. This filter replaces the pixel by the local(3x3) minimum.
  7226. It accepts the following options:
  7227. @table @option
  7228. @item threshold0
  7229. @item threshold1
  7230. @item threshold2
  7231. @item threshold3
  7232. Limit the maximum change for each plane, default is 65535.
  7233. If 0, plane will remain unchanged.
  7234. @item coordinates
  7235. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7236. pixels are used.
  7237. Flags to local 3x3 coordinates maps like this:
  7238. 1 2 3
  7239. 4 5
  7240. 6 7 8
  7241. @end table
  7242. @section extractplanes
  7243. Extract color channel components from input video stream into
  7244. separate grayscale video streams.
  7245. The filter accepts the following option:
  7246. @table @option
  7247. @item planes
  7248. Set plane(s) to extract.
  7249. Available values for planes are:
  7250. @table @samp
  7251. @item y
  7252. @item u
  7253. @item v
  7254. @item a
  7255. @item r
  7256. @item g
  7257. @item b
  7258. @end table
  7259. Choosing planes not available in the input will result in an error.
  7260. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7261. with @code{y}, @code{u}, @code{v} planes at same time.
  7262. @end table
  7263. @subsection Examples
  7264. @itemize
  7265. @item
  7266. Extract luma, u and v color channel component from input video frame
  7267. into 3 grayscale outputs:
  7268. @example
  7269. 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
  7270. @end example
  7271. @end itemize
  7272. @section elbg
  7273. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7274. For each input image, the filter will compute the optimal mapping from
  7275. the input to the output given the codebook length, that is the number
  7276. of distinct output colors.
  7277. This filter accepts the following options.
  7278. @table @option
  7279. @item codebook_length, l
  7280. Set codebook length. The value must be a positive integer, and
  7281. represents the number of distinct output colors. Default value is 256.
  7282. @item nb_steps, n
  7283. Set the maximum number of iterations to apply for computing the optimal
  7284. mapping. The higher the value the better the result and the higher the
  7285. computation time. Default value is 1.
  7286. @item seed, s
  7287. Set a random seed, must be an integer included between 0 and
  7288. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7289. will try to use a good random seed on a best effort basis.
  7290. @item pal8
  7291. Set pal8 output pixel format. This option does not work with codebook
  7292. length greater than 256.
  7293. @end table
  7294. @section entropy
  7295. Measure graylevel entropy in histogram of color channels of video frames.
  7296. It accepts the following parameters:
  7297. @table @option
  7298. @item mode
  7299. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7300. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7301. between neighbour histogram values.
  7302. @end table
  7303. @section fade
  7304. Apply a fade-in/out effect to the input video.
  7305. It accepts the following parameters:
  7306. @table @option
  7307. @item type, t
  7308. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7309. effect.
  7310. Default is @code{in}.
  7311. @item start_frame, s
  7312. Specify the number of the frame to start applying the fade
  7313. effect at. Default is 0.
  7314. @item nb_frames, n
  7315. The number of frames that the fade effect lasts. At the end of the
  7316. fade-in effect, the output video will have the same intensity as the input video.
  7317. At the end of the fade-out transition, the output video will be filled with the
  7318. selected @option{color}.
  7319. Default is 25.
  7320. @item alpha
  7321. If set to 1, fade only alpha channel, if one exists on the input.
  7322. Default value is 0.
  7323. @item start_time, st
  7324. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7325. effect. If both start_frame and start_time are specified, the fade will start at
  7326. whichever comes last. Default is 0.
  7327. @item duration, d
  7328. The number of seconds for which the fade effect has to last. At the end of the
  7329. fade-in effect the output video will have the same intensity as the input video,
  7330. at the end of the fade-out transition the output video will be filled with the
  7331. selected @option{color}.
  7332. If both duration and nb_frames are specified, duration is used. Default is 0
  7333. (nb_frames is used by default).
  7334. @item color, c
  7335. Specify the color of the fade. Default is "black".
  7336. @end table
  7337. @subsection Examples
  7338. @itemize
  7339. @item
  7340. Fade in the first 30 frames of video:
  7341. @example
  7342. fade=in:0:30
  7343. @end example
  7344. The command above is equivalent to:
  7345. @example
  7346. fade=t=in:s=0:n=30
  7347. @end example
  7348. @item
  7349. Fade out the last 45 frames of a 200-frame video:
  7350. @example
  7351. fade=out:155:45
  7352. fade=type=out:start_frame=155:nb_frames=45
  7353. @end example
  7354. @item
  7355. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7356. @example
  7357. fade=in:0:25, fade=out:975:25
  7358. @end example
  7359. @item
  7360. Make the first 5 frames yellow, then fade in from frame 5-24:
  7361. @example
  7362. fade=in:5:20:color=yellow
  7363. @end example
  7364. @item
  7365. Fade in alpha over first 25 frames of video:
  7366. @example
  7367. fade=in:0:25:alpha=1
  7368. @end example
  7369. @item
  7370. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7371. @example
  7372. fade=t=in:st=5.5:d=0.5
  7373. @end example
  7374. @end itemize
  7375. @section fftfilt
  7376. Apply arbitrary expressions to samples in frequency domain
  7377. @table @option
  7378. @item dc_Y
  7379. Adjust the dc value (gain) of the luma plane of the image. The filter
  7380. accepts an integer value in range @code{0} to @code{1000}. The default
  7381. value is set to @code{0}.
  7382. @item dc_U
  7383. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7384. filter accepts an integer value in range @code{0} to @code{1000}. The
  7385. default value is set to @code{0}.
  7386. @item dc_V
  7387. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7388. filter accepts an integer value in range @code{0} to @code{1000}. The
  7389. default value is set to @code{0}.
  7390. @item weight_Y
  7391. Set the frequency domain weight expression for the luma plane.
  7392. @item weight_U
  7393. Set the frequency domain weight expression for the 1st chroma plane.
  7394. @item weight_V
  7395. Set the frequency domain weight expression for the 2nd chroma plane.
  7396. @item eval
  7397. Set when the expressions are evaluated.
  7398. It accepts the following values:
  7399. @table @samp
  7400. @item init
  7401. Only evaluate expressions once during the filter initialization.
  7402. @item frame
  7403. Evaluate expressions for each incoming frame.
  7404. @end table
  7405. Default value is @samp{init}.
  7406. The filter accepts the following variables:
  7407. @item X
  7408. @item Y
  7409. The coordinates of the current sample.
  7410. @item W
  7411. @item H
  7412. The width and height of the image.
  7413. @item N
  7414. The number of input frame, starting from 0.
  7415. @end table
  7416. @subsection Examples
  7417. @itemize
  7418. @item
  7419. High-pass:
  7420. @example
  7421. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7422. @end example
  7423. @item
  7424. Low-pass:
  7425. @example
  7426. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7427. @end example
  7428. @item
  7429. Sharpen:
  7430. @example
  7431. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7432. @end example
  7433. @item
  7434. Blur:
  7435. @example
  7436. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7437. @end example
  7438. @end itemize
  7439. @section fftdnoiz
  7440. Denoise frames using 3D FFT (frequency domain filtering).
  7441. The filter accepts the following options:
  7442. @table @option
  7443. @item sigma
  7444. Set the noise sigma constant. This sets denoising strength.
  7445. Default value is 1. Allowed range is from 0 to 30.
  7446. Using very high sigma with low overlap may give blocking artifacts.
  7447. @item amount
  7448. Set amount of denoising. By default all detected noise is reduced.
  7449. Default value is 1. Allowed range is from 0 to 1.
  7450. @item block
  7451. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7452. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7453. block size in pixels is 2^4 which is 16.
  7454. @item overlap
  7455. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7456. @item prev
  7457. Set number of previous frames to use for denoising. By default is set to 0.
  7458. @item next
  7459. Set number of next frames to to use for denoising. By default is set to 0.
  7460. @item planes
  7461. Set planes which will be filtered, by default are all available filtered
  7462. except alpha.
  7463. @end table
  7464. @section field
  7465. Extract a single field from an interlaced image using stride
  7466. arithmetic to avoid wasting CPU time. The output frames are marked as
  7467. non-interlaced.
  7468. The filter accepts the following options:
  7469. @table @option
  7470. @item type
  7471. Specify whether to extract the top (if the value is @code{0} or
  7472. @code{top}) or the bottom field (if the value is @code{1} or
  7473. @code{bottom}).
  7474. @end table
  7475. @section fieldhint
  7476. Create new frames by copying the top and bottom fields from surrounding frames
  7477. supplied as numbers by the hint file.
  7478. @table @option
  7479. @item hint
  7480. Set file containing hints: absolute/relative frame numbers.
  7481. There must be one line for each frame in a clip. Each line must contain two
  7482. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7483. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7484. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7485. for @code{relative} mode. First number tells from which frame to pick up top
  7486. field and second number tells from which frame to pick up bottom field.
  7487. If optionally followed by @code{+} output frame will be marked as interlaced,
  7488. else if followed by @code{-} output frame will be marked as progressive, else
  7489. it will be marked same as input frame.
  7490. If line starts with @code{#} or @code{;} that line is skipped.
  7491. @item mode
  7492. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7493. @end table
  7494. Example of first several lines of @code{hint} file for @code{relative} mode:
  7495. @example
  7496. 0,0 - # first frame
  7497. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7498. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7499. 1,0 -
  7500. 0,0 -
  7501. 0,0 -
  7502. 1,0 -
  7503. 1,0 -
  7504. 1,0 -
  7505. 0,0 -
  7506. 0,0 -
  7507. 1,0 -
  7508. 1,0 -
  7509. 1,0 -
  7510. 0,0 -
  7511. @end example
  7512. @section fieldmatch
  7513. Field matching filter for inverse telecine. It is meant to reconstruct the
  7514. progressive frames from a telecined stream. The filter does not drop duplicated
  7515. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7516. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7517. The separation of the field matching and the decimation is notably motivated by
  7518. the possibility of inserting a de-interlacing filter fallback between the two.
  7519. If the source has mixed telecined and real interlaced content,
  7520. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7521. But these remaining combed frames will be marked as interlaced, and thus can be
  7522. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7523. In addition to the various configuration options, @code{fieldmatch} can take an
  7524. optional second stream, activated through the @option{ppsrc} option. If
  7525. enabled, the frames reconstruction will be based on the fields and frames from
  7526. this second stream. This allows the first input to be pre-processed in order to
  7527. help the various algorithms of the filter, while keeping the output lossless
  7528. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7529. or brightness/contrast adjustments can help.
  7530. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7531. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7532. which @code{fieldmatch} is based on. While the semantic and usage are very
  7533. close, some behaviour and options names can differ.
  7534. The @ref{decimate} filter currently only works for constant frame rate input.
  7535. If your input has mixed telecined (30fps) and progressive content with a lower
  7536. framerate like 24fps use the following filterchain to produce the necessary cfr
  7537. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7538. The filter accepts the following options:
  7539. @table @option
  7540. @item order
  7541. Specify the assumed field order of the input stream. Available values are:
  7542. @table @samp
  7543. @item auto
  7544. Auto detect parity (use FFmpeg's internal parity value).
  7545. @item bff
  7546. Assume bottom field first.
  7547. @item tff
  7548. Assume top field first.
  7549. @end table
  7550. Note that it is sometimes recommended not to trust the parity announced by the
  7551. stream.
  7552. Default value is @var{auto}.
  7553. @item mode
  7554. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7555. sense that it won't risk creating jerkiness due to duplicate frames when
  7556. possible, but if there are bad edits or blended fields it will end up
  7557. outputting combed frames when a good match might actually exist. On the other
  7558. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7559. but will almost always find a good frame if there is one. The other values are
  7560. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7561. jerkiness and creating duplicate frames versus finding good matches in sections
  7562. with bad edits, orphaned fields, blended fields, etc.
  7563. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7564. Available values are:
  7565. @table @samp
  7566. @item pc
  7567. 2-way matching (p/c)
  7568. @item pc_n
  7569. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7570. @item pc_u
  7571. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7572. @item pc_n_ub
  7573. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7574. still combed (p/c + n + u/b)
  7575. @item pcn
  7576. 3-way matching (p/c/n)
  7577. @item pcn_ub
  7578. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7579. detected as combed (p/c/n + u/b)
  7580. @end table
  7581. The parenthesis at the end indicate the matches that would be used for that
  7582. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7583. @var{top}).
  7584. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7585. the slowest.
  7586. Default value is @var{pc_n}.
  7587. @item ppsrc
  7588. Mark the main input stream as a pre-processed input, and enable the secondary
  7589. input stream as the clean source to pick the fields from. See the filter
  7590. introduction for more details. It is similar to the @option{clip2} feature from
  7591. VFM/TFM.
  7592. Default value is @code{0} (disabled).
  7593. @item field
  7594. Set the field to match from. It is recommended to set this to the same value as
  7595. @option{order} unless you experience matching failures with that setting. In
  7596. certain circumstances changing the field that is used to match from can have a
  7597. large impact on matching performance. Available values are:
  7598. @table @samp
  7599. @item auto
  7600. Automatic (same value as @option{order}).
  7601. @item bottom
  7602. Match from the bottom field.
  7603. @item top
  7604. Match from the top field.
  7605. @end table
  7606. Default value is @var{auto}.
  7607. @item mchroma
  7608. Set whether or not chroma is included during the match comparisons. In most
  7609. cases it is recommended to leave this enabled. You should set this to @code{0}
  7610. only if your clip has bad chroma problems such as heavy rainbowing or other
  7611. artifacts. Setting this to @code{0} could also be used to speed things up at
  7612. the cost of some accuracy.
  7613. Default value is @code{1}.
  7614. @item y0
  7615. @item y1
  7616. These define an exclusion band which excludes the lines between @option{y0} and
  7617. @option{y1} from being included in the field matching decision. An exclusion
  7618. band can be used to ignore subtitles, a logo, or other things that may
  7619. interfere with the matching. @option{y0} sets the starting scan line and
  7620. @option{y1} sets the ending line; all lines in between @option{y0} and
  7621. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7622. @option{y0} and @option{y1} to the same value will disable the feature.
  7623. @option{y0} and @option{y1} defaults to @code{0}.
  7624. @item scthresh
  7625. Set the scene change detection threshold as a percentage of maximum change on
  7626. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7627. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7628. @option{scthresh} is @code{[0.0, 100.0]}.
  7629. Default value is @code{12.0}.
  7630. @item combmatch
  7631. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7632. account the combed scores of matches when deciding what match to use as the
  7633. final match. Available values are:
  7634. @table @samp
  7635. @item none
  7636. No final matching based on combed scores.
  7637. @item sc
  7638. Combed scores are only used when a scene change is detected.
  7639. @item full
  7640. Use combed scores all the time.
  7641. @end table
  7642. Default is @var{sc}.
  7643. @item combdbg
  7644. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7645. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7646. Available values are:
  7647. @table @samp
  7648. @item none
  7649. No forced calculation.
  7650. @item pcn
  7651. Force p/c/n calculations.
  7652. @item pcnub
  7653. Force p/c/n/u/b calculations.
  7654. @end table
  7655. Default value is @var{none}.
  7656. @item cthresh
  7657. This is the area combing threshold used for combed frame detection. This
  7658. essentially controls how "strong" or "visible" combing must be to be detected.
  7659. Larger values mean combing must be more visible and smaller values mean combing
  7660. can be less visible or strong and still be detected. Valid settings are from
  7661. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7662. be detected as combed). This is basically a pixel difference value. A good
  7663. range is @code{[8, 12]}.
  7664. Default value is @code{9}.
  7665. @item chroma
  7666. Sets whether or not chroma is considered in the combed frame decision. Only
  7667. disable this if your source has chroma problems (rainbowing, etc.) that are
  7668. causing problems for the combed frame detection with chroma enabled. Actually,
  7669. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7670. where there is chroma only combing in the source.
  7671. Default value is @code{0}.
  7672. @item blockx
  7673. @item blocky
  7674. Respectively set the x-axis and y-axis size of the window used during combed
  7675. frame detection. This has to do with the size of the area in which
  7676. @option{combpel} pixels are required to be detected as combed for a frame to be
  7677. declared combed. See the @option{combpel} parameter description for more info.
  7678. Possible values are any number that is a power of 2 starting at 4 and going up
  7679. to 512.
  7680. Default value is @code{16}.
  7681. @item combpel
  7682. The number of combed pixels inside any of the @option{blocky} by
  7683. @option{blockx} size blocks on the frame for the frame to be detected as
  7684. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7685. setting controls "how much" combing there must be in any localized area (a
  7686. window defined by the @option{blockx} and @option{blocky} settings) on the
  7687. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7688. which point no frames will ever be detected as combed). This setting is known
  7689. as @option{MI} in TFM/VFM vocabulary.
  7690. Default value is @code{80}.
  7691. @end table
  7692. @anchor{p/c/n/u/b meaning}
  7693. @subsection p/c/n/u/b meaning
  7694. @subsubsection p/c/n
  7695. We assume the following telecined stream:
  7696. @example
  7697. Top fields: 1 2 2 3 4
  7698. Bottom fields: 1 2 3 4 4
  7699. @end example
  7700. The numbers correspond to the progressive frame the fields relate to. Here, the
  7701. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7702. When @code{fieldmatch} is configured to run a matching from bottom
  7703. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7704. @example
  7705. Input stream:
  7706. T 1 2 2 3 4
  7707. B 1 2 3 4 4 <-- matching reference
  7708. Matches: c c n n c
  7709. Output stream:
  7710. T 1 2 3 4 4
  7711. B 1 2 3 4 4
  7712. @end example
  7713. As a result of the field matching, we can see that some frames get duplicated.
  7714. To perform a complete inverse telecine, you need to rely on a decimation filter
  7715. after this operation. See for instance the @ref{decimate} filter.
  7716. The same operation now matching from top fields (@option{field}=@var{top})
  7717. looks like this:
  7718. @example
  7719. Input stream:
  7720. T 1 2 2 3 4 <-- matching reference
  7721. B 1 2 3 4 4
  7722. Matches: c c p p c
  7723. Output stream:
  7724. T 1 2 2 3 4
  7725. B 1 2 2 3 4
  7726. @end example
  7727. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7728. basically, they refer to the frame and field of the opposite parity:
  7729. @itemize
  7730. @item @var{p} matches the field of the opposite parity in the previous frame
  7731. @item @var{c} matches the field of the opposite parity in the current frame
  7732. @item @var{n} matches the field of the opposite parity in the next frame
  7733. @end itemize
  7734. @subsubsection u/b
  7735. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7736. from the opposite parity flag. In the following examples, we assume that we are
  7737. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7738. 'x' is placed above and below each matched fields.
  7739. With bottom matching (@option{field}=@var{bottom}):
  7740. @example
  7741. Match: c p n b u
  7742. x x x x x
  7743. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7744. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7745. x x x x x
  7746. Output frames:
  7747. 2 1 2 2 2
  7748. 2 2 2 1 3
  7749. @end example
  7750. With top matching (@option{field}=@var{top}):
  7751. @example
  7752. Match: c p n b u
  7753. x x x x x
  7754. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7755. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7756. x x x x x
  7757. Output frames:
  7758. 2 2 2 1 2
  7759. 2 1 3 2 2
  7760. @end example
  7761. @subsection Examples
  7762. Simple IVTC of a top field first telecined stream:
  7763. @example
  7764. fieldmatch=order=tff:combmatch=none, decimate
  7765. @end example
  7766. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7767. @example
  7768. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7769. @end example
  7770. @section fieldorder
  7771. Transform the field order of the input video.
  7772. It accepts the following parameters:
  7773. @table @option
  7774. @item order
  7775. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7776. for bottom field first.
  7777. @end table
  7778. The default value is @samp{tff}.
  7779. The transformation is done by shifting the picture content up or down
  7780. by one line, and filling the remaining line with appropriate picture content.
  7781. This method is consistent with most broadcast field order converters.
  7782. If the input video is not flagged as being interlaced, or it is already
  7783. flagged as being of the required output field order, then this filter does
  7784. not alter the incoming video.
  7785. It is very useful when converting to or from PAL DV material,
  7786. which is bottom field first.
  7787. For example:
  7788. @example
  7789. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7790. @end example
  7791. @section fifo, afifo
  7792. Buffer input images and send them when they are requested.
  7793. It is mainly useful when auto-inserted by the libavfilter
  7794. framework.
  7795. It does not take parameters.
  7796. @section fillborders
  7797. Fill borders of the input video, without changing video stream dimensions.
  7798. Sometimes video can have garbage at the four edges and you may not want to
  7799. crop video input to keep size multiple of some number.
  7800. This filter accepts the following options:
  7801. @table @option
  7802. @item left
  7803. Number of pixels to fill from left border.
  7804. @item right
  7805. Number of pixels to fill from right border.
  7806. @item top
  7807. Number of pixels to fill from top border.
  7808. @item bottom
  7809. Number of pixels to fill from bottom border.
  7810. @item mode
  7811. Set fill mode.
  7812. It accepts the following values:
  7813. @table @samp
  7814. @item smear
  7815. fill pixels using outermost pixels
  7816. @item mirror
  7817. fill pixels using mirroring
  7818. @item fixed
  7819. fill pixels with constant value
  7820. @end table
  7821. Default is @var{smear}.
  7822. @item color
  7823. Set color for pixels in fixed mode. Default is @var{black}.
  7824. @end table
  7825. @section find_rect
  7826. Find a rectangular object
  7827. It accepts the following options:
  7828. @table @option
  7829. @item object
  7830. Filepath of the object image, needs to be in gray8.
  7831. @item threshold
  7832. Detection threshold, default is 0.5.
  7833. @item mipmaps
  7834. Number of mipmaps, default is 3.
  7835. @item xmin, ymin, xmax, ymax
  7836. Specifies the rectangle in which to search.
  7837. @end table
  7838. @subsection Examples
  7839. @itemize
  7840. @item
  7841. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7842. @example
  7843. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7844. @end example
  7845. @end itemize
  7846. @section cover_rect
  7847. Cover a rectangular object
  7848. It accepts the following options:
  7849. @table @option
  7850. @item cover
  7851. Filepath of the optional cover image, needs to be in yuv420.
  7852. @item mode
  7853. Set covering mode.
  7854. It accepts the following values:
  7855. @table @samp
  7856. @item cover
  7857. cover it by the supplied image
  7858. @item blur
  7859. cover it by interpolating the surrounding pixels
  7860. @end table
  7861. Default value is @var{blur}.
  7862. @end table
  7863. @subsection Examples
  7864. @itemize
  7865. @item
  7866. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7867. @example
  7868. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7869. @end example
  7870. @end itemize
  7871. @section floodfill
  7872. Flood area with values of same pixel components with another values.
  7873. It accepts the following options:
  7874. @table @option
  7875. @item x
  7876. Set pixel x coordinate.
  7877. @item y
  7878. Set pixel y coordinate.
  7879. @item s0
  7880. Set source #0 component value.
  7881. @item s1
  7882. Set source #1 component value.
  7883. @item s2
  7884. Set source #2 component value.
  7885. @item s3
  7886. Set source #3 component value.
  7887. @item d0
  7888. Set destination #0 component value.
  7889. @item d1
  7890. Set destination #1 component value.
  7891. @item d2
  7892. Set destination #2 component value.
  7893. @item d3
  7894. Set destination #3 component value.
  7895. @end table
  7896. @anchor{format}
  7897. @section format
  7898. Convert the input video to one of the specified pixel formats.
  7899. Libavfilter will try to pick one that is suitable as input to
  7900. the next filter.
  7901. It accepts the following parameters:
  7902. @table @option
  7903. @item pix_fmts
  7904. A '|'-separated list of pixel format names, such as
  7905. "pix_fmts=yuv420p|monow|rgb24".
  7906. @end table
  7907. @subsection Examples
  7908. @itemize
  7909. @item
  7910. Convert the input video to the @var{yuv420p} format
  7911. @example
  7912. format=pix_fmts=yuv420p
  7913. @end example
  7914. Convert the input video to any of the formats in the list
  7915. @example
  7916. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7917. @end example
  7918. @end itemize
  7919. @anchor{fps}
  7920. @section fps
  7921. Convert the video to specified constant frame rate by duplicating or dropping
  7922. frames as necessary.
  7923. It accepts the following parameters:
  7924. @table @option
  7925. @item fps
  7926. The desired output frame rate. The default is @code{25}.
  7927. @item start_time
  7928. Assume the first PTS should be the given value, in seconds. This allows for
  7929. padding/trimming at the start of stream. By default, no assumption is made
  7930. about the first frame's expected PTS, so no padding or trimming is done.
  7931. For example, this could be set to 0 to pad the beginning with duplicates of
  7932. the first frame if a video stream starts after the audio stream or to trim any
  7933. frames with a negative PTS.
  7934. @item round
  7935. Timestamp (PTS) rounding method.
  7936. Possible values are:
  7937. @table @option
  7938. @item zero
  7939. round towards 0
  7940. @item inf
  7941. round away from 0
  7942. @item down
  7943. round towards -infinity
  7944. @item up
  7945. round towards +infinity
  7946. @item near
  7947. round to nearest
  7948. @end table
  7949. The default is @code{near}.
  7950. @item eof_action
  7951. Action performed when reading the last frame.
  7952. Possible values are:
  7953. @table @option
  7954. @item round
  7955. Use same timestamp rounding method as used for other frames.
  7956. @item pass
  7957. Pass through last frame if input duration has not been reached yet.
  7958. @end table
  7959. The default is @code{round}.
  7960. @end table
  7961. Alternatively, the options can be specified as a flat string:
  7962. @var{fps}[:@var{start_time}[:@var{round}]].
  7963. See also the @ref{setpts} filter.
  7964. @subsection Examples
  7965. @itemize
  7966. @item
  7967. A typical usage in order to set the fps to 25:
  7968. @example
  7969. fps=fps=25
  7970. @end example
  7971. @item
  7972. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7973. @example
  7974. fps=fps=film:round=near
  7975. @end example
  7976. @end itemize
  7977. @section framepack
  7978. Pack two different video streams into a stereoscopic video, setting proper
  7979. metadata on supported codecs. The two views should have the same size and
  7980. framerate and processing will stop when the shorter video ends. Please note
  7981. that you may conveniently adjust view properties with the @ref{scale} and
  7982. @ref{fps} filters.
  7983. It accepts the following parameters:
  7984. @table @option
  7985. @item format
  7986. The desired packing format. Supported values are:
  7987. @table @option
  7988. @item sbs
  7989. The views are next to each other (default).
  7990. @item tab
  7991. The views are on top of each other.
  7992. @item lines
  7993. The views are packed by line.
  7994. @item columns
  7995. The views are packed by column.
  7996. @item frameseq
  7997. The views are temporally interleaved.
  7998. @end table
  7999. @end table
  8000. Some examples:
  8001. @example
  8002. # Convert left and right views into a frame-sequential video
  8003. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8004. # Convert views into a side-by-side video with the same output resolution as the input
  8005. 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
  8006. @end example
  8007. @section framerate
  8008. Change the frame rate by interpolating new video output frames from the source
  8009. frames.
  8010. This filter is not designed to function correctly with interlaced media. If
  8011. you wish to change the frame rate of interlaced media then you are required
  8012. to deinterlace before this filter and re-interlace after this filter.
  8013. A description of the accepted options follows.
  8014. @table @option
  8015. @item fps
  8016. Specify the output frames per second. This option can also be specified
  8017. as a value alone. The default is @code{50}.
  8018. @item interp_start
  8019. Specify the start of a range where the output frame will be created as a
  8020. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8021. the default is @code{15}.
  8022. @item interp_end
  8023. Specify the end of a range where the output frame will be created as a
  8024. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8025. the default is @code{240}.
  8026. @item scene
  8027. Specify the level at which a scene change is detected as a value between
  8028. 0 and 100 to indicate a new scene; a low value reflects a low
  8029. probability for the current frame to introduce a new scene, while a higher
  8030. value means the current frame is more likely to be one.
  8031. The default is @code{8.2}.
  8032. @item flags
  8033. Specify flags influencing the filter process.
  8034. Available value for @var{flags} is:
  8035. @table @option
  8036. @item scene_change_detect, scd
  8037. Enable scene change detection using the value of the option @var{scene}.
  8038. This flag is enabled by default.
  8039. @end table
  8040. @end table
  8041. @section framestep
  8042. Select one frame every N-th frame.
  8043. This filter accepts the following option:
  8044. @table @option
  8045. @item step
  8046. Select frame after every @code{step} frames.
  8047. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8048. @end table
  8049. @section freezedetect
  8050. Detect frozen video.
  8051. This filter logs a message and sets frame metadata when it detects that the
  8052. input video has no significant change in content during a specified duration.
  8053. Video freeze detection calculates the mean average absolute difference of all
  8054. the components of video frames and compares it to a noise floor.
  8055. The printed times and duration are expressed in seconds. The
  8056. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8057. whose timestamp equals or exceeds the detection duration and it contains the
  8058. timestamp of the first frame of the freeze. The
  8059. @code{lavfi.freezedetect.freeze_duration} and
  8060. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8061. after the freeze.
  8062. The filter accepts the following options:
  8063. @table @option
  8064. @item noise, n
  8065. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8066. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8067. 0.001.
  8068. @item duration, d
  8069. Set freeze duration until notification (default is 2 seconds).
  8070. @end table
  8071. @anchor{frei0r}
  8072. @section frei0r
  8073. Apply a frei0r effect to the input video.
  8074. To enable the compilation of this filter, you need to install the frei0r
  8075. header and configure FFmpeg with @code{--enable-frei0r}.
  8076. It accepts the following parameters:
  8077. @table @option
  8078. @item filter_name
  8079. The name of the frei0r effect to load. If the environment variable
  8080. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8081. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8082. Otherwise, the standard frei0r paths are searched, in this order:
  8083. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8084. @file{/usr/lib/frei0r-1/}.
  8085. @item filter_params
  8086. A '|'-separated list of parameters to pass to the frei0r effect.
  8087. @end table
  8088. A frei0r effect parameter can be a boolean (its value is either
  8089. "y" or "n"), a double, a color (specified as
  8090. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8091. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8092. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8093. a position (specified as @var{X}/@var{Y}, where
  8094. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8095. The number and types of parameters depend on the loaded effect. If an
  8096. effect parameter is not specified, the default value is set.
  8097. @subsection Examples
  8098. @itemize
  8099. @item
  8100. Apply the distort0r effect, setting the first two double parameters:
  8101. @example
  8102. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8103. @end example
  8104. @item
  8105. Apply the colordistance effect, taking a color as the first parameter:
  8106. @example
  8107. frei0r=colordistance:0.2/0.3/0.4
  8108. frei0r=colordistance:violet
  8109. frei0r=colordistance:0x112233
  8110. @end example
  8111. @item
  8112. Apply the perspective effect, specifying the top left and top right image
  8113. positions:
  8114. @example
  8115. frei0r=perspective:0.2/0.2|0.8/0.2
  8116. @end example
  8117. @end itemize
  8118. For more information, see
  8119. @url{http://frei0r.dyne.org}
  8120. @section fspp
  8121. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8122. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8123. processing filter, one of them is performed once per block, not per pixel.
  8124. This allows for much higher speed.
  8125. The filter accepts the following options:
  8126. @table @option
  8127. @item quality
  8128. Set quality. This option defines the number of levels for averaging. It accepts
  8129. an integer in the range 4-5. Default value is @code{4}.
  8130. @item qp
  8131. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8132. If not set, the filter will use the QP from the video stream (if available).
  8133. @item strength
  8134. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8135. more details but also more artifacts, while higher values make the image smoother
  8136. but also blurrier. Default value is @code{0} − PSNR optimal.
  8137. @item use_bframe_qp
  8138. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8139. option may cause flicker since the B-Frames have often larger QP. Default is
  8140. @code{0} (not enabled).
  8141. @end table
  8142. @section gblur
  8143. Apply Gaussian blur filter.
  8144. The filter accepts the following options:
  8145. @table @option
  8146. @item sigma
  8147. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8148. @item steps
  8149. Set number of steps for Gaussian approximation. Default is @code{1}.
  8150. @item planes
  8151. Set which planes to filter. By default all planes are filtered.
  8152. @item sigmaV
  8153. Set vertical sigma, if negative it will be same as @code{sigma}.
  8154. Default is @code{-1}.
  8155. @end table
  8156. @section geq
  8157. Apply generic equation to each pixel.
  8158. The filter accepts the following options:
  8159. @table @option
  8160. @item lum_expr, lum
  8161. Set the luminance expression.
  8162. @item cb_expr, cb
  8163. Set the chrominance blue expression.
  8164. @item cr_expr, cr
  8165. Set the chrominance red expression.
  8166. @item alpha_expr, a
  8167. Set the alpha expression.
  8168. @item red_expr, r
  8169. Set the red expression.
  8170. @item green_expr, g
  8171. Set the green expression.
  8172. @item blue_expr, b
  8173. Set the blue expression.
  8174. @end table
  8175. The colorspace is selected according to the specified options. If one
  8176. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8177. options is specified, the filter will automatically select a YCbCr
  8178. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8179. @option{blue_expr} options is specified, it will select an RGB
  8180. colorspace.
  8181. If one of the chrominance expression is not defined, it falls back on the other
  8182. one. If no alpha expression is specified it will evaluate to opaque value.
  8183. If none of chrominance expressions are specified, they will evaluate
  8184. to the luminance expression.
  8185. The expressions can use the following variables and functions:
  8186. @table @option
  8187. @item N
  8188. The sequential number of the filtered frame, starting from @code{0}.
  8189. @item X
  8190. @item Y
  8191. The coordinates of the current sample.
  8192. @item W
  8193. @item H
  8194. The width and height of the image.
  8195. @item SW
  8196. @item SH
  8197. Width and height scale depending on the currently filtered plane. It is the
  8198. ratio between the corresponding luma plane number of pixels and the current
  8199. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8200. @code{0.5,0.5} for chroma planes.
  8201. @item T
  8202. Time of the current frame, expressed in seconds.
  8203. @item p(x, y)
  8204. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8205. plane.
  8206. @item lum(x, y)
  8207. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8208. plane.
  8209. @item cb(x, y)
  8210. Return the value of the pixel at location (@var{x},@var{y}) of the
  8211. blue-difference chroma plane. Return 0 if there is no such plane.
  8212. @item cr(x, y)
  8213. Return the value of the pixel at location (@var{x},@var{y}) of the
  8214. red-difference chroma plane. Return 0 if there is no such plane.
  8215. @item r(x, y)
  8216. @item g(x, y)
  8217. @item b(x, y)
  8218. Return the value of the pixel at location (@var{x},@var{y}) of the
  8219. red/green/blue component. Return 0 if there is no such component.
  8220. @item alpha(x, y)
  8221. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8222. plane. Return 0 if there is no such plane.
  8223. @end table
  8224. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8225. automatically clipped to the closer edge.
  8226. @subsection Examples
  8227. @itemize
  8228. @item
  8229. Flip the image horizontally:
  8230. @example
  8231. geq=p(W-X\,Y)
  8232. @end example
  8233. @item
  8234. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8235. wavelength of 100 pixels:
  8236. @example
  8237. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8238. @end example
  8239. @item
  8240. Generate a fancy enigmatic moving light:
  8241. @example
  8242. 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
  8243. @end example
  8244. @item
  8245. Generate a quick emboss effect:
  8246. @example
  8247. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8248. @end example
  8249. @item
  8250. Modify RGB components depending on pixel position:
  8251. @example
  8252. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8253. @end example
  8254. @item
  8255. Create a radial gradient that is the same size as the input (also see
  8256. the @ref{vignette} filter):
  8257. @example
  8258. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8259. @end example
  8260. @end itemize
  8261. @section gradfun
  8262. Fix the banding artifacts that are sometimes introduced into nearly flat
  8263. regions by truncation to 8-bit color depth.
  8264. Interpolate the gradients that should go where the bands are, and
  8265. dither them.
  8266. It is designed for playback only. Do not use it prior to
  8267. lossy compression, because compression tends to lose the dither and
  8268. bring back the bands.
  8269. It accepts the following parameters:
  8270. @table @option
  8271. @item strength
  8272. The maximum amount by which the filter will change any one pixel. This is also
  8273. the threshold for detecting nearly flat regions. Acceptable values range from
  8274. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8275. valid range.
  8276. @item radius
  8277. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8278. gradients, but also prevents the filter from modifying the pixels near detailed
  8279. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8280. values will be clipped to the valid range.
  8281. @end table
  8282. Alternatively, the options can be specified as a flat string:
  8283. @var{strength}[:@var{radius}]
  8284. @subsection Examples
  8285. @itemize
  8286. @item
  8287. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8288. @example
  8289. gradfun=3.5:8
  8290. @end example
  8291. @item
  8292. Specify radius, omitting the strength (which will fall-back to the default
  8293. value):
  8294. @example
  8295. gradfun=radius=8
  8296. @end example
  8297. @end itemize
  8298. @section graphmonitor, agraphmonitor
  8299. Show various filtergraph stats.
  8300. With this filter one can debug complete filtergraph.
  8301. Especially issues with links filling with queued frames.
  8302. The filter accepts the following options:
  8303. @table @option
  8304. @item size, s
  8305. Set video output size. Default is @var{hd720}.
  8306. @item opacity, o
  8307. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8308. @item mode, m
  8309. Set output mode, can be @var{fulll} or @var{compact}.
  8310. In @var{compact} mode only filters with some queued frames have displayed stats.
  8311. @item flags, f
  8312. Set flags which enable which stats are shown in video.
  8313. Available values for flags are:
  8314. @table @samp
  8315. @item queue
  8316. Display number of queued frames in each link.
  8317. @item frame_count_in
  8318. Display number of frames taken from filter.
  8319. @item frame_count_out
  8320. Display number of frames given out from filter.
  8321. @item pts
  8322. Display current filtered frame pts.
  8323. @item time
  8324. Display current filtered frame time.
  8325. @item timebase
  8326. Display time base for filter link.
  8327. @item format
  8328. Display used format for filter link.
  8329. @item size
  8330. Display video size or number of audio channels in case of audio used by filter link.
  8331. @item rate
  8332. Display video frame rate or sample rate in case of audio used by filter link.
  8333. @end table
  8334. @item rate, r
  8335. Set upper limit for video rate of output stream, Default value is @var{25}.
  8336. This guarantee that output video frame rate will not be higher than this value.
  8337. @end table
  8338. @section greyedge
  8339. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8340. and corrects the scene colors accordingly.
  8341. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8342. The filter accepts the following options:
  8343. @table @option
  8344. @item difford
  8345. The order of differentiation to be applied on the scene. Must be chosen in the range
  8346. [0,2] and default value is 1.
  8347. @item minknorm
  8348. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8349. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8350. max value instead of calculating Minkowski distance.
  8351. @item sigma
  8352. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8353. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8354. can't be equal to 0 if @var{difford} is greater than 0.
  8355. @end table
  8356. @subsection Examples
  8357. @itemize
  8358. @item
  8359. Grey Edge:
  8360. @example
  8361. greyedge=difford=1:minknorm=5:sigma=2
  8362. @end example
  8363. @item
  8364. Max Edge:
  8365. @example
  8366. greyedge=difford=1:minknorm=0:sigma=2
  8367. @end example
  8368. @end itemize
  8369. @anchor{haldclut}
  8370. @section haldclut
  8371. Apply a Hald CLUT to a video stream.
  8372. First input is the video stream to process, and second one is the Hald CLUT.
  8373. The Hald CLUT input can be a simple picture or a complete video stream.
  8374. The filter accepts the following options:
  8375. @table @option
  8376. @item shortest
  8377. Force termination when the shortest input terminates. Default is @code{0}.
  8378. @item repeatlast
  8379. Continue applying the last CLUT after the end of the stream. A value of
  8380. @code{0} disable the filter after the last frame of the CLUT is reached.
  8381. Default is @code{1}.
  8382. @end table
  8383. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8384. filters share the same internals).
  8385. This filter also supports the @ref{framesync} options.
  8386. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8387. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8388. @subsection Workflow examples
  8389. @subsubsection Hald CLUT video stream
  8390. Generate an identity Hald CLUT stream altered with various effects:
  8391. @example
  8392. 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
  8393. @end example
  8394. Note: make sure you use a lossless codec.
  8395. Then use it with @code{haldclut} to apply it on some random stream:
  8396. @example
  8397. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8398. @end example
  8399. The Hald CLUT will be applied to the 10 first seconds (duration of
  8400. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8401. to the remaining frames of the @code{mandelbrot} stream.
  8402. @subsubsection Hald CLUT with preview
  8403. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8404. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8405. biggest possible square starting at the top left of the picture. The remaining
  8406. padding pixels (bottom or right) will be ignored. This area can be used to add
  8407. a preview of the Hald CLUT.
  8408. Typically, the following generated Hald CLUT will be supported by the
  8409. @code{haldclut} filter:
  8410. @example
  8411. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8412. pad=iw+320 [padded_clut];
  8413. smptebars=s=320x256, split [a][b];
  8414. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8415. [main][b] overlay=W-320" -frames:v 1 clut.png
  8416. @end example
  8417. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8418. bars are displayed on the right-top, and below the same color bars processed by
  8419. the color changes.
  8420. Then, the effect of this Hald CLUT can be visualized with:
  8421. @example
  8422. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8423. @end example
  8424. @section hflip
  8425. Flip the input video horizontally.
  8426. For example, to horizontally flip the input video with @command{ffmpeg}:
  8427. @example
  8428. ffmpeg -i in.avi -vf "hflip" out.avi
  8429. @end example
  8430. @section histeq
  8431. This filter applies a global color histogram equalization on a
  8432. per-frame basis.
  8433. It can be used to correct video that has a compressed range of pixel
  8434. intensities. The filter redistributes the pixel intensities to
  8435. equalize their distribution across the intensity range. It may be
  8436. viewed as an "automatically adjusting contrast filter". This filter is
  8437. useful only for correcting degraded or poorly captured source
  8438. video.
  8439. The filter accepts the following options:
  8440. @table @option
  8441. @item strength
  8442. Determine the amount of equalization to be applied. As the strength
  8443. is reduced, the distribution of pixel intensities more-and-more
  8444. approaches that of the input frame. The value must be a float number
  8445. in the range [0,1] and defaults to 0.200.
  8446. @item intensity
  8447. Set the maximum intensity that can generated and scale the output
  8448. values appropriately. The strength should be set as desired and then
  8449. the intensity can be limited if needed to avoid washing-out. The value
  8450. must be a float number in the range [0,1] and defaults to 0.210.
  8451. @item antibanding
  8452. Set the antibanding level. If enabled the filter will randomly vary
  8453. the luminance of output pixels by a small amount to avoid banding of
  8454. the histogram. Possible values are @code{none}, @code{weak} or
  8455. @code{strong}. It defaults to @code{none}.
  8456. @end table
  8457. @section histogram
  8458. Compute and draw a color distribution histogram for the input video.
  8459. The computed histogram is a representation of the color component
  8460. distribution in an image.
  8461. Standard histogram displays the color components distribution in an image.
  8462. Displays color graph for each color component. Shows distribution of
  8463. the Y, U, V, A or R, G, B components, depending on input format, in the
  8464. current frame. Below each graph a color component scale meter is shown.
  8465. The filter accepts the following options:
  8466. @table @option
  8467. @item level_height
  8468. Set height of level. Default value is @code{200}.
  8469. Allowed range is [50, 2048].
  8470. @item scale_height
  8471. Set height of color scale. Default value is @code{12}.
  8472. Allowed range is [0, 40].
  8473. @item display_mode
  8474. Set display mode.
  8475. It accepts the following values:
  8476. @table @samp
  8477. @item stack
  8478. Per color component graphs are placed below each other.
  8479. @item parade
  8480. Per color component graphs are placed side by side.
  8481. @item overlay
  8482. Presents information identical to that in the @code{parade}, except
  8483. that the graphs representing color components are superimposed directly
  8484. over one another.
  8485. @end table
  8486. Default is @code{stack}.
  8487. @item levels_mode
  8488. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8489. Default is @code{linear}.
  8490. @item components
  8491. Set what color components to display.
  8492. Default is @code{7}.
  8493. @item fgopacity
  8494. Set foreground opacity. Default is @code{0.7}.
  8495. @item bgopacity
  8496. Set background opacity. Default is @code{0.5}.
  8497. @end table
  8498. @subsection Examples
  8499. @itemize
  8500. @item
  8501. Calculate and draw histogram:
  8502. @example
  8503. ffplay -i input -vf histogram
  8504. @end example
  8505. @end itemize
  8506. @anchor{hqdn3d}
  8507. @section hqdn3d
  8508. This is a high precision/quality 3d denoise filter. It aims to reduce
  8509. image noise, producing smooth images and making still images really
  8510. still. It should enhance compressibility.
  8511. It accepts the following optional parameters:
  8512. @table @option
  8513. @item luma_spatial
  8514. A non-negative floating point number which specifies spatial luma strength.
  8515. It defaults to 4.0.
  8516. @item chroma_spatial
  8517. A non-negative floating point number which specifies spatial chroma strength.
  8518. It defaults to 3.0*@var{luma_spatial}/4.0.
  8519. @item luma_tmp
  8520. A floating point number which specifies luma temporal strength. It defaults to
  8521. 6.0*@var{luma_spatial}/4.0.
  8522. @item chroma_tmp
  8523. A floating point number which specifies chroma temporal strength. It defaults to
  8524. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8525. @end table
  8526. @anchor{hwdownload}
  8527. @section hwdownload
  8528. Download hardware frames to system memory.
  8529. The input must be in hardware frames, and the output a non-hardware format.
  8530. Not all formats will be supported on the output - it may be necessary to insert
  8531. an additional @option{format} filter immediately following in the graph to get
  8532. the output in a supported format.
  8533. @section hwmap
  8534. Map hardware frames to system memory or to another device.
  8535. This filter has several different modes of operation; which one is used depends
  8536. on the input and output formats:
  8537. @itemize
  8538. @item
  8539. Hardware frame input, normal frame output
  8540. Map the input frames to system memory and pass them to the output. If the
  8541. original hardware frame is later required (for example, after overlaying
  8542. something else on part of it), the @option{hwmap} filter can be used again
  8543. in the next mode to retrieve it.
  8544. @item
  8545. Normal frame input, hardware frame output
  8546. If the input is actually a software-mapped hardware frame, then unmap it -
  8547. that is, return the original hardware frame.
  8548. Otherwise, a device must be provided. Create new hardware surfaces on that
  8549. device for the output, then map them back to the software format at the input
  8550. and give those frames to the preceding filter. This will then act like the
  8551. @option{hwupload} filter, but may be able to avoid an additional copy when
  8552. the input is already in a compatible format.
  8553. @item
  8554. Hardware frame input and output
  8555. A device must be supplied for the output, either directly or with the
  8556. @option{derive_device} option. The input and output devices must be of
  8557. different types and compatible - the exact meaning of this is
  8558. system-dependent, but typically it means that they must refer to the same
  8559. underlying hardware context (for example, refer to the same graphics card).
  8560. If the input frames were originally created on the output device, then unmap
  8561. to retrieve the original frames.
  8562. Otherwise, map the frames to the output device - create new hardware frames
  8563. on the output corresponding to the frames on the input.
  8564. @end itemize
  8565. The following additional parameters are accepted:
  8566. @table @option
  8567. @item mode
  8568. Set the frame mapping mode. Some combination of:
  8569. @table @var
  8570. @item read
  8571. The mapped frame should be readable.
  8572. @item write
  8573. The mapped frame should be writeable.
  8574. @item overwrite
  8575. The mapping will always overwrite the entire frame.
  8576. This may improve performance in some cases, as the original contents of the
  8577. frame need not be loaded.
  8578. @item direct
  8579. The mapping must not involve any copying.
  8580. Indirect mappings to copies of frames are created in some cases where either
  8581. direct mapping is not possible or it would have unexpected properties.
  8582. Setting this flag ensures that the mapping is direct and will fail if that is
  8583. not possible.
  8584. @end table
  8585. Defaults to @var{read+write} if not specified.
  8586. @item derive_device @var{type}
  8587. Rather than using the device supplied at initialisation, instead derive a new
  8588. device of type @var{type} from the device the input frames exist on.
  8589. @item reverse
  8590. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8591. and map them back to the source. This may be necessary in some cases where
  8592. a mapping in one direction is required but only the opposite direction is
  8593. supported by the devices being used.
  8594. This option is dangerous - it may break the preceding filter in undefined
  8595. ways if there are any additional constraints on that filter's output.
  8596. Do not use it without fully understanding the implications of its use.
  8597. @end table
  8598. @anchor{hwupload}
  8599. @section hwupload
  8600. Upload system memory frames to hardware surfaces.
  8601. The device to upload to must be supplied when the filter is initialised. If
  8602. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8603. option.
  8604. @anchor{hwupload_cuda}
  8605. @section hwupload_cuda
  8606. Upload system memory frames to a CUDA device.
  8607. It accepts the following optional parameters:
  8608. @table @option
  8609. @item device
  8610. The number of the CUDA device to use
  8611. @end table
  8612. @section hqx
  8613. Apply a high-quality magnification filter designed for pixel art. This filter
  8614. was originally created by Maxim Stepin.
  8615. It accepts the following option:
  8616. @table @option
  8617. @item n
  8618. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8619. @code{hq3x} and @code{4} for @code{hq4x}.
  8620. Default is @code{3}.
  8621. @end table
  8622. @section hstack
  8623. Stack input videos horizontally.
  8624. All streams must be of same pixel format and of same height.
  8625. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8626. to create same output.
  8627. The filter accept the following option:
  8628. @table @option
  8629. @item inputs
  8630. Set number of input streams. Default is 2.
  8631. @item shortest
  8632. If set to 1, force the output to terminate when the shortest input
  8633. terminates. Default value is 0.
  8634. @end table
  8635. @section hue
  8636. Modify the hue and/or the saturation of the input.
  8637. It accepts the following parameters:
  8638. @table @option
  8639. @item h
  8640. Specify the hue angle as a number of degrees. It accepts an expression,
  8641. and defaults to "0".
  8642. @item s
  8643. Specify the saturation in the [-10,10] range. It accepts an expression and
  8644. defaults to "1".
  8645. @item H
  8646. Specify the hue angle as a number of radians. It accepts an
  8647. expression, and defaults to "0".
  8648. @item b
  8649. Specify the brightness in the [-10,10] range. It accepts an expression and
  8650. defaults to "0".
  8651. @end table
  8652. @option{h} and @option{H} are mutually exclusive, and can't be
  8653. specified at the same time.
  8654. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8655. expressions containing the following constants:
  8656. @table @option
  8657. @item n
  8658. frame count of the input frame starting from 0
  8659. @item pts
  8660. presentation timestamp of the input frame expressed in time base units
  8661. @item r
  8662. frame rate of the input video, NAN if the input frame rate is unknown
  8663. @item t
  8664. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8665. @item tb
  8666. time base of the input video
  8667. @end table
  8668. @subsection Examples
  8669. @itemize
  8670. @item
  8671. Set the hue to 90 degrees and the saturation to 1.0:
  8672. @example
  8673. hue=h=90:s=1
  8674. @end example
  8675. @item
  8676. Same command but expressing the hue in radians:
  8677. @example
  8678. hue=H=PI/2:s=1
  8679. @end example
  8680. @item
  8681. Rotate hue and make the saturation swing between 0
  8682. and 2 over a period of 1 second:
  8683. @example
  8684. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8685. @end example
  8686. @item
  8687. Apply a 3 seconds saturation fade-in effect starting at 0:
  8688. @example
  8689. hue="s=min(t/3\,1)"
  8690. @end example
  8691. The general fade-in expression can be written as:
  8692. @example
  8693. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8694. @end example
  8695. @item
  8696. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8697. @example
  8698. hue="s=max(0\, min(1\, (8-t)/3))"
  8699. @end example
  8700. The general fade-out expression can be written as:
  8701. @example
  8702. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8703. @end example
  8704. @end itemize
  8705. @subsection Commands
  8706. This filter supports the following commands:
  8707. @table @option
  8708. @item b
  8709. @item s
  8710. @item h
  8711. @item H
  8712. Modify the hue and/or the saturation and/or brightness of the input video.
  8713. The command accepts the same syntax of the corresponding option.
  8714. If the specified expression is not valid, it is kept at its current
  8715. value.
  8716. @end table
  8717. @section hysteresis
  8718. Grow first stream into second stream by connecting components.
  8719. This makes it possible to build more robust edge masks.
  8720. This filter accepts the following options:
  8721. @table @option
  8722. @item planes
  8723. Set which planes will be processed as bitmap, unprocessed planes will be
  8724. copied from first stream.
  8725. By default value 0xf, all planes will be processed.
  8726. @item threshold
  8727. Set threshold which is used in filtering. If pixel component value is higher than
  8728. this value filter algorithm for connecting components is activated.
  8729. By default value is 0.
  8730. @end table
  8731. @section idet
  8732. Detect video interlacing type.
  8733. This filter tries to detect if the input frames are interlaced, progressive,
  8734. top or bottom field first. It will also try to detect fields that are
  8735. repeated between adjacent frames (a sign of telecine).
  8736. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8737. Multiple frame detection incorporates the classification history of previous frames.
  8738. The filter will log these metadata values:
  8739. @table @option
  8740. @item single.current_frame
  8741. Detected type of current frame using single-frame detection. One of:
  8742. ``tff'' (top field first), ``bff'' (bottom field first),
  8743. ``progressive'', or ``undetermined''
  8744. @item single.tff
  8745. Cumulative number of frames detected as top field first using single-frame detection.
  8746. @item multiple.tff
  8747. Cumulative number of frames detected as top field first using multiple-frame detection.
  8748. @item single.bff
  8749. Cumulative number of frames detected as bottom field first using single-frame detection.
  8750. @item multiple.current_frame
  8751. Detected type of current frame using multiple-frame detection. One of:
  8752. ``tff'' (top field first), ``bff'' (bottom field first),
  8753. ``progressive'', or ``undetermined''
  8754. @item multiple.bff
  8755. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8756. @item single.progressive
  8757. Cumulative number of frames detected as progressive using single-frame detection.
  8758. @item multiple.progressive
  8759. Cumulative number of frames detected as progressive using multiple-frame detection.
  8760. @item single.undetermined
  8761. Cumulative number of frames that could not be classified using single-frame detection.
  8762. @item multiple.undetermined
  8763. Cumulative number of frames that could not be classified using multiple-frame detection.
  8764. @item repeated.current_frame
  8765. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8766. @item repeated.neither
  8767. Cumulative number of frames with no repeated field.
  8768. @item repeated.top
  8769. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8770. @item repeated.bottom
  8771. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8772. @end table
  8773. The filter accepts the following options:
  8774. @table @option
  8775. @item intl_thres
  8776. Set interlacing threshold.
  8777. @item prog_thres
  8778. Set progressive threshold.
  8779. @item rep_thres
  8780. Threshold for repeated field detection.
  8781. @item half_life
  8782. Number of frames after which a given frame's contribution to the
  8783. statistics is halved (i.e., it contributes only 0.5 to its
  8784. classification). The default of 0 means that all frames seen are given
  8785. full weight of 1.0 forever.
  8786. @item analyze_interlaced_flag
  8787. When this is not 0 then idet will use the specified number of frames to determine
  8788. if the interlaced flag is accurate, it will not count undetermined frames.
  8789. If the flag is found to be accurate it will be used without any further
  8790. computations, if it is found to be inaccurate it will be cleared without any
  8791. further computations. This allows inserting the idet filter as a low computational
  8792. method to clean up the interlaced flag
  8793. @end table
  8794. @section il
  8795. Deinterleave or interleave fields.
  8796. This filter allows one to process interlaced images fields without
  8797. deinterlacing them. Deinterleaving splits the input frame into 2
  8798. fields (so called half pictures). Odd lines are moved to the top
  8799. half of the output image, even lines to the bottom half.
  8800. You can process (filter) them independently and then re-interleave them.
  8801. The filter accepts the following options:
  8802. @table @option
  8803. @item luma_mode, l
  8804. @item chroma_mode, c
  8805. @item alpha_mode, a
  8806. Available values for @var{luma_mode}, @var{chroma_mode} and
  8807. @var{alpha_mode} are:
  8808. @table @samp
  8809. @item none
  8810. Do nothing.
  8811. @item deinterleave, d
  8812. Deinterleave fields, placing one above the other.
  8813. @item interleave, i
  8814. Interleave fields. Reverse the effect of deinterleaving.
  8815. @end table
  8816. Default value is @code{none}.
  8817. @item luma_swap, ls
  8818. @item chroma_swap, cs
  8819. @item alpha_swap, as
  8820. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8821. @end table
  8822. @section inflate
  8823. Apply inflate effect to the video.
  8824. This filter replaces the pixel by the local(3x3) average by taking into account
  8825. only values higher than the pixel.
  8826. It accepts the following options:
  8827. @table @option
  8828. @item threshold0
  8829. @item threshold1
  8830. @item threshold2
  8831. @item threshold3
  8832. Limit the maximum change for each plane, default is 65535.
  8833. If 0, plane will remain unchanged.
  8834. @end table
  8835. @section interlace
  8836. Simple interlacing filter from progressive contents. This interleaves upper (or
  8837. lower) lines from odd frames with lower (or upper) lines from even frames,
  8838. halving the frame rate and preserving image height.
  8839. @example
  8840. Original Original New Frame
  8841. Frame 'j' Frame 'j+1' (tff)
  8842. ========== =========== ==================
  8843. Line 0 --------------------> Frame 'j' Line 0
  8844. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8845. Line 2 ---------------------> Frame 'j' Line 2
  8846. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8847. ... ... ...
  8848. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8849. @end example
  8850. It accepts the following optional parameters:
  8851. @table @option
  8852. @item scan
  8853. This determines whether the interlaced frame is taken from the even
  8854. (tff - default) or odd (bff) lines of the progressive frame.
  8855. @item lowpass
  8856. Vertical lowpass filter to avoid twitter interlacing and
  8857. reduce moire patterns.
  8858. @table @samp
  8859. @item 0, off
  8860. Disable vertical lowpass filter
  8861. @item 1, linear
  8862. Enable linear filter (default)
  8863. @item 2, complex
  8864. Enable complex filter. This will slightly less reduce twitter and moire
  8865. but better retain detail and subjective sharpness impression.
  8866. @end table
  8867. @end table
  8868. @section kerndeint
  8869. Deinterlace input video by applying Donald Graft's adaptive kernel
  8870. deinterling. Work on interlaced parts of a video to produce
  8871. progressive frames.
  8872. The description of the accepted parameters follows.
  8873. @table @option
  8874. @item thresh
  8875. Set the threshold which affects the filter's tolerance when
  8876. determining if a pixel line must be processed. It must be an integer
  8877. in the range [0,255] and defaults to 10. A value of 0 will result in
  8878. applying the process on every pixels.
  8879. @item map
  8880. Paint pixels exceeding the threshold value to white if set to 1.
  8881. Default is 0.
  8882. @item order
  8883. Set the fields order. Swap fields if set to 1, leave fields alone if
  8884. 0. Default is 0.
  8885. @item sharp
  8886. Enable additional sharpening if set to 1. Default is 0.
  8887. @item twoway
  8888. Enable twoway sharpening if set to 1. Default is 0.
  8889. @end table
  8890. @subsection Examples
  8891. @itemize
  8892. @item
  8893. Apply default values:
  8894. @example
  8895. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8896. @end example
  8897. @item
  8898. Enable additional sharpening:
  8899. @example
  8900. kerndeint=sharp=1
  8901. @end example
  8902. @item
  8903. Paint processed pixels in white:
  8904. @example
  8905. kerndeint=map=1
  8906. @end example
  8907. @end itemize
  8908. @section lagfun
  8909. Slowly update darker pixels.
  8910. This filter makes short flashes of light appear longer.
  8911. This filter accepts the following options:
  8912. @table @option
  8913. @item decay
  8914. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  8915. @item planes
  8916. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  8917. @end table
  8918. @section lenscorrection
  8919. Correct radial lens distortion
  8920. This filter can be used to correct for radial distortion as can result from the use
  8921. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8922. one can use tools available for example as part of opencv or simply trial-and-error.
  8923. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8924. and extract the k1 and k2 coefficients from the resulting matrix.
  8925. Note that effectively the same filter is available in the open-source tools Krita and
  8926. Digikam from the KDE project.
  8927. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8928. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8929. brightness distribution, so you may want to use both filters together in certain
  8930. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8931. be applied before or after lens correction.
  8932. @subsection Options
  8933. The filter accepts the following options:
  8934. @table @option
  8935. @item cx
  8936. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8937. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8938. width. Default is 0.5.
  8939. @item cy
  8940. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8941. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8942. height. Default is 0.5.
  8943. @item k1
  8944. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8945. no correction. Default is 0.
  8946. @item k2
  8947. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8948. 0 means no correction. Default is 0.
  8949. @end table
  8950. The formula that generates the correction is:
  8951. @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)
  8952. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8953. distances from the focal point in the source and target images, respectively.
  8954. @section lensfun
  8955. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8956. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8957. to apply the lens correction. The filter will load the lensfun database and
  8958. query it to find the corresponding camera and lens entries in the database. As
  8959. long as these entries can be found with the given options, the filter can
  8960. perform corrections on frames. Note that incomplete strings will result in the
  8961. filter choosing the best match with the given options, and the filter will
  8962. output the chosen camera and lens models (logged with level "info"). You must
  8963. provide the make, camera model, and lens model as they are required.
  8964. The filter accepts the following options:
  8965. @table @option
  8966. @item make
  8967. The make of the camera (for example, "Canon"). This option is required.
  8968. @item model
  8969. The model of the camera (for example, "Canon EOS 100D"). This option is
  8970. required.
  8971. @item lens_model
  8972. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8973. option is required.
  8974. @item mode
  8975. The type of correction to apply. The following values are valid options:
  8976. @table @samp
  8977. @item vignetting
  8978. Enables fixing lens vignetting.
  8979. @item geometry
  8980. Enables fixing lens geometry. This is the default.
  8981. @item subpixel
  8982. Enables fixing chromatic aberrations.
  8983. @item vig_geo
  8984. Enables fixing lens vignetting and lens geometry.
  8985. @item vig_subpixel
  8986. Enables fixing lens vignetting and chromatic aberrations.
  8987. @item distortion
  8988. Enables fixing both lens geometry and chromatic aberrations.
  8989. @item all
  8990. Enables all possible corrections.
  8991. @end table
  8992. @item focal_length
  8993. The focal length of the image/video (zoom; expected constant for video). For
  8994. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8995. range should be chosen when using that lens. Default 18.
  8996. @item aperture
  8997. The aperture of the image/video (expected constant for video). Note that
  8998. aperture is only used for vignetting correction. Default 3.5.
  8999. @item focus_distance
  9000. The focus distance of the image/video (expected constant for video). Note that
  9001. focus distance is only used for vignetting and only slightly affects the
  9002. vignetting correction process. If unknown, leave it at the default value (which
  9003. is 1000).
  9004. @item scale
  9005. The scale factor which is applied after transformation. After correction the
  9006. video is no longer necessarily rectangular. This parameter controls how much of
  9007. the resulting image is visible. The value 0 means that a value will be chosen
  9008. automatically such that there is little or no unmapped area in the output
  9009. image. 1.0 means that no additional scaling is done. Lower values may result
  9010. in more of the corrected image being visible, while higher values may avoid
  9011. unmapped areas in the output.
  9012. @item target_geometry
  9013. The target geometry of the output image/video. The following values are valid
  9014. options:
  9015. @table @samp
  9016. @item rectilinear (default)
  9017. @item fisheye
  9018. @item panoramic
  9019. @item equirectangular
  9020. @item fisheye_orthographic
  9021. @item fisheye_stereographic
  9022. @item fisheye_equisolid
  9023. @item fisheye_thoby
  9024. @end table
  9025. @item reverse
  9026. Apply the reverse of image correction (instead of correcting distortion, apply
  9027. it).
  9028. @item interpolation
  9029. The type of interpolation used when correcting distortion. The following values
  9030. are valid options:
  9031. @table @samp
  9032. @item nearest
  9033. @item linear (default)
  9034. @item lanczos
  9035. @end table
  9036. @end table
  9037. @subsection Examples
  9038. @itemize
  9039. @item
  9040. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9041. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9042. aperture of "8.0".
  9043. @example
  9044. 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
  9045. @end example
  9046. @item
  9047. Apply the same as before, but only for the first 5 seconds of video.
  9048. @example
  9049. 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
  9050. @end example
  9051. @end itemize
  9052. @section libvmaf
  9053. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9054. score between two input videos.
  9055. The obtained VMAF score is printed through the logging system.
  9056. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9057. After installing the library it can be enabled using:
  9058. @code{./configure --enable-libvmaf --enable-version3}.
  9059. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9060. The filter has following options:
  9061. @table @option
  9062. @item model_path
  9063. Set the model path which is to be used for SVM.
  9064. Default value: @code{"vmaf_v0.6.1.pkl"}
  9065. @item log_path
  9066. Set the file path to be used to store logs.
  9067. @item log_fmt
  9068. Set the format of the log file (xml or json).
  9069. @item enable_transform
  9070. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9071. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9072. Default value: @code{false}
  9073. @item phone_model
  9074. Invokes the phone model which will generate VMAF scores higher than in the
  9075. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9076. @item psnr
  9077. Enables computing psnr along with vmaf.
  9078. @item ssim
  9079. Enables computing ssim along with vmaf.
  9080. @item ms_ssim
  9081. Enables computing ms_ssim along with vmaf.
  9082. @item pool
  9083. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  9084. @item n_threads
  9085. Set number of threads to be used when computing vmaf.
  9086. @item n_subsample
  9087. Set interval for frame subsampling used when computing vmaf.
  9088. @item enable_conf_interval
  9089. Enables confidence interval.
  9090. @end table
  9091. This filter also supports the @ref{framesync} options.
  9092. On the below examples the input file @file{main.mpg} being processed is
  9093. compared with the reference file @file{ref.mpg}.
  9094. @example
  9095. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9096. @end example
  9097. Example with options:
  9098. @example
  9099. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9100. @end example
  9101. @section limiter
  9102. Limits the pixel components values to the specified range [min, max].
  9103. The filter accepts the following options:
  9104. @table @option
  9105. @item min
  9106. Lower bound. Defaults to the lowest allowed value for the input.
  9107. @item max
  9108. Upper bound. Defaults to the highest allowed value for the input.
  9109. @item planes
  9110. Specify which planes will be processed. Defaults to all available.
  9111. @end table
  9112. @section loop
  9113. Loop video frames.
  9114. The filter accepts the following options:
  9115. @table @option
  9116. @item loop
  9117. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9118. Default is 0.
  9119. @item size
  9120. Set maximal size in number of frames. Default is 0.
  9121. @item start
  9122. Set first frame of loop. Default is 0.
  9123. @end table
  9124. @subsection Examples
  9125. @itemize
  9126. @item
  9127. Loop single first frame infinitely:
  9128. @example
  9129. loop=loop=-1:size=1:start=0
  9130. @end example
  9131. @item
  9132. Loop single first frame 10 times:
  9133. @example
  9134. loop=loop=10:size=1:start=0
  9135. @end example
  9136. @item
  9137. Loop 10 first frames 5 times:
  9138. @example
  9139. loop=loop=5:size=10:start=0
  9140. @end example
  9141. @end itemize
  9142. @section lut1d
  9143. Apply a 1D LUT to an input video.
  9144. The filter accepts the following options:
  9145. @table @option
  9146. @item file
  9147. Set the 1D LUT file name.
  9148. Currently supported formats:
  9149. @table @samp
  9150. @item cube
  9151. Iridas
  9152. @item csp
  9153. cineSpace
  9154. @end table
  9155. @item interp
  9156. Select interpolation mode.
  9157. Available values are:
  9158. @table @samp
  9159. @item nearest
  9160. Use values from the nearest defined point.
  9161. @item linear
  9162. Interpolate values using the linear interpolation.
  9163. @item cosine
  9164. Interpolate values using the cosine interpolation.
  9165. @item cubic
  9166. Interpolate values using the cubic interpolation.
  9167. @item spline
  9168. Interpolate values using the spline interpolation.
  9169. @end table
  9170. @end table
  9171. @anchor{lut3d}
  9172. @section lut3d
  9173. Apply a 3D LUT to an input video.
  9174. The filter accepts the following options:
  9175. @table @option
  9176. @item file
  9177. Set the 3D LUT file name.
  9178. Currently supported formats:
  9179. @table @samp
  9180. @item 3dl
  9181. AfterEffects
  9182. @item cube
  9183. Iridas
  9184. @item dat
  9185. DaVinci
  9186. @item m3d
  9187. Pandora
  9188. @item csp
  9189. cineSpace
  9190. @end table
  9191. @item interp
  9192. Select interpolation mode.
  9193. Available values are:
  9194. @table @samp
  9195. @item nearest
  9196. Use values from the nearest defined point.
  9197. @item trilinear
  9198. Interpolate values using the 8 points defining a cube.
  9199. @item tetrahedral
  9200. Interpolate values using a tetrahedron.
  9201. @end table
  9202. @end table
  9203. @section lumakey
  9204. Turn certain luma values into transparency.
  9205. The filter accepts the following options:
  9206. @table @option
  9207. @item threshold
  9208. Set the luma which will be used as base for transparency.
  9209. Default value is @code{0}.
  9210. @item tolerance
  9211. Set the range of luma values to be keyed out.
  9212. Default value is @code{0}.
  9213. @item softness
  9214. Set the range of softness. Default value is @code{0}.
  9215. Use this to control gradual transition from zero to full transparency.
  9216. @end table
  9217. @section lut, lutrgb, lutyuv
  9218. Compute a look-up table for binding each pixel component input value
  9219. to an output value, and apply it to the input video.
  9220. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9221. to an RGB input video.
  9222. These filters accept the following parameters:
  9223. @table @option
  9224. @item c0
  9225. set first pixel component expression
  9226. @item c1
  9227. set second pixel component expression
  9228. @item c2
  9229. set third pixel component expression
  9230. @item c3
  9231. set fourth pixel component expression, corresponds to the alpha component
  9232. @item r
  9233. set red component expression
  9234. @item g
  9235. set green component expression
  9236. @item b
  9237. set blue component expression
  9238. @item a
  9239. alpha component expression
  9240. @item y
  9241. set Y/luminance component expression
  9242. @item u
  9243. set U/Cb component expression
  9244. @item v
  9245. set V/Cr component expression
  9246. @end table
  9247. Each of them specifies the expression to use for computing the lookup table for
  9248. the corresponding pixel component values.
  9249. The exact component associated to each of the @var{c*} options depends on the
  9250. format in input.
  9251. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9252. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9253. The expressions can contain the following constants and functions:
  9254. @table @option
  9255. @item w
  9256. @item h
  9257. The input width and height.
  9258. @item val
  9259. The input value for the pixel component.
  9260. @item clipval
  9261. The input value, clipped to the @var{minval}-@var{maxval} range.
  9262. @item maxval
  9263. The maximum value for the pixel component.
  9264. @item minval
  9265. The minimum value for the pixel component.
  9266. @item negval
  9267. The negated value for the pixel component value, clipped to the
  9268. @var{minval}-@var{maxval} range; it corresponds to the expression
  9269. "maxval-clipval+minval".
  9270. @item clip(val)
  9271. The computed value in @var{val}, clipped to the
  9272. @var{minval}-@var{maxval} range.
  9273. @item gammaval(gamma)
  9274. The computed gamma correction value of the pixel component value,
  9275. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9276. expression
  9277. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9278. @end table
  9279. All expressions default to "val".
  9280. @subsection Examples
  9281. @itemize
  9282. @item
  9283. Negate input video:
  9284. @example
  9285. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9286. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9287. @end example
  9288. The above is the same as:
  9289. @example
  9290. lutrgb="r=negval:g=negval:b=negval"
  9291. lutyuv="y=negval:u=negval:v=negval"
  9292. @end example
  9293. @item
  9294. Negate luminance:
  9295. @example
  9296. lutyuv=y=negval
  9297. @end example
  9298. @item
  9299. Remove chroma components, turning the video into a graytone image:
  9300. @example
  9301. lutyuv="u=128:v=128"
  9302. @end example
  9303. @item
  9304. Apply a luma burning effect:
  9305. @example
  9306. lutyuv="y=2*val"
  9307. @end example
  9308. @item
  9309. Remove green and blue components:
  9310. @example
  9311. lutrgb="g=0:b=0"
  9312. @end example
  9313. @item
  9314. Set a constant alpha channel value on input:
  9315. @example
  9316. format=rgba,lutrgb=a="maxval-minval/2"
  9317. @end example
  9318. @item
  9319. Correct luminance gamma by a factor of 0.5:
  9320. @example
  9321. lutyuv=y=gammaval(0.5)
  9322. @end example
  9323. @item
  9324. Discard least significant bits of luma:
  9325. @example
  9326. lutyuv=y='bitand(val, 128+64+32)'
  9327. @end example
  9328. @item
  9329. Technicolor like effect:
  9330. @example
  9331. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9332. @end example
  9333. @end itemize
  9334. @section lut2, tlut2
  9335. The @code{lut2} filter takes two input streams and outputs one
  9336. stream.
  9337. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9338. from one single stream.
  9339. This filter accepts the following parameters:
  9340. @table @option
  9341. @item c0
  9342. set first pixel component expression
  9343. @item c1
  9344. set second pixel component expression
  9345. @item c2
  9346. set third pixel component expression
  9347. @item c3
  9348. set fourth pixel component expression, corresponds to the alpha component
  9349. @item d
  9350. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9351. which means bit depth is automatically picked from first input format.
  9352. @end table
  9353. Each of them specifies the expression to use for computing the lookup table for
  9354. the corresponding pixel component values.
  9355. The exact component associated to each of the @var{c*} options depends on the
  9356. format in inputs.
  9357. The expressions can contain the following constants:
  9358. @table @option
  9359. @item w
  9360. @item h
  9361. The input width and height.
  9362. @item x
  9363. The first input value for the pixel component.
  9364. @item y
  9365. The second input value for the pixel component.
  9366. @item bdx
  9367. The first input video bit depth.
  9368. @item bdy
  9369. The second input video bit depth.
  9370. @end table
  9371. All expressions default to "x".
  9372. @subsection Examples
  9373. @itemize
  9374. @item
  9375. Highlight differences between two RGB video streams:
  9376. @example
  9377. 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)'
  9378. @end example
  9379. @item
  9380. Highlight differences between two YUV video streams:
  9381. @example
  9382. 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)'
  9383. @end example
  9384. @item
  9385. Show max difference between two video streams:
  9386. @example
  9387. 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)))'
  9388. @end example
  9389. @end itemize
  9390. @section maskedclamp
  9391. Clamp the first input stream with the second input and third input stream.
  9392. Returns the value of first stream to be between second input
  9393. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9394. This filter accepts the following options:
  9395. @table @option
  9396. @item undershoot
  9397. Default value is @code{0}.
  9398. @item overshoot
  9399. Default value is @code{0}.
  9400. @item planes
  9401. Set which planes will be processed as bitmap, unprocessed planes will be
  9402. copied from first stream.
  9403. By default value 0xf, all planes will be processed.
  9404. @end table
  9405. @section maskedmerge
  9406. Merge the first input stream with the second input stream using per pixel
  9407. weights in the third input stream.
  9408. A value of 0 in the third stream pixel component means that pixel component
  9409. from first stream is returned unchanged, while maximum value (eg. 255 for
  9410. 8-bit videos) means that pixel component from second stream is returned
  9411. unchanged. Intermediate values define the amount of merging between both
  9412. input stream's pixel components.
  9413. This filter accepts the following options:
  9414. @table @option
  9415. @item planes
  9416. Set which planes will be processed as bitmap, unprocessed planes will be
  9417. copied from first stream.
  9418. By default value 0xf, all planes will be processed.
  9419. @end table
  9420. @section maskfun
  9421. Create mask from input video.
  9422. For example it is useful to create motion masks after @code{tblend} filter.
  9423. This filter accepts the following options:
  9424. @table @option
  9425. @item low
  9426. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9427. @item high
  9428. Set high threshold. Any pixel component higher than this value will be set to max value
  9429. allowed for current pixel format.
  9430. @item planes
  9431. Set planes to filter, by default all available planes are filtered.
  9432. @item fill
  9433. Fill all frame pixels with this value.
  9434. @item sum
  9435. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9436. average, output frame will be completely filled with value set by @var{fill} option.
  9437. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9438. @end table
  9439. @section mcdeint
  9440. Apply motion-compensation deinterlacing.
  9441. It needs one field per frame as input and must thus be used together
  9442. with yadif=1/3 or equivalent.
  9443. This filter accepts the following options:
  9444. @table @option
  9445. @item mode
  9446. Set the deinterlacing mode.
  9447. It accepts one of the following values:
  9448. @table @samp
  9449. @item fast
  9450. @item medium
  9451. @item slow
  9452. use iterative motion estimation
  9453. @item extra_slow
  9454. like @samp{slow}, but use multiple reference frames.
  9455. @end table
  9456. Default value is @samp{fast}.
  9457. @item parity
  9458. Set the picture field parity assumed for the input video. It must be
  9459. one of the following values:
  9460. @table @samp
  9461. @item 0, tff
  9462. assume top field first
  9463. @item 1, bff
  9464. assume bottom field first
  9465. @end table
  9466. Default value is @samp{bff}.
  9467. @item qp
  9468. Set per-block quantization parameter (QP) used by the internal
  9469. encoder.
  9470. Higher values should result in a smoother motion vector field but less
  9471. optimal individual vectors. Default value is 1.
  9472. @end table
  9473. @section mergeplanes
  9474. Merge color channel components from several video streams.
  9475. The filter accepts up to 4 input streams, and merge selected input
  9476. planes to the output video.
  9477. This filter accepts the following options:
  9478. @table @option
  9479. @item mapping
  9480. Set input to output plane mapping. Default is @code{0}.
  9481. The mappings is specified as a bitmap. It should be specified as a
  9482. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9483. mapping for the first plane of the output stream. 'A' sets the number of
  9484. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9485. corresponding input to use (from 0 to 3). The rest of the mappings is
  9486. similar, 'Bb' describes the mapping for the output stream second
  9487. plane, 'Cc' describes the mapping for the output stream third plane and
  9488. 'Dd' describes the mapping for the output stream fourth plane.
  9489. @item format
  9490. Set output pixel format. Default is @code{yuva444p}.
  9491. @end table
  9492. @subsection Examples
  9493. @itemize
  9494. @item
  9495. Merge three gray video streams of same width and height into single video stream:
  9496. @example
  9497. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9498. @end example
  9499. @item
  9500. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9501. @example
  9502. [a0][a1]mergeplanes=0x00010210:yuva444p
  9503. @end example
  9504. @item
  9505. Swap Y and A plane in yuva444p stream:
  9506. @example
  9507. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9508. @end example
  9509. @item
  9510. Swap U and V plane in yuv420p stream:
  9511. @example
  9512. format=yuv420p,mergeplanes=0x000201:yuv420p
  9513. @end example
  9514. @item
  9515. Cast a rgb24 clip to yuv444p:
  9516. @example
  9517. format=rgb24,mergeplanes=0x000102:yuv444p
  9518. @end example
  9519. @end itemize
  9520. @section mestimate
  9521. Estimate and export motion vectors using block matching algorithms.
  9522. Motion vectors are stored in frame side data to be used by other filters.
  9523. This filter accepts the following options:
  9524. @table @option
  9525. @item method
  9526. Specify the motion estimation method. Accepts one of the following values:
  9527. @table @samp
  9528. @item esa
  9529. Exhaustive search algorithm.
  9530. @item tss
  9531. Three step search algorithm.
  9532. @item tdls
  9533. Two dimensional logarithmic search algorithm.
  9534. @item ntss
  9535. New three step search algorithm.
  9536. @item fss
  9537. Four step search algorithm.
  9538. @item ds
  9539. Diamond search algorithm.
  9540. @item hexbs
  9541. Hexagon-based search algorithm.
  9542. @item epzs
  9543. Enhanced predictive zonal search algorithm.
  9544. @item umh
  9545. Uneven multi-hexagon search algorithm.
  9546. @end table
  9547. Default value is @samp{esa}.
  9548. @item mb_size
  9549. Macroblock size. Default @code{16}.
  9550. @item search_param
  9551. Search parameter. Default @code{7}.
  9552. @end table
  9553. @section midequalizer
  9554. Apply Midway Image Equalization effect using two video streams.
  9555. Midway Image Equalization adjusts a pair of images to have the same
  9556. histogram, while maintaining their dynamics as much as possible. It's
  9557. useful for e.g. matching exposures from a pair of stereo cameras.
  9558. This filter has two inputs and one output, which must be of same pixel format, but
  9559. may be of different sizes. The output of filter is first input adjusted with
  9560. midway histogram of both inputs.
  9561. This filter accepts the following option:
  9562. @table @option
  9563. @item planes
  9564. Set which planes to process. Default is @code{15}, which is all available planes.
  9565. @end table
  9566. @section minterpolate
  9567. Convert the video to specified frame rate using motion interpolation.
  9568. This filter accepts the following options:
  9569. @table @option
  9570. @item fps
  9571. 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}.
  9572. @item mi_mode
  9573. Motion interpolation mode. Following values are accepted:
  9574. @table @samp
  9575. @item dup
  9576. Duplicate previous or next frame for interpolating new ones.
  9577. @item blend
  9578. Blend source frames. Interpolated frame is mean of previous and next frames.
  9579. @item mci
  9580. Motion compensated interpolation. Following options are effective when this mode is selected:
  9581. @table @samp
  9582. @item mc_mode
  9583. Motion compensation mode. Following values are accepted:
  9584. @table @samp
  9585. @item obmc
  9586. Overlapped block motion compensation.
  9587. @item aobmc
  9588. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9589. @end table
  9590. Default mode is @samp{obmc}.
  9591. @item me_mode
  9592. Motion estimation mode. Following values are accepted:
  9593. @table @samp
  9594. @item bidir
  9595. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9596. @item bilat
  9597. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9598. @end table
  9599. Default mode is @samp{bilat}.
  9600. @item me
  9601. The algorithm to be used for motion estimation. Following values are accepted:
  9602. @table @samp
  9603. @item esa
  9604. Exhaustive search algorithm.
  9605. @item tss
  9606. Three step search algorithm.
  9607. @item tdls
  9608. Two dimensional logarithmic search algorithm.
  9609. @item ntss
  9610. New three step search algorithm.
  9611. @item fss
  9612. Four step search algorithm.
  9613. @item ds
  9614. Diamond search algorithm.
  9615. @item hexbs
  9616. Hexagon-based search algorithm.
  9617. @item epzs
  9618. Enhanced predictive zonal search algorithm.
  9619. @item umh
  9620. Uneven multi-hexagon search algorithm.
  9621. @end table
  9622. Default algorithm is @samp{epzs}.
  9623. @item mb_size
  9624. Macroblock size. Default @code{16}.
  9625. @item search_param
  9626. Motion estimation search parameter. Default @code{32}.
  9627. @item vsbmc
  9628. 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).
  9629. @end table
  9630. @end table
  9631. @item scd
  9632. 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:
  9633. @table @samp
  9634. @item none
  9635. Disable scene change detection.
  9636. @item fdiff
  9637. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9638. @end table
  9639. Default method is @samp{fdiff}.
  9640. @item scd_threshold
  9641. Scene change detection threshold. Default is @code{5.0}.
  9642. @end table
  9643. @section mix
  9644. Mix several video input streams into one video stream.
  9645. A description of the accepted options follows.
  9646. @table @option
  9647. @item nb_inputs
  9648. The number of inputs. If unspecified, it defaults to 2.
  9649. @item weights
  9650. Specify weight of each input video stream as sequence.
  9651. Each weight is separated by space. If number of weights
  9652. is smaller than number of @var{frames} last specified
  9653. weight will be used for all remaining unset weights.
  9654. @item scale
  9655. Specify scale, if it is set it will be multiplied with sum
  9656. of each weight multiplied with pixel values to give final destination
  9657. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9658. @item duration
  9659. Specify how end of stream is determined.
  9660. @table @samp
  9661. @item longest
  9662. The duration of the longest input. (default)
  9663. @item shortest
  9664. The duration of the shortest input.
  9665. @item first
  9666. The duration of the first input.
  9667. @end table
  9668. @end table
  9669. @section mpdecimate
  9670. Drop frames that do not differ greatly from the previous frame in
  9671. order to reduce frame rate.
  9672. The main use of this filter is for very-low-bitrate encoding
  9673. (e.g. streaming over dialup modem), but it could in theory be used for
  9674. fixing movies that were inverse-telecined incorrectly.
  9675. A description of the accepted options follows.
  9676. @table @option
  9677. @item max
  9678. Set the maximum number of consecutive frames which can be dropped (if
  9679. positive), or the minimum interval between dropped frames (if
  9680. negative). If the value is 0, the frame is dropped disregarding the
  9681. number of previous sequentially dropped frames.
  9682. Default value is 0.
  9683. @item hi
  9684. @item lo
  9685. @item frac
  9686. Set the dropping threshold values.
  9687. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9688. represent actual pixel value differences, so a threshold of 64
  9689. corresponds to 1 unit of difference for each pixel, or the same spread
  9690. out differently over the block.
  9691. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9692. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9693. meaning the whole image) differ by more than a threshold of @option{lo}.
  9694. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9695. 64*5, and default value for @option{frac} is 0.33.
  9696. @end table
  9697. @section negate
  9698. Negate (invert) the input video.
  9699. It accepts the following option:
  9700. @table @option
  9701. @item negate_alpha
  9702. With value 1, it negates the alpha component, if present. Default value is 0.
  9703. @end table
  9704. @anchor{nlmeans}
  9705. @section nlmeans
  9706. Denoise frames using Non-Local Means algorithm.
  9707. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9708. context similarity is defined by comparing their surrounding patches of size
  9709. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9710. around the pixel.
  9711. Note that the research area defines centers for patches, which means some
  9712. patches will be made of pixels outside that research area.
  9713. The filter accepts the following options.
  9714. @table @option
  9715. @item s
  9716. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9717. @item p
  9718. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9719. @item pc
  9720. Same as @option{p} but for chroma planes.
  9721. The default value is @var{0} and means automatic.
  9722. @item r
  9723. Set research size. Default is 15. Must be odd number in range [0, 99].
  9724. @item rc
  9725. Same as @option{r} but for chroma planes.
  9726. The default value is @var{0} and means automatic.
  9727. @end table
  9728. @section nnedi
  9729. Deinterlace video using neural network edge directed interpolation.
  9730. This filter accepts the following options:
  9731. @table @option
  9732. @item weights
  9733. Mandatory option, without binary file filter can not work.
  9734. Currently file can be found here:
  9735. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9736. @item deint
  9737. Set which frames to deinterlace, by default it is @code{all}.
  9738. Can be @code{all} or @code{interlaced}.
  9739. @item field
  9740. Set mode of operation.
  9741. Can be one of the following:
  9742. @table @samp
  9743. @item af
  9744. Use frame flags, both fields.
  9745. @item a
  9746. Use frame flags, single field.
  9747. @item t
  9748. Use top field only.
  9749. @item b
  9750. Use bottom field only.
  9751. @item tf
  9752. Use both fields, top first.
  9753. @item bf
  9754. Use both fields, bottom first.
  9755. @end table
  9756. @item planes
  9757. Set which planes to process, by default filter process all frames.
  9758. @item nsize
  9759. Set size of local neighborhood around each pixel, used by the predictor neural
  9760. network.
  9761. Can be one of the following:
  9762. @table @samp
  9763. @item s8x6
  9764. @item s16x6
  9765. @item s32x6
  9766. @item s48x6
  9767. @item s8x4
  9768. @item s16x4
  9769. @item s32x4
  9770. @end table
  9771. @item nns
  9772. Set the number of neurons in predictor neural network.
  9773. Can be one of the following:
  9774. @table @samp
  9775. @item n16
  9776. @item n32
  9777. @item n64
  9778. @item n128
  9779. @item n256
  9780. @end table
  9781. @item qual
  9782. Controls the number of different neural network predictions that are blended
  9783. together to compute the final output value. Can be @code{fast}, default or
  9784. @code{slow}.
  9785. @item etype
  9786. Set which set of weights to use in the predictor.
  9787. Can be one of the following:
  9788. @table @samp
  9789. @item a
  9790. weights trained to minimize absolute error
  9791. @item s
  9792. weights trained to minimize squared error
  9793. @end table
  9794. @item pscrn
  9795. Controls whether or not the prescreener neural network is used to decide
  9796. which pixels should be processed by the predictor neural network and which
  9797. can be handled by simple cubic interpolation.
  9798. The prescreener is trained to know whether cubic interpolation will be
  9799. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9800. The computational complexity of the prescreener nn is much less than that of
  9801. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9802. using the prescreener generally results in much faster processing.
  9803. The prescreener is pretty accurate, so the difference between using it and not
  9804. using it is almost always unnoticeable.
  9805. Can be one of the following:
  9806. @table @samp
  9807. @item none
  9808. @item original
  9809. @item new
  9810. @end table
  9811. Default is @code{new}.
  9812. @item fapprox
  9813. Set various debugging flags.
  9814. @end table
  9815. @section noformat
  9816. Force libavfilter not to use any of the specified pixel formats for the
  9817. input to the next filter.
  9818. It accepts the following parameters:
  9819. @table @option
  9820. @item pix_fmts
  9821. A '|'-separated list of pixel format names, such as
  9822. pix_fmts=yuv420p|monow|rgb24".
  9823. @end table
  9824. @subsection Examples
  9825. @itemize
  9826. @item
  9827. Force libavfilter to use a format different from @var{yuv420p} for the
  9828. input to the vflip filter:
  9829. @example
  9830. noformat=pix_fmts=yuv420p,vflip
  9831. @end example
  9832. @item
  9833. Convert the input video to any of the formats not contained in the list:
  9834. @example
  9835. noformat=yuv420p|yuv444p|yuv410p
  9836. @end example
  9837. @end itemize
  9838. @section noise
  9839. Add noise on video input frame.
  9840. The filter accepts the following options:
  9841. @table @option
  9842. @item all_seed
  9843. @item c0_seed
  9844. @item c1_seed
  9845. @item c2_seed
  9846. @item c3_seed
  9847. Set noise seed for specific pixel component or all pixel components in case
  9848. of @var{all_seed}. Default value is @code{123457}.
  9849. @item all_strength, alls
  9850. @item c0_strength, c0s
  9851. @item c1_strength, c1s
  9852. @item c2_strength, c2s
  9853. @item c3_strength, c3s
  9854. Set noise strength for specific pixel component or all pixel components in case
  9855. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9856. @item all_flags, allf
  9857. @item c0_flags, c0f
  9858. @item c1_flags, c1f
  9859. @item c2_flags, c2f
  9860. @item c3_flags, c3f
  9861. Set pixel component flags or set flags for all components if @var{all_flags}.
  9862. Available values for component flags are:
  9863. @table @samp
  9864. @item a
  9865. averaged temporal noise (smoother)
  9866. @item p
  9867. mix random noise with a (semi)regular pattern
  9868. @item t
  9869. temporal noise (noise pattern changes between frames)
  9870. @item u
  9871. uniform noise (gaussian otherwise)
  9872. @end table
  9873. @end table
  9874. @subsection Examples
  9875. Add temporal and uniform noise to input video:
  9876. @example
  9877. noise=alls=20:allf=t+u
  9878. @end example
  9879. @section normalize
  9880. Normalize RGB video (aka histogram stretching, contrast stretching).
  9881. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9882. For each channel of each frame, the filter computes the input range and maps
  9883. it linearly to the user-specified output range. The output range defaults
  9884. to the full dynamic range from pure black to pure white.
  9885. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9886. changes in brightness) caused when small dark or bright objects enter or leave
  9887. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9888. video camera, and, like a video camera, it may cause a period of over- or
  9889. under-exposure of the video.
  9890. The R,G,B channels can be normalized independently, which may cause some
  9891. color shifting, or linked together as a single channel, which prevents
  9892. color shifting. Linked normalization preserves hue. Independent normalization
  9893. does not, so it can be used to remove some color casts. Independent and linked
  9894. normalization can be combined in any ratio.
  9895. The normalize filter accepts the following options:
  9896. @table @option
  9897. @item blackpt
  9898. @item whitept
  9899. Colors which define the output range. The minimum input value is mapped to
  9900. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9901. The defaults are black and white respectively. Specifying white for
  9902. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9903. normalized video. Shades of grey can be used to reduce the dynamic range
  9904. (contrast). Specifying saturated colors here can create some interesting
  9905. effects.
  9906. @item smoothing
  9907. The number of previous frames to use for temporal smoothing. The input range
  9908. of each channel is smoothed using a rolling average over the current frame
  9909. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9910. smoothing).
  9911. @item independence
  9912. Controls the ratio of independent (color shifting) channel normalization to
  9913. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9914. independent. Defaults to 1.0 (fully independent).
  9915. @item strength
  9916. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9917. expensive no-op. Defaults to 1.0 (full strength).
  9918. @end table
  9919. @subsection Examples
  9920. Stretch video contrast to use the full dynamic range, with no temporal
  9921. smoothing; may flicker depending on the source content:
  9922. @example
  9923. normalize=blackpt=black:whitept=white:smoothing=0
  9924. @end example
  9925. As above, but with 50 frames of temporal smoothing; flicker should be
  9926. reduced, depending on the source content:
  9927. @example
  9928. normalize=blackpt=black:whitept=white:smoothing=50
  9929. @end example
  9930. As above, but with hue-preserving linked channel normalization:
  9931. @example
  9932. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9933. @end example
  9934. As above, but with half strength:
  9935. @example
  9936. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9937. @end example
  9938. Map the darkest input color to red, the brightest input color to cyan:
  9939. @example
  9940. normalize=blackpt=red:whitept=cyan
  9941. @end example
  9942. @section null
  9943. Pass the video source unchanged to the output.
  9944. @section ocr
  9945. Optical Character Recognition
  9946. This filter uses Tesseract for optical character recognition. To enable
  9947. compilation of this filter, you need to configure FFmpeg with
  9948. @code{--enable-libtesseract}.
  9949. It accepts the following options:
  9950. @table @option
  9951. @item datapath
  9952. Set datapath to tesseract data. Default is to use whatever was
  9953. set at installation.
  9954. @item language
  9955. Set language, default is "eng".
  9956. @item whitelist
  9957. Set character whitelist.
  9958. @item blacklist
  9959. Set character blacklist.
  9960. @end table
  9961. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9962. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  9963. @section ocv
  9964. Apply a video transform using libopencv.
  9965. To enable this filter, install the libopencv library and headers and
  9966. configure FFmpeg with @code{--enable-libopencv}.
  9967. It accepts the following parameters:
  9968. @table @option
  9969. @item filter_name
  9970. The name of the libopencv filter to apply.
  9971. @item filter_params
  9972. The parameters to pass to the libopencv filter. If not specified, the default
  9973. values are assumed.
  9974. @end table
  9975. Refer to the official libopencv documentation for more precise
  9976. information:
  9977. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9978. Several libopencv filters are supported; see the following subsections.
  9979. @anchor{dilate}
  9980. @subsection dilate
  9981. Dilate an image by using a specific structuring element.
  9982. It corresponds to the libopencv function @code{cvDilate}.
  9983. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9984. @var{struct_el} represents a structuring element, and has the syntax:
  9985. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9986. @var{cols} and @var{rows} represent the number of columns and rows of
  9987. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9988. point, and @var{shape} the shape for the structuring element. @var{shape}
  9989. must be "rect", "cross", "ellipse", or "custom".
  9990. If the value for @var{shape} is "custom", it must be followed by a
  9991. string of the form "=@var{filename}". The file with name
  9992. @var{filename} is assumed to represent a binary image, with each
  9993. printable character corresponding to a bright pixel. When a custom
  9994. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9995. or columns and rows of the read file are assumed instead.
  9996. The default value for @var{struct_el} is "3x3+0x0/rect".
  9997. @var{nb_iterations} specifies the number of times the transform is
  9998. applied to the image, and defaults to 1.
  9999. Some examples:
  10000. @example
  10001. # Use the default values
  10002. ocv=dilate
  10003. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10004. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10005. # Read the shape from the file diamond.shape, iterating two times.
  10006. # The file diamond.shape may contain a pattern of characters like this
  10007. # *
  10008. # ***
  10009. # *****
  10010. # ***
  10011. # *
  10012. # The specified columns and rows are ignored
  10013. # but the anchor point coordinates are not
  10014. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10015. @end example
  10016. @subsection erode
  10017. Erode an image by using a specific structuring element.
  10018. It corresponds to the libopencv function @code{cvErode}.
  10019. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10020. with the same syntax and semantics as the @ref{dilate} filter.
  10021. @subsection smooth
  10022. Smooth the input video.
  10023. The filter takes the following parameters:
  10024. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10025. @var{type} is the type of smooth filter to apply, and must be one of
  10026. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10027. or "bilateral". The default value is "gaussian".
  10028. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10029. depend on the smooth type. @var{param1} and
  10030. @var{param2} accept integer positive values or 0. @var{param3} and
  10031. @var{param4} accept floating point values.
  10032. The default value for @var{param1} is 3. The default value for the
  10033. other parameters is 0.
  10034. These parameters correspond to the parameters assigned to the
  10035. libopencv function @code{cvSmooth}.
  10036. @section oscilloscope
  10037. 2D Video Oscilloscope.
  10038. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10039. It accepts the following parameters:
  10040. @table @option
  10041. @item x
  10042. Set scope center x position.
  10043. @item y
  10044. Set scope center y position.
  10045. @item s
  10046. Set scope size, relative to frame diagonal.
  10047. @item t
  10048. Set scope tilt/rotation.
  10049. @item o
  10050. Set trace opacity.
  10051. @item tx
  10052. Set trace center x position.
  10053. @item ty
  10054. Set trace center y position.
  10055. @item tw
  10056. Set trace width, relative to width of frame.
  10057. @item th
  10058. Set trace height, relative to height of frame.
  10059. @item c
  10060. Set which components to trace. By default it traces first three components.
  10061. @item g
  10062. Draw trace grid. By default is enabled.
  10063. @item st
  10064. Draw some statistics. By default is enabled.
  10065. @item sc
  10066. Draw scope. By default is enabled.
  10067. @end table
  10068. @subsection Examples
  10069. @itemize
  10070. @item
  10071. Inspect full first row of video frame.
  10072. @example
  10073. oscilloscope=x=0.5:y=0:s=1
  10074. @end example
  10075. @item
  10076. Inspect full last row of video frame.
  10077. @example
  10078. oscilloscope=x=0.5:y=1:s=1
  10079. @end example
  10080. @item
  10081. Inspect full 5th line of video frame of height 1080.
  10082. @example
  10083. oscilloscope=x=0.5:y=5/1080:s=1
  10084. @end example
  10085. @item
  10086. Inspect full last column of video frame.
  10087. @example
  10088. oscilloscope=x=1:y=0.5:s=1:t=1
  10089. @end example
  10090. @end itemize
  10091. @anchor{overlay}
  10092. @section overlay
  10093. Overlay one video on top of another.
  10094. It takes two inputs and has one output. The first input is the "main"
  10095. video on which the second input is overlaid.
  10096. It accepts the following parameters:
  10097. A description of the accepted options follows.
  10098. @table @option
  10099. @item x
  10100. @item y
  10101. Set the expression for the x and y coordinates of the overlaid video
  10102. on the main video. Default value is "0" for both expressions. In case
  10103. the expression is invalid, it is set to a huge value (meaning that the
  10104. overlay will not be displayed within the output visible area).
  10105. @item eof_action
  10106. See @ref{framesync}.
  10107. @item eval
  10108. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10109. It accepts the following values:
  10110. @table @samp
  10111. @item init
  10112. only evaluate expressions once during the filter initialization or
  10113. when a command is processed
  10114. @item frame
  10115. evaluate expressions for each incoming frame
  10116. @end table
  10117. Default value is @samp{frame}.
  10118. @item shortest
  10119. See @ref{framesync}.
  10120. @item format
  10121. Set the format for the output video.
  10122. It accepts the following values:
  10123. @table @samp
  10124. @item yuv420
  10125. force YUV420 output
  10126. @item yuv422
  10127. force YUV422 output
  10128. @item yuv444
  10129. force YUV444 output
  10130. @item rgb
  10131. force packed RGB output
  10132. @item gbrp
  10133. force planar RGB output
  10134. @item auto
  10135. automatically pick format
  10136. @end table
  10137. Default value is @samp{yuv420}.
  10138. @item repeatlast
  10139. See @ref{framesync}.
  10140. @item alpha
  10141. Set format of alpha of the overlaid video, it can be @var{straight} or
  10142. @var{premultiplied}. Default is @var{straight}.
  10143. @end table
  10144. The @option{x}, and @option{y} expressions can contain the following
  10145. parameters.
  10146. @table @option
  10147. @item main_w, W
  10148. @item main_h, H
  10149. The main input width and height.
  10150. @item overlay_w, w
  10151. @item overlay_h, h
  10152. The overlay input width and height.
  10153. @item x
  10154. @item y
  10155. The computed values for @var{x} and @var{y}. They are evaluated for
  10156. each new frame.
  10157. @item hsub
  10158. @item vsub
  10159. horizontal and vertical chroma subsample values of the output
  10160. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10161. @var{vsub} is 1.
  10162. @item n
  10163. the number of input frame, starting from 0
  10164. @item pos
  10165. the position in the file of the input frame, NAN if unknown
  10166. @item t
  10167. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10168. @end table
  10169. This filter also supports the @ref{framesync} options.
  10170. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10171. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10172. when @option{eval} is set to @samp{init}.
  10173. Be aware that frames are taken from each input video in timestamp
  10174. order, hence, if their initial timestamps differ, it is a good idea
  10175. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10176. have them begin in the same zero timestamp, as the example for
  10177. the @var{movie} filter does.
  10178. You can chain together more overlays but you should test the
  10179. efficiency of such approach.
  10180. @subsection Commands
  10181. This filter supports the following commands:
  10182. @table @option
  10183. @item x
  10184. @item y
  10185. Modify the x and y of the overlay input.
  10186. The command accepts the same syntax of the corresponding option.
  10187. If the specified expression is not valid, it is kept at its current
  10188. value.
  10189. @end table
  10190. @subsection Examples
  10191. @itemize
  10192. @item
  10193. Draw the overlay at 10 pixels from the bottom right corner of the main
  10194. video:
  10195. @example
  10196. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10197. @end example
  10198. Using named options the example above becomes:
  10199. @example
  10200. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10201. @end example
  10202. @item
  10203. Insert a transparent PNG logo in the bottom left corner of the input,
  10204. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10205. @example
  10206. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10207. @end example
  10208. @item
  10209. Insert 2 different transparent PNG logos (second logo on bottom
  10210. right corner) using the @command{ffmpeg} tool:
  10211. @example
  10212. 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
  10213. @end example
  10214. @item
  10215. Add a transparent color layer on top of the main video; @code{WxH}
  10216. must specify the size of the main input to the overlay filter:
  10217. @example
  10218. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10219. @end example
  10220. @item
  10221. Play an original video and a filtered version (here with the deshake
  10222. filter) side by side using the @command{ffplay} tool:
  10223. @example
  10224. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10225. @end example
  10226. The above command is the same as:
  10227. @example
  10228. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10229. @end example
  10230. @item
  10231. Make a sliding overlay appearing from the left to the right top part of the
  10232. screen starting since time 2:
  10233. @example
  10234. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10235. @end example
  10236. @item
  10237. Compose output by putting two input videos side to side:
  10238. @example
  10239. ffmpeg -i left.avi -i right.avi -filter_complex "
  10240. nullsrc=size=200x100 [background];
  10241. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10242. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10243. [background][left] overlay=shortest=1 [background+left];
  10244. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10245. "
  10246. @end example
  10247. @item
  10248. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10249. @example
  10250. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10251. -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]'
  10252. masked.avi
  10253. @end example
  10254. @item
  10255. Chain several overlays in cascade:
  10256. @example
  10257. nullsrc=s=200x200 [bg];
  10258. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10259. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10260. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10261. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10262. [in3] null, [mid2] overlay=100:100 [out0]
  10263. @end example
  10264. @end itemize
  10265. @section owdenoise
  10266. Apply Overcomplete Wavelet denoiser.
  10267. The filter accepts the following options:
  10268. @table @option
  10269. @item depth
  10270. Set depth.
  10271. Larger depth values will denoise lower frequency components more, but
  10272. slow down filtering.
  10273. Must be an int in the range 8-16, default is @code{8}.
  10274. @item luma_strength, ls
  10275. Set luma strength.
  10276. Must be a double value in the range 0-1000, default is @code{1.0}.
  10277. @item chroma_strength, cs
  10278. Set chroma strength.
  10279. Must be a double value in the range 0-1000, default is @code{1.0}.
  10280. @end table
  10281. @anchor{pad}
  10282. @section pad
  10283. Add paddings to the input image, and place the original input at the
  10284. provided @var{x}, @var{y} coordinates.
  10285. It accepts the following parameters:
  10286. @table @option
  10287. @item width, w
  10288. @item height, h
  10289. Specify an expression for the size of the output image with the
  10290. paddings added. If the value for @var{width} or @var{height} is 0, the
  10291. corresponding input size is used for the output.
  10292. The @var{width} expression can reference the value set by the
  10293. @var{height} expression, and vice versa.
  10294. The default value of @var{width} and @var{height} is 0.
  10295. @item x
  10296. @item y
  10297. Specify the offsets to place the input image at within the padded area,
  10298. with respect to the top/left border of the output image.
  10299. The @var{x} expression can reference the value set by the @var{y}
  10300. expression, and vice versa.
  10301. The default value of @var{x} and @var{y} is 0.
  10302. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10303. so the input image is centered on the padded area.
  10304. @item color
  10305. Specify the color of the padded area. For the syntax of this option,
  10306. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10307. manual,ffmpeg-utils}.
  10308. The default value of @var{color} is "black".
  10309. @item eval
  10310. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10311. It accepts the following values:
  10312. @table @samp
  10313. @item init
  10314. Only evaluate expressions once during the filter initialization or when
  10315. a command is processed.
  10316. @item frame
  10317. Evaluate expressions for each incoming frame.
  10318. @end table
  10319. Default value is @samp{init}.
  10320. @item aspect
  10321. Pad to aspect instead to a resolution.
  10322. @end table
  10323. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10324. options are expressions containing the following constants:
  10325. @table @option
  10326. @item in_w
  10327. @item in_h
  10328. The input video width and height.
  10329. @item iw
  10330. @item ih
  10331. These are the same as @var{in_w} and @var{in_h}.
  10332. @item out_w
  10333. @item out_h
  10334. The output width and height (the size of the padded area), as
  10335. specified by the @var{width} and @var{height} expressions.
  10336. @item ow
  10337. @item oh
  10338. These are the same as @var{out_w} and @var{out_h}.
  10339. @item x
  10340. @item y
  10341. The x and y offsets as specified by the @var{x} and @var{y}
  10342. expressions, or NAN if not yet specified.
  10343. @item a
  10344. same as @var{iw} / @var{ih}
  10345. @item sar
  10346. input sample aspect ratio
  10347. @item dar
  10348. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10349. @item hsub
  10350. @item vsub
  10351. The horizontal and vertical chroma subsample values. For example for the
  10352. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10353. @end table
  10354. @subsection Examples
  10355. @itemize
  10356. @item
  10357. Add paddings with the color "violet" to the input video. The output video
  10358. size is 640x480, and the top-left corner of the input video is placed at
  10359. column 0, row 40
  10360. @example
  10361. pad=640:480:0:40:violet
  10362. @end example
  10363. The example above is equivalent to the following command:
  10364. @example
  10365. pad=width=640:height=480:x=0:y=40:color=violet
  10366. @end example
  10367. @item
  10368. Pad the input to get an output with dimensions increased by 3/2,
  10369. and put the input video at the center of the padded area:
  10370. @example
  10371. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10372. @end example
  10373. @item
  10374. Pad the input to get a squared output with size equal to the maximum
  10375. value between the input width and height, and put the input video at
  10376. the center of the padded area:
  10377. @example
  10378. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10379. @end example
  10380. @item
  10381. Pad the input to get a final w/h ratio of 16:9:
  10382. @example
  10383. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10384. @end example
  10385. @item
  10386. In case of anamorphic video, in order to set the output display aspect
  10387. correctly, it is necessary to use @var{sar} in the expression,
  10388. according to the relation:
  10389. @example
  10390. (ih * X / ih) * sar = output_dar
  10391. X = output_dar / sar
  10392. @end example
  10393. Thus the previous example needs to be modified to:
  10394. @example
  10395. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10396. @end example
  10397. @item
  10398. Double the output size and put the input video in the bottom-right
  10399. corner of the output padded area:
  10400. @example
  10401. pad="2*iw:2*ih:ow-iw:oh-ih"
  10402. @end example
  10403. @end itemize
  10404. @anchor{palettegen}
  10405. @section palettegen
  10406. Generate one palette for a whole video stream.
  10407. It accepts the following options:
  10408. @table @option
  10409. @item max_colors
  10410. Set the maximum number of colors to quantize in the palette.
  10411. Note: the palette will still contain 256 colors; the unused palette entries
  10412. will be black.
  10413. @item reserve_transparent
  10414. Create a palette of 255 colors maximum and reserve the last one for
  10415. transparency. Reserving the transparency color is useful for GIF optimization.
  10416. If not set, the maximum of colors in the palette will be 256. You probably want
  10417. to disable this option for a standalone image.
  10418. Set by default.
  10419. @item transparency_color
  10420. Set the color that will be used as background for transparency.
  10421. @item stats_mode
  10422. Set statistics mode.
  10423. It accepts the following values:
  10424. @table @samp
  10425. @item full
  10426. Compute full frame histograms.
  10427. @item diff
  10428. Compute histograms only for the part that differs from previous frame. This
  10429. might be relevant to give more importance to the moving part of your input if
  10430. the background is static.
  10431. @item single
  10432. Compute new histogram for each frame.
  10433. @end table
  10434. Default value is @var{full}.
  10435. @end table
  10436. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10437. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10438. color quantization of the palette. This information is also visible at
  10439. @var{info} logging level.
  10440. @subsection Examples
  10441. @itemize
  10442. @item
  10443. Generate a representative palette of a given video using @command{ffmpeg}:
  10444. @example
  10445. ffmpeg -i input.mkv -vf palettegen palette.png
  10446. @end example
  10447. @end itemize
  10448. @section paletteuse
  10449. Use a palette to downsample an input video stream.
  10450. The filter takes two inputs: one video stream and a palette. The palette must
  10451. be a 256 pixels image.
  10452. It accepts the following options:
  10453. @table @option
  10454. @item dither
  10455. Select dithering mode. Available algorithms are:
  10456. @table @samp
  10457. @item bayer
  10458. Ordered 8x8 bayer dithering (deterministic)
  10459. @item heckbert
  10460. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10461. Note: this dithering is sometimes considered "wrong" and is included as a
  10462. reference.
  10463. @item floyd_steinberg
  10464. Floyd and Steingberg dithering (error diffusion)
  10465. @item sierra2
  10466. Frankie Sierra dithering v2 (error diffusion)
  10467. @item sierra2_4a
  10468. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10469. @end table
  10470. Default is @var{sierra2_4a}.
  10471. @item bayer_scale
  10472. When @var{bayer} dithering is selected, this option defines the scale of the
  10473. pattern (how much the crosshatch pattern is visible). A low value means more
  10474. visible pattern for less banding, and higher value means less visible pattern
  10475. at the cost of more banding.
  10476. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10477. @item diff_mode
  10478. If set, define the zone to process
  10479. @table @samp
  10480. @item rectangle
  10481. Only the changing rectangle will be reprocessed. This is similar to GIF
  10482. cropping/offsetting compression mechanism. This option can be useful for speed
  10483. if only a part of the image is changing, and has use cases such as limiting the
  10484. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10485. moving scene (it leads to more deterministic output if the scene doesn't change
  10486. much, and as a result less moving noise and better GIF compression).
  10487. @end table
  10488. Default is @var{none}.
  10489. @item new
  10490. Take new palette for each output frame.
  10491. @item alpha_threshold
  10492. Sets the alpha threshold for transparency. Alpha values above this threshold
  10493. will be treated as completely opaque, and values below this threshold will be
  10494. treated as completely transparent.
  10495. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10496. @end table
  10497. @subsection Examples
  10498. @itemize
  10499. @item
  10500. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10501. using @command{ffmpeg}:
  10502. @example
  10503. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10504. @end example
  10505. @end itemize
  10506. @section perspective
  10507. Correct perspective of video not recorded perpendicular to the screen.
  10508. A description of the accepted parameters follows.
  10509. @table @option
  10510. @item x0
  10511. @item y0
  10512. @item x1
  10513. @item y1
  10514. @item x2
  10515. @item y2
  10516. @item x3
  10517. @item y3
  10518. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10519. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10520. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10521. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10522. then the corners of the source will be sent to the specified coordinates.
  10523. The expressions can use the following variables:
  10524. @table @option
  10525. @item W
  10526. @item H
  10527. the width and height of video frame.
  10528. @item in
  10529. Input frame count.
  10530. @item on
  10531. Output frame count.
  10532. @end table
  10533. @item interpolation
  10534. Set interpolation for perspective correction.
  10535. It accepts the following values:
  10536. @table @samp
  10537. @item linear
  10538. @item cubic
  10539. @end table
  10540. Default value is @samp{linear}.
  10541. @item sense
  10542. Set interpretation of coordinate options.
  10543. It accepts the following values:
  10544. @table @samp
  10545. @item 0, source
  10546. Send point in the source specified by the given coordinates to
  10547. the corners of the destination.
  10548. @item 1, destination
  10549. Send the corners of the source to the point in the destination specified
  10550. by the given coordinates.
  10551. Default value is @samp{source}.
  10552. @end table
  10553. @item eval
  10554. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10555. It accepts the following values:
  10556. @table @samp
  10557. @item init
  10558. only evaluate expressions once during the filter initialization or
  10559. when a command is processed
  10560. @item frame
  10561. evaluate expressions for each incoming frame
  10562. @end table
  10563. Default value is @samp{init}.
  10564. @end table
  10565. @section phase
  10566. Delay interlaced video by one field time so that the field order changes.
  10567. The intended use is to fix PAL movies that have been captured with the
  10568. opposite field order to the film-to-video transfer.
  10569. A description of the accepted parameters follows.
  10570. @table @option
  10571. @item mode
  10572. Set phase mode.
  10573. It accepts the following values:
  10574. @table @samp
  10575. @item t
  10576. Capture field order top-first, transfer bottom-first.
  10577. Filter will delay the bottom field.
  10578. @item b
  10579. Capture field order bottom-first, transfer top-first.
  10580. Filter will delay the top field.
  10581. @item p
  10582. Capture and transfer with the same field order. This mode only exists
  10583. for the documentation of the other options to refer to, but if you
  10584. actually select it, the filter will faithfully do nothing.
  10585. @item a
  10586. Capture field order determined automatically by field flags, transfer
  10587. opposite.
  10588. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10589. basis using field flags. If no field information is available,
  10590. then this works just like @samp{u}.
  10591. @item u
  10592. Capture unknown or varying, transfer opposite.
  10593. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10594. analyzing the images and selecting the alternative that produces best
  10595. match between the fields.
  10596. @item T
  10597. Capture top-first, transfer unknown or varying.
  10598. Filter selects among @samp{t} and @samp{p} using image analysis.
  10599. @item B
  10600. Capture bottom-first, transfer unknown or varying.
  10601. Filter selects among @samp{b} and @samp{p} using image analysis.
  10602. @item A
  10603. Capture determined by field flags, transfer unknown or varying.
  10604. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10605. image analysis. If no field information is available, then this works just
  10606. like @samp{U}. This is the default mode.
  10607. @item U
  10608. Both capture and transfer unknown or varying.
  10609. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10610. @end table
  10611. @end table
  10612. @section pixdesctest
  10613. Pixel format descriptor test filter, mainly useful for internal
  10614. testing. The output video should be equal to the input video.
  10615. For example:
  10616. @example
  10617. format=monow, pixdesctest
  10618. @end example
  10619. can be used to test the monowhite pixel format descriptor definition.
  10620. @section pixscope
  10621. Display sample values of color channels. Mainly useful for checking color
  10622. and levels. Minimum supported resolution is 640x480.
  10623. The filters accept the following options:
  10624. @table @option
  10625. @item x
  10626. Set scope X position, relative offset on X axis.
  10627. @item y
  10628. Set scope Y position, relative offset on Y axis.
  10629. @item w
  10630. Set scope width.
  10631. @item h
  10632. Set scope height.
  10633. @item o
  10634. Set window opacity. This window also holds statistics about pixel area.
  10635. @item wx
  10636. Set window X position, relative offset on X axis.
  10637. @item wy
  10638. Set window Y position, relative offset on Y axis.
  10639. @end table
  10640. @section pp
  10641. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10642. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10643. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10644. Each subfilter and some options have a short and a long name that can be used
  10645. interchangeably, i.e. dr/dering are the same.
  10646. The filters accept the following options:
  10647. @table @option
  10648. @item subfilters
  10649. Set postprocessing subfilters string.
  10650. @end table
  10651. All subfilters share common options to determine their scope:
  10652. @table @option
  10653. @item a/autoq
  10654. Honor the quality commands for this subfilter.
  10655. @item c/chrom
  10656. Do chrominance filtering, too (default).
  10657. @item y/nochrom
  10658. Do luminance filtering only (no chrominance).
  10659. @item n/noluma
  10660. Do chrominance filtering only (no luminance).
  10661. @end table
  10662. These options can be appended after the subfilter name, separated by a '|'.
  10663. Available subfilters are:
  10664. @table @option
  10665. @item hb/hdeblock[|difference[|flatness]]
  10666. Horizontal deblocking filter
  10667. @table @option
  10668. @item difference
  10669. Difference factor where higher values mean more deblocking (default: @code{32}).
  10670. @item flatness
  10671. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10672. @end table
  10673. @item vb/vdeblock[|difference[|flatness]]
  10674. Vertical deblocking filter
  10675. @table @option
  10676. @item difference
  10677. Difference factor where higher values mean more deblocking (default: @code{32}).
  10678. @item flatness
  10679. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10680. @end table
  10681. @item ha/hadeblock[|difference[|flatness]]
  10682. Accurate horizontal deblocking filter
  10683. @table @option
  10684. @item difference
  10685. Difference factor where higher values mean more deblocking (default: @code{32}).
  10686. @item flatness
  10687. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10688. @end table
  10689. @item va/vadeblock[|difference[|flatness]]
  10690. Accurate vertical deblocking filter
  10691. @table @option
  10692. @item difference
  10693. Difference factor where higher values mean more deblocking (default: @code{32}).
  10694. @item flatness
  10695. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10696. @end table
  10697. @end table
  10698. The horizontal and vertical deblocking filters share the difference and
  10699. flatness values so you cannot set different horizontal and vertical
  10700. thresholds.
  10701. @table @option
  10702. @item h1/x1hdeblock
  10703. Experimental horizontal deblocking filter
  10704. @item v1/x1vdeblock
  10705. Experimental vertical deblocking filter
  10706. @item dr/dering
  10707. Deringing filter
  10708. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10709. @table @option
  10710. @item threshold1
  10711. larger -> stronger filtering
  10712. @item threshold2
  10713. larger -> stronger filtering
  10714. @item threshold3
  10715. larger -> stronger filtering
  10716. @end table
  10717. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10718. @table @option
  10719. @item f/fullyrange
  10720. Stretch luminance to @code{0-255}.
  10721. @end table
  10722. @item lb/linblenddeint
  10723. Linear blend deinterlacing filter that deinterlaces the given block by
  10724. filtering all lines with a @code{(1 2 1)} filter.
  10725. @item li/linipoldeint
  10726. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10727. linearly interpolating every second line.
  10728. @item ci/cubicipoldeint
  10729. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10730. cubically interpolating every second line.
  10731. @item md/mediandeint
  10732. Median deinterlacing filter that deinterlaces the given block by applying a
  10733. median filter to every second line.
  10734. @item fd/ffmpegdeint
  10735. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10736. second line with a @code{(-1 4 2 4 -1)} filter.
  10737. @item l5/lowpass5
  10738. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10739. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10740. @item fq/forceQuant[|quantizer]
  10741. Overrides the quantizer table from the input with the constant quantizer you
  10742. specify.
  10743. @table @option
  10744. @item quantizer
  10745. Quantizer to use
  10746. @end table
  10747. @item de/default
  10748. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10749. @item fa/fast
  10750. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10751. @item ac
  10752. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10753. @end table
  10754. @subsection Examples
  10755. @itemize
  10756. @item
  10757. Apply horizontal and vertical deblocking, deringing and automatic
  10758. brightness/contrast:
  10759. @example
  10760. pp=hb/vb/dr/al
  10761. @end example
  10762. @item
  10763. Apply default filters without brightness/contrast correction:
  10764. @example
  10765. pp=de/-al
  10766. @end example
  10767. @item
  10768. Apply default filters and temporal denoiser:
  10769. @example
  10770. pp=default/tmpnoise|1|2|3
  10771. @end example
  10772. @item
  10773. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10774. automatically depending on available CPU time:
  10775. @example
  10776. pp=hb|y/vb|a
  10777. @end example
  10778. @end itemize
  10779. @section pp7
  10780. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10781. similar to spp = 6 with 7 point DCT, where only the center sample is
  10782. used after IDCT.
  10783. The filter accepts the following options:
  10784. @table @option
  10785. @item qp
  10786. Force a constant quantization parameter. It accepts an integer in range
  10787. 0 to 63. If not set, the filter will use the QP from the video stream
  10788. (if available).
  10789. @item mode
  10790. Set thresholding mode. Available modes are:
  10791. @table @samp
  10792. @item hard
  10793. Set hard thresholding.
  10794. @item soft
  10795. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10796. @item medium
  10797. Set medium thresholding (good results, default).
  10798. @end table
  10799. @end table
  10800. @section premultiply
  10801. Apply alpha premultiply effect to input video stream using first plane
  10802. of second stream as alpha.
  10803. Both streams must have same dimensions and same pixel format.
  10804. The filter accepts the following option:
  10805. @table @option
  10806. @item planes
  10807. Set which planes will be processed, unprocessed planes will be copied.
  10808. By default value 0xf, all planes will be processed.
  10809. @item inplace
  10810. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10811. @end table
  10812. @section prewitt
  10813. Apply prewitt operator to input video stream.
  10814. The filter accepts the following option:
  10815. @table @option
  10816. @item planes
  10817. Set which planes will be processed, unprocessed planes will be copied.
  10818. By default value 0xf, all planes will be processed.
  10819. @item scale
  10820. Set value which will be multiplied with filtered result.
  10821. @item delta
  10822. Set value which will be added to filtered result.
  10823. @end table
  10824. @anchor{program_opencl}
  10825. @section program_opencl
  10826. Filter video using an OpenCL program.
  10827. @table @option
  10828. @item source
  10829. OpenCL program source file.
  10830. @item kernel
  10831. Kernel name in program.
  10832. @item inputs
  10833. Number of inputs to the filter. Defaults to 1.
  10834. @item size, s
  10835. Size of output frames. Defaults to the same as the first input.
  10836. @end table
  10837. The program source file must contain a kernel function with the given name,
  10838. which will be run once for each plane of the output. Each run on a plane
  10839. gets enqueued as a separate 2D global NDRange with one work-item for each
  10840. pixel to be generated. The global ID offset for each work-item is therefore
  10841. the coordinates of a pixel in the destination image.
  10842. The kernel function needs to take the following arguments:
  10843. @itemize
  10844. @item
  10845. Destination image, @var{__write_only image2d_t}.
  10846. This image will become the output; the kernel should write all of it.
  10847. @item
  10848. Frame index, @var{unsigned int}.
  10849. This is a counter starting from zero and increasing by one for each frame.
  10850. @item
  10851. Source images, @var{__read_only image2d_t}.
  10852. These are the most recent images on each input. The kernel may read from
  10853. them to generate the output, but they can't be written to.
  10854. @end itemize
  10855. Example programs:
  10856. @itemize
  10857. @item
  10858. Copy the input to the output (output must be the same size as the input).
  10859. @verbatim
  10860. __kernel void copy(__write_only image2d_t destination,
  10861. unsigned int index,
  10862. __read_only image2d_t source)
  10863. {
  10864. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10865. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10866. float4 value = read_imagef(source, sampler, location);
  10867. write_imagef(destination, location, value);
  10868. }
  10869. @end verbatim
  10870. @item
  10871. Apply a simple transformation, rotating the input by an amount increasing
  10872. with the index counter. Pixel values are linearly interpolated by the
  10873. sampler, and the output need not have the same dimensions as the input.
  10874. @verbatim
  10875. __kernel void rotate_image(__write_only image2d_t dst,
  10876. unsigned int index,
  10877. __read_only image2d_t src)
  10878. {
  10879. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10880. CLK_FILTER_LINEAR);
  10881. float angle = (float)index / 100.0f;
  10882. float2 dst_dim = convert_float2(get_image_dim(dst));
  10883. float2 src_dim = convert_float2(get_image_dim(src));
  10884. float2 dst_cen = dst_dim / 2.0f;
  10885. float2 src_cen = src_dim / 2.0f;
  10886. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10887. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10888. float2 src_pos = {
  10889. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10890. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10891. };
  10892. src_pos = src_pos * src_dim / dst_dim;
  10893. float2 src_loc = src_pos + src_cen;
  10894. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10895. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10896. write_imagef(dst, dst_loc, 0.5f);
  10897. else
  10898. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10899. }
  10900. @end verbatim
  10901. @item
  10902. Blend two inputs together, with the amount of each input used varying
  10903. with the index counter.
  10904. @verbatim
  10905. __kernel void blend_images(__write_only image2d_t dst,
  10906. unsigned int index,
  10907. __read_only image2d_t src1,
  10908. __read_only image2d_t src2)
  10909. {
  10910. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10911. CLK_FILTER_LINEAR);
  10912. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10913. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10914. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10915. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10916. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10917. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10918. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10919. }
  10920. @end verbatim
  10921. @end itemize
  10922. @section pseudocolor
  10923. Alter frame colors in video with pseudocolors.
  10924. This filter accept the following options:
  10925. @table @option
  10926. @item c0
  10927. set pixel first component expression
  10928. @item c1
  10929. set pixel second component expression
  10930. @item c2
  10931. set pixel third component expression
  10932. @item c3
  10933. set pixel fourth component expression, corresponds to the alpha component
  10934. @item i
  10935. set component to use as base for altering colors
  10936. @end table
  10937. Each of them specifies the expression to use for computing the lookup table for
  10938. the corresponding pixel component values.
  10939. The expressions can contain the following constants and functions:
  10940. @table @option
  10941. @item w
  10942. @item h
  10943. The input width and height.
  10944. @item val
  10945. The input value for the pixel component.
  10946. @item ymin, umin, vmin, amin
  10947. The minimum allowed component value.
  10948. @item ymax, umax, vmax, amax
  10949. The maximum allowed component value.
  10950. @end table
  10951. All expressions default to "val".
  10952. @subsection Examples
  10953. @itemize
  10954. @item
  10955. Change too high luma values to gradient:
  10956. @example
  10957. 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'"
  10958. @end example
  10959. @end itemize
  10960. @section psnr
  10961. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10962. Ratio) between two input videos.
  10963. This filter takes in input two input videos, the first input is
  10964. considered the "main" source and is passed unchanged to the
  10965. output. The second input is used as a "reference" video for computing
  10966. the PSNR.
  10967. Both video inputs must have the same resolution and pixel format for
  10968. this filter to work correctly. Also it assumes that both inputs
  10969. have the same number of frames, which are compared one by one.
  10970. The obtained average PSNR is printed through the logging system.
  10971. The filter stores the accumulated MSE (mean squared error) of each
  10972. frame, and at the end of the processing it is averaged across all frames
  10973. equally, and the following formula is applied to obtain the PSNR:
  10974. @example
  10975. PSNR = 10*log10(MAX^2/MSE)
  10976. @end example
  10977. Where MAX is the average of the maximum values of each component of the
  10978. image.
  10979. The description of the accepted parameters follows.
  10980. @table @option
  10981. @item stats_file, f
  10982. If specified the filter will use the named file to save the PSNR of
  10983. each individual frame. When filename equals "-" the data is sent to
  10984. standard output.
  10985. @item stats_version
  10986. Specifies which version of the stats file format to use. Details of
  10987. each format are written below.
  10988. Default value is 1.
  10989. @item stats_add_max
  10990. Determines whether the max value is output to the stats log.
  10991. Default value is 0.
  10992. Requires stats_version >= 2. If this is set and stats_version < 2,
  10993. the filter will return an error.
  10994. @end table
  10995. This filter also supports the @ref{framesync} options.
  10996. The file printed if @var{stats_file} is selected, contains a sequence of
  10997. key/value pairs of the form @var{key}:@var{value} for each compared
  10998. couple of frames.
  10999. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11000. the list of per-frame-pair stats, with key value pairs following the frame
  11001. format with the following parameters:
  11002. @table @option
  11003. @item psnr_log_version
  11004. The version of the log file format. Will match @var{stats_version}.
  11005. @item fields
  11006. A comma separated list of the per-frame-pair parameters included in
  11007. the log.
  11008. @end table
  11009. A description of each shown per-frame-pair parameter follows:
  11010. @table @option
  11011. @item n
  11012. sequential number of the input frame, starting from 1
  11013. @item mse_avg
  11014. Mean Square Error pixel-by-pixel average difference of the compared
  11015. frames, averaged over all the image components.
  11016. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11017. Mean Square Error pixel-by-pixel average difference of the compared
  11018. frames for the component specified by the suffix.
  11019. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11020. Peak Signal to Noise ratio of the compared frames for the component
  11021. specified by the suffix.
  11022. @item max_avg, max_y, max_u, max_v
  11023. Maximum allowed value for each channel, and average over all
  11024. channels.
  11025. @end table
  11026. For example:
  11027. @example
  11028. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11029. [main][ref] psnr="stats_file=stats.log" [out]
  11030. @end example
  11031. On this example the input file being processed is compared with the
  11032. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11033. is stored in @file{stats.log}.
  11034. @anchor{pullup}
  11035. @section pullup
  11036. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11037. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11038. content.
  11039. The pullup filter is designed to take advantage of future context in making
  11040. its decisions. This filter is stateless in the sense that it does not lock
  11041. onto a pattern to follow, but it instead looks forward to the following
  11042. fields in order to identify matches and rebuild progressive frames.
  11043. To produce content with an even framerate, insert the fps filter after
  11044. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11045. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11046. The filter accepts the following options:
  11047. @table @option
  11048. @item jl
  11049. @item jr
  11050. @item jt
  11051. @item jb
  11052. These options set the amount of "junk" to ignore at the left, right, top, and
  11053. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11054. while top and bottom are in units of 2 lines.
  11055. The default is 8 pixels on each side.
  11056. @item sb
  11057. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11058. filter generating an occasional mismatched frame, but it may also cause an
  11059. excessive number of frames to be dropped during high motion sequences.
  11060. Conversely, setting it to -1 will make filter match fields more easily.
  11061. This may help processing of video where there is slight blurring between
  11062. the fields, but may also cause there to be interlaced frames in the output.
  11063. Default value is @code{0}.
  11064. @item mp
  11065. Set the metric plane to use. It accepts the following values:
  11066. @table @samp
  11067. @item l
  11068. Use luma plane.
  11069. @item u
  11070. Use chroma blue plane.
  11071. @item v
  11072. Use chroma red plane.
  11073. @end table
  11074. This option may be set to use chroma plane instead of the default luma plane
  11075. for doing filter's computations. This may improve accuracy on very clean
  11076. source material, but more likely will decrease accuracy, especially if there
  11077. is chroma noise (rainbow effect) or any grayscale video.
  11078. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11079. load and make pullup usable in realtime on slow machines.
  11080. @end table
  11081. For best results (without duplicated frames in the output file) it is
  11082. necessary to change the output frame rate. For example, to inverse
  11083. telecine NTSC input:
  11084. @example
  11085. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11086. @end example
  11087. @section qp
  11088. Change video quantization parameters (QP).
  11089. The filter accepts the following option:
  11090. @table @option
  11091. @item qp
  11092. Set expression for quantization parameter.
  11093. @end table
  11094. The expression is evaluated through the eval API and can contain, among others,
  11095. the following constants:
  11096. @table @var
  11097. @item known
  11098. 1 if index is not 129, 0 otherwise.
  11099. @item qp
  11100. Sequential index starting from -129 to 128.
  11101. @end table
  11102. @subsection Examples
  11103. @itemize
  11104. @item
  11105. Some equation like:
  11106. @example
  11107. qp=2+2*sin(PI*qp)
  11108. @end example
  11109. @end itemize
  11110. @section random
  11111. Flush video frames from internal cache of frames into a random order.
  11112. No frame is discarded.
  11113. Inspired by @ref{frei0r} nervous filter.
  11114. @table @option
  11115. @item frames
  11116. Set size in number of frames of internal cache, in range from @code{2} to
  11117. @code{512}. Default is @code{30}.
  11118. @item seed
  11119. Set seed for random number generator, must be an integer included between
  11120. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11121. less than @code{0}, the filter will try to use a good random seed on a
  11122. best effort basis.
  11123. @end table
  11124. @section readeia608
  11125. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11126. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11127. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11128. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11129. @table @option
  11130. @item lavfi.readeia608.X.cc
  11131. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11132. @item lavfi.readeia608.X.line
  11133. The number of the line on which the EIA-608 data was identified and read.
  11134. @end table
  11135. This filter accepts the following options:
  11136. @table @option
  11137. @item scan_min
  11138. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11139. @item scan_max
  11140. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11141. @item mac
  11142. Set minimal acceptable amplitude change for sync codes detection.
  11143. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  11144. @item spw
  11145. Set the ratio of width reserved for sync code detection.
  11146. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  11147. @item mhd
  11148. Set the max peaks height difference for sync code detection.
  11149. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11150. @item mpd
  11151. Set max peaks period difference for sync code detection.
  11152. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11153. @item msd
  11154. Set the first two max start code bits differences.
  11155. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  11156. @item bhd
  11157. Set the minimum ratio of bits height compared to 3rd start code bit.
  11158. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  11159. @item th_w
  11160. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  11161. @item th_b
  11162. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  11163. @item chp
  11164. Enable checking the parity bit. In the event of a parity error, the filter will output
  11165. @code{0x00} for that character. Default is false.
  11166. @end table
  11167. @subsection Examples
  11168. @itemize
  11169. @item
  11170. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11171. @example
  11172. 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
  11173. @end example
  11174. @end itemize
  11175. @section readvitc
  11176. Read vertical interval timecode (VITC) information from the top lines of a
  11177. video frame.
  11178. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11179. timecode value, if a valid timecode has been detected. Further metadata key
  11180. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11181. timecode data has been found or not.
  11182. This filter accepts the following options:
  11183. @table @option
  11184. @item scan_max
  11185. Set the maximum number of lines to scan for VITC data. If the value is set to
  11186. @code{-1} the full video frame is scanned. Default is @code{45}.
  11187. @item thr_b
  11188. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11189. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11190. @item thr_w
  11191. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11192. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11193. @end table
  11194. @subsection Examples
  11195. @itemize
  11196. @item
  11197. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11198. draw @code{--:--:--:--} as a placeholder:
  11199. @example
  11200. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11201. @end example
  11202. @end itemize
  11203. @section remap
  11204. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11205. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11206. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11207. value for pixel will be used for destination pixel.
  11208. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11209. will have Xmap/Ymap video stream dimensions.
  11210. Xmap and Ymap input video streams are 16bit depth, single channel.
  11211. @section removegrain
  11212. The removegrain filter is a spatial denoiser for progressive video.
  11213. @table @option
  11214. @item m0
  11215. Set mode for the first plane.
  11216. @item m1
  11217. Set mode for the second plane.
  11218. @item m2
  11219. Set mode for the third plane.
  11220. @item m3
  11221. Set mode for the fourth plane.
  11222. @end table
  11223. Range of mode is from 0 to 24. Description of each mode follows:
  11224. @table @var
  11225. @item 0
  11226. Leave input plane unchanged. Default.
  11227. @item 1
  11228. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11229. @item 2
  11230. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11231. @item 3
  11232. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11233. @item 4
  11234. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11235. This is equivalent to a median filter.
  11236. @item 5
  11237. Line-sensitive clipping giving the minimal change.
  11238. @item 6
  11239. Line-sensitive clipping, intermediate.
  11240. @item 7
  11241. Line-sensitive clipping, intermediate.
  11242. @item 8
  11243. Line-sensitive clipping, intermediate.
  11244. @item 9
  11245. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11246. @item 10
  11247. Replaces the target pixel with the closest neighbour.
  11248. @item 11
  11249. [1 2 1] horizontal and vertical kernel blur.
  11250. @item 12
  11251. Same as mode 11.
  11252. @item 13
  11253. Bob mode, interpolates top field from the line where the neighbours
  11254. pixels are the closest.
  11255. @item 14
  11256. Bob mode, interpolates bottom field from the line where the neighbours
  11257. pixels are the closest.
  11258. @item 15
  11259. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11260. interpolation formula.
  11261. @item 16
  11262. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11263. interpolation formula.
  11264. @item 17
  11265. Clips the pixel with the minimum and maximum of respectively the maximum and
  11266. minimum of each pair of opposite neighbour pixels.
  11267. @item 18
  11268. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11269. the current pixel is minimal.
  11270. @item 19
  11271. Replaces the pixel with the average of its 8 neighbours.
  11272. @item 20
  11273. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11274. @item 21
  11275. Clips pixels using the averages of opposite neighbour.
  11276. @item 22
  11277. Same as mode 21 but simpler and faster.
  11278. @item 23
  11279. Small edge and halo removal, but reputed useless.
  11280. @item 24
  11281. Similar as 23.
  11282. @end table
  11283. @section removelogo
  11284. Suppress a TV station logo, using an image file to determine which
  11285. pixels comprise the logo. It works by filling in the pixels that
  11286. comprise the logo with neighboring pixels.
  11287. The filter accepts the following options:
  11288. @table @option
  11289. @item filename, f
  11290. Set the filter bitmap file, which can be any image format supported by
  11291. libavformat. The width and height of the image file must match those of the
  11292. video stream being processed.
  11293. @end table
  11294. Pixels in the provided bitmap image with a value of zero are not
  11295. considered part of the logo, non-zero pixels are considered part of
  11296. the logo. If you use white (255) for the logo and black (0) for the
  11297. rest, you will be safe. For making the filter bitmap, it is
  11298. recommended to take a screen capture of a black frame with the logo
  11299. visible, and then using a threshold filter followed by the erode
  11300. filter once or twice.
  11301. If needed, little splotches can be fixed manually. Remember that if
  11302. logo pixels are not covered, the filter quality will be much
  11303. reduced. Marking too many pixels as part of the logo does not hurt as
  11304. much, but it will increase the amount of blurring needed to cover over
  11305. the image and will destroy more information than necessary, and extra
  11306. pixels will slow things down on a large logo.
  11307. @section repeatfields
  11308. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11309. fields based on its value.
  11310. @section reverse
  11311. Reverse a video clip.
  11312. Warning: This filter requires memory to buffer the entire clip, so trimming
  11313. is suggested.
  11314. @subsection Examples
  11315. @itemize
  11316. @item
  11317. Take the first 5 seconds of a clip, and reverse it.
  11318. @example
  11319. trim=end=5,reverse
  11320. @end example
  11321. @end itemize
  11322. @section rgbashift
  11323. Shift R/G/B/A pixels horizontally and/or vertically.
  11324. The filter accepts the following options:
  11325. @table @option
  11326. @item rh
  11327. Set amount to shift red horizontally.
  11328. @item rv
  11329. Set amount to shift red vertically.
  11330. @item gh
  11331. Set amount to shift green horizontally.
  11332. @item gv
  11333. Set amount to shift green vertically.
  11334. @item bh
  11335. Set amount to shift blue horizontally.
  11336. @item bv
  11337. Set amount to shift blue vertically.
  11338. @item ah
  11339. Set amount to shift alpha horizontally.
  11340. @item av
  11341. Set amount to shift alpha vertically.
  11342. @item edge
  11343. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11344. @end table
  11345. @section roberts
  11346. Apply roberts cross operator to input video stream.
  11347. The filter accepts the following option:
  11348. @table @option
  11349. @item planes
  11350. Set which planes will be processed, unprocessed planes will be copied.
  11351. By default value 0xf, all planes will be processed.
  11352. @item scale
  11353. Set value which will be multiplied with filtered result.
  11354. @item delta
  11355. Set value which will be added to filtered result.
  11356. @end table
  11357. @section rotate
  11358. Rotate video by an arbitrary angle expressed in radians.
  11359. The filter accepts the following options:
  11360. A description of the optional parameters follows.
  11361. @table @option
  11362. @item angle, a
  11363. Set an expression for the angle by which to rotate the input video
  11364. clockwise, expressed as a number of radians. A negative value will
  11365. result in a counter-clockwise rotation. By default it is set to "0".
  11366. This expression is evaluated for each frame.
  11367. @item out_w, ow
  11368. Set the output width expression, default value is "iw".
  11369. This expression is evaluated just once during configuration.
  11370. @item out_h, oh
  11371. Set the output height expression, default value is "ih".
  11372. This expression is evaluated just once during configuration.
  11373. @item bilinear
  11374. Enable bilinear interpolation if set to 1, a value of 0 disables
  11375. it. Default value is 1.
  11376. @item fillcolor, c
  11377. Set the color used to fill the output area not covered by the rotated
  11378. image. For the general syntax of this option, check the
  11379. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11380. If the special value "none" is selected then no
  11381. background is printed (useful for example if the background is never shown).
  11382. Default value is "black".
  11383. @end table
  11384. The expressions for the angle and the output size can contain the
  11385. following constants and functions:
  11386. @table @option
  11387. @item n
  11388. sequential number of the input frame, starting from 0. It is always NAN
  11389. before the first frame is filtered.
  11390. @item t
  11391. time in seconds of the input frame, it is set to 0 when the filter is
  11392. configured. It is always NAN before the first frame is filtered.
  11393. @item hsub
  11394. @item vsub
  11395. horizontal and vertical chroma subsample values. For example for the
  11396. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11397. @item in_w, iw
  11398. @item in_h, ih
  11399. the input video width and height
  11400. @item out_w, ow
  11401. @item out_h, oh
  11402. the output width and height, that is the size of the padded area as
  11403. specified by the @var{width} and @var{height} expressions
  11404. @item rotw(a)
  11405. @item roth(a)
  11406. the minimal width/height required for completely containing the input
  11407. video rotated by @var{a} radians.
  11408. These are only available when computing the @option{out_w} and
  11409. @option{out_h} expressions.
  11410. @end table
  11411. @subsection Examples
  11412. @itemize
  11413. @item
  11414. Rotate the input by PI/6 radians clockwise:
  11415. @example
  11416. rotate=PI/6
  11417. @end example
  11418. @item
  11419. Rotate the input by PI/6 radians counter-clockwise:
  11420. @example
  11421. rotate=-PI/6
  11422. @end example
  11423. @item
  11424. Rotate the input by 45 degrees clockwise:
  11425. @example
  11426. rotate=45*PI/180
  11427. @end example
  11428. @item
  11429. Apply a constant rotation with period T, starting from an angle of PI/3:
  11430. @example
  11431. rotate=PI/3+2*PI*t/T
  11432. @end example
  11433. @item
  11434. Make the input video rotation oscillating with a period of T
  11435. seconds and an amplitude of A radians:
  11436. @example
  11437. rotate=A*sin(2*PI/T*t)
  11438. @end example
  11439. @item
  11440. Rotate the video, output size is chosen so that the whole rotating
  11441. input video is always completely contained in the output:
  11442. @example
  11443. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11444. @end example
  11445. @item
  11446. Rotate the video, reduce the output size so that no background is ever
  11447. shown:
  11448. @example
  11449. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11450. @end example
  11451. @end itemize
  11452. @subsection Commands
  11453. The filter supports the following commands:
  11454. @table @option
  11455. @item a, angle
  11456. Set the angle expression.
  11457. The command accepts the same syntax of the corresponding option.
  11458. If the specified expression is not valid, it is kept at its current
  11459. value.
  11460. @end table
  11461. @section sab
  11462. Apply Shape Adaptive Blur.
  11463. The filter accepts the following options:
  11464. @table @option
  11465. @item luma_radius, lr
  11466. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11467. value is 1.0. A greater value will result in a more blurred image, and
  11468. in slower processing.
  11469. @item luma_pre_filter_radius, lpfr
  11470. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11471. value is 1.0.
  11472. @item luma_strength, ls
  11473. Set luma maximum difference between pixels to still be considered, must
  11474. be a value in the 0.1-100.0 range, default value is 1.0.
  11475. @item chroma_radius, cr
  11476. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11477. greater value will result in a more blurred image, and in slower
  11478. processing.
  11479. @item chroma_pre_filter_radius, cpfr
  11480. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11481. @item chroma_strength, cs
  11482. Set chroma maximum difference between pixels to still be considered,
  11483. must be a value in the -0.9-100.0 range.
  11484. @end table
  11485. Each chroma option value, if not explicitly specified, is set to the
  11486. corresponding luma option value.
  11487. @anchor{scale}
  11488. @section scale
  11489. Scale (resize) the input video, using the libswscale library.
  11490. The scale filter forces the output display aspect ratio to be the same
  11491. of the input, by changing the output sample aspect ratio.
  11492. If the input image format is different from the format requested by
  11493. the next filter, the scale filter will convert the input to the
  11494. requested format.
  11495. @subsection Options
  11496. The filter accepts the following options, or any of the options
  11497. supported by the libswscale scaler.
  11498. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11499. the complete list of scaler options.
  11500. @table @option
  11501. @item width, w
  11502. @item height, h
  11503. Set the output video dimension expression. Default value is the input
  11504. dimension.
  11505. If the @var{width} or @var{w} value is 0, the input width is used for
  11506. the output. If the @var{height} or @var{h} value is 0, the input height
  11507. is used for the output.
  11508. If one and only one of the values is -n with n >= 1, the scale filter
  11509. will use a value that maintains the aspect ratio of the input image,
  11510. calculated from the other specified dimension. After that it will,
  11511. however, make sure that the calculated dimension is divisible by n and
  11512. adjust the value if necessary.
  11513. If both values are -n with n >= 1, the behavior will be identical to
  11514. both values being set to 0 as previously detailed.
  11515. See below for the list of accepted constants for use in the dimension
  11516. expression.
  11517. @item eval
  11518. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11519. @table @samp
  11520. @item init
  11521. Only evaluate expressions once during the filter initialization or when a command is processed.
  11522. @item frame
  11523. Evaluate expressions for each incoming frame.
  11524. @end table
  11525. Default value is @samp{init}.
  11526. @item interl
  11527. Set the interlacing mode. It accepts the following values:
  11528. @table @samp
  11529. @item 1
  11530. Force interlaced aware scaling.
  11531. @item 0
  11532. Do not apply interlaced scaling.
  11533. @item -1
  11534. Select interlaced aware scaling depending on whether the source frames
  11535. are flagged as interlaced or not.
  11536. @end table
  11537. Default value is @samp{0}.
  11538. @item flags
  11539. Set libswscale scaling flags. See
  11540. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11541. complete list of values. If not explicitly specified the filter applies
  11542. the default flags.
  11543. @item param0, param1
  11544. Set libswscale input parameters for scaling algorithms that need them. See
  11545. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11546. complete documentation. If not explicitly specified the filter applies
  11547. empty parameters.
  11548. @item size, s
  11549. Set the video size. For the syntax of this option, check the
  11550. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11551. @item in_color_matrix
  11552. @item out_color_matrix
  11553. Set in/output YCbCr color space type.
  11554. This allows the autodetected value to be overridden as well as allows forcing
  11555. a specific value used for the output and encoder.
  11556. If not specified, the color space type depends on the pixel format.
  11557. Possible values:
  11558. @table @samp
  11559. @item auto
  11560. Choose automatically.
  11561. @item bt709
  11562. Format conforming to International Telecommunication Union (ITU)
  11563. Recommendation BT.709.
  11564. @item fcc
  11565. Set color space conforming to the United States Federal Communications
  11566. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11567. @item bt601
  11568. @item bt470
  11569. @item smpte170m
  11570. Set color space conforming to:
  11571. @itemize
  11572. @item
  11573. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11574. @item
  11575. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11576. @item
  11577. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11578. @end itemize
  11579. @item smpte240m
  11580. Set color space conforming to SMPTE ST 240:1999.
  11581. @item bt2020
  11582. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  11583. @end table
  11584. @item in_range
  11585. @item out_range
  11586. Set in/output YCbCr sample range.
  11587. This allows the autodetected value to be overridden as well as allows forcing
  11588. a specific value used for the output and encoder. If not specified, the
  11589. range depends on the pixel format. Possible values:
  11590. @table @samp
  11591. @item auto/unknown
  11592. Choose automatically.
  11593. @item jpeg/full/pc
  11594. Set full range (0-255 in case of 8-bit luma).
  11595. @item mpeg/limited/tv
  11596. Set "MPEG" range (16-235 in case of 8-bit luma).
  11597. @end table
  11598. @item force_original_aspect_ratio
  11599. Enable decreasing or increasing output video width or height if necessary to
  11600. keep the original aspect ratio. Possible values:
  11601. @table @samp
  11602. @item disable
  11603. Scale the video as specified and disable this feature.
  11604. @item decrease
  11605. The output video dimensions will automatically be decreased if needed.
  11606. @item increase
  11607. The output video dimensions will automatically be increased if needed.
  11608. @end table
  11609. One useful instance of this option is that when you know a specific device's
  11610. maximum allowed resolution, you can use this to limit the output video to
  11611. that, while retaining the aspect ratio. For example, device A allows
  11612. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11613. decrease) and specifying 1280x720 to the command line makes the output
  11614. 1280x533.
  11615. Please note that this is a different thing than specifying -1 for @option{w}
  11616. or @option{h}, you still need to specify the output resolution for this option
  11617. to work.
  11618. @end table
  11619. The values of the @option{w} and @option{h} options are expressions
  11620. containing the following constants:
  11621. @table @var
  11622. @item in_w
  11623. @item in_h
  11624. The input width and height
  11625. @item iw
  11626. @item ih
  11627. These are the same as @var{in_w} and @var{in_h}.
  11628. @item out_w
  11629. @item out_h
  11630. The output (scaled) width and height
  11631. @item ow
  11632. @item oh
  11633. These are the same as @var{out_w} and @var{out_h}
  11634. @item a
  11635. The same as @var{iw} / @var{ih}
  11636. @item sar
  11637. input sample aspect ratio
  11638. @item dar
  11639. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11640. @item hsub
  11641. @item vsub
  11642. horizontal and vertical input chroma subsample values. For example for the
  11643. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11644. @item ohsub
  11645. @item ovsub
  11646. horizontal and vertical output chroma subsample values. For example for the
  11647. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11648. @end table
  11649. @subsection Examples
  11650. @itemize
  11651. @item
  11652. Scale the input video to a size of 200x100
  11653. @example
  11654. scale=w=200:h=100
  11655. @end example
  11656. This is equivalent to:
  11657. @example
  11658. scale=200:100
  11659. @end example
  11660. or:
  11661. @example
  11662. scale=200x100
  11663. @end example
  11664. @item
  11665. Specify a size abbreviation for the output size:
  11666. @example
  11667. scale=qcif
  11668. @end example
  11669. which can also be written as:
  11670. @example
  11671. scale=size=qcif
  11672. @end example
  11673. @item
  11674. Scale the input to 2x:
  11675. @example
  11676. scale=w=2*iw:h=2*ih
  11677. @end example
  11678. @item
  11679. The above is the same as:
  11680. @example
  11681. scale=2*in_w:2*in_h
  11682. @end example
  11683. @item
  11684. Scale the input to 2x with forced interlaced scaling:
  11685. @example
  11686. scale=2*iw:2*ih:interl=1
  11687. @end example
  11688. @item
  11689. Scale the input to half size:
  11690. @example
  11691. scale=w=iw/2:h=ih/2
  11692. @end example
  11693. @item
  11694. Increase the width, and set the height to the same size:
  11695. @example
  11696. scale=3/2*iw:ow
  11697. @end example
  11698. @item
  11699. Seek Greek harmony:
  11700. @example
  11701. scale=iw:1/PHI*iw
  11702. scale=ih*PHI:ih
  11703. @end example
  11704. @item
  11705. Increase the height, and set the width to 3/2 of the height:
  11706. @example
  11707. scale=w=3/2*oh:h=3/5*ih
  11708. @end example
  11709. @item
  11710. Increase the size, making the size a multiple of the chroma
  11711. subsample values:
  11712. @example
  11713. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11714. @end example
  11715. @item
  11716. Increase the width to a maximum of 500 pixels,
  11717. keeping the same aspect ratio as the input:
  11718. @example
  11719. scale=w='min(500\, iw*3/2):h=-1'
  11720. @end example
  11721. @item
  11722. Make pixels square by combining scale and setsar:
  11723. @example
  11724. scale='trunc(ih*dar):ih',setsar=1/1
  11725. @end example
  11726. @item
  11727. Make pixels square by combining scale and setsar,
  11728. making sure the resulting resolution is even (required by some codecs):
  11729. @example
  11730. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11731. @end example
  11732. @end itemize
  11733. @subsection Commands
  11734. This filter supports the following commands:
  11735. @table @option
  11736. @item width, w
  11737. @item height, h
  11738. Set the output video dimension expression.
  11739. The command accepts the same syntax of the corresponding option.
  11740. If the specified expression is not valid, it is kept at its current
  11741. value.
  11742. @end table
  11743. @section scale_npp
  11744. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11745. format conversion on CUDA video frames. Setting the output width and height
  11746. works in the same way as for the @var{scale} filter.
  11747. The following additional options are accepted:
  11748. @table @option
  11749. @item format
  11750. The pixel format of the output CUDA frames. If set to the string "same" (the
  11751. default), the input format will be kept. Note that automatic format negotiation
  11752. and conversion is not yet supported for hardware frames
  11753. @item interp_algo
  11754. The interpolation algorithm used for resizing. One of the following:
  11755. @table @option
  11756. @item nn
  11757. Nearest neighbour.
  11758. @item linear
  11759. @item cubic
  11760. @item cubic2p_bspline
  11761. 2-parameter cubic (B=1, C=0)
  11762. @item cubic2p_catmullrom
  11763. 2-parameter cubic (B=0, C=1/2)
  11764. @item cubic2p_b05c03
  11765. 2-parameter cubic (B=1/2, C=3/10)
  11766. @item super
  11767. Supersampling
  11768. @item lanczos
  11769. @end table
  11770. @end table
  11771. @section scale2ref
  11772. Scale (resize) the input video, based on a reference video.
  11773. See the scale filter for available options, scale2ref supports the same but
  11774. uses the reference video instead of the main input as basis. scale2ref also
  11775. supports the following additional constants for the @option{w} and
  11776. @option{h} options:
  11777. @table @var
  11778. @item main_w
  11779. @item main_h
  11780. The main input video's width and height
  11781. @item main_a
  11782. The same as @var{main_w} / @var{main_h}
  11783. @item main_sar
  11784. The main input video's sample aspect ratio
  11785. @item main_dar, mdar
  11786. The main input video's display aspect ratio. Calculated from
  11787. @code{(main_w / main_h) * main_sar}.
  11788. @item main_hsub
  11789. @item main_vsub
  11790. The main input video's horizontal and vertical chroma subsample values.
  11791. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11792. is 1.
  11793. @end table
  11794. @subsection Examples
  11795. @itemize
  11796. @item
  11797. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11798. @example
  11799. 'scale2ref[b][a];[a][b]overlay'
  11800. @end example
  11801. @item
  11802. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  11803. @example
  11804. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  11805. @end example
  11806. @end itemize
  11807. @anchor{selectivecolor}
  11808. @section selectivecolor
  11809. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11810. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11811. by the "purity" of the color (that is, how saturated it already is).
  11812. This filter is similar to the Adobe Photoshop Selective Color tool.
  11813. The filter accepts the following options:
  11814. @table @option
  11815. @item correction_method
  11816. Select color correction method.
  11817. Available values are:
  11818. @table @samp
  11819. @item absolute
  11820. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11821. component value).
  11822. @item relative
  11823. Specified adjustments are relative to the original component value.
  11824. @end table
  11825. Default is @code{absolute}.
  11826. @item reds
  11827. Adjustments for red pixels (pixels where the red component is the maximum)
  11828. @item yellows
  11829. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11830. @item greens
  11831. Adjustments for green pixels (pixels where the green component is the maximum)
  11832. @item cyans
  11833. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11834. @item blues
  11835. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11836. @item magentas
  11837. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11838. @item whites
  11839. Adjustments for white pixels (pixels where all components are greater than 128)
  11840. @item neutrals
  11841. Adjustments for all pixels except pure black and pure white
  11842. @item blacks
  11843. Adjustments for black pixels (pixels where all components are lesser than 128)
  11844. @item psfile
  11845. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11846. @end table
  11847. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11848. 4 space separated floating point adjustment values in the [-1,1] range,
  11849. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11850. pixels of its range.
  11851. @subsection Examples
  11852. @itemize
  11853. @item
  11854. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11855. increase magenta by 27% in blue areas:
  11856. @example
  11857. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11858. @end example
  11859. @item
  11860. Use a Photoshop selective color preset:
  11861. @example
  11862. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11863. @end example
  11864. @end itemize
  11865. @anchor{separatefields}
  11866. @section separatefields
  11867. The @code{separatefields} takes a frame-based video input and splits
  11868. each frame into its components fields, producing a new half height clip
  11869. with twice the frame rate and twice the frame count.
  11870. This filter use field-dominance information in frame to decide which
  11871. of each pair of fields to place first in the output.
  11872. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11873. @section setdar, setsar
  11874. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11875. output video.
  11876. This is done by changing the specified Sample (aka Pixel) Aspect
  11877. Ratio, according to the following equation:
  11878. @example
  11879. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11880. @end example
  11881. Keep in mind that the @code{setdar} filter does not modify the pixel
  11882. dimensions of the video frame. Also, the display aspect ratio set by
  11883. this filter may be changed by later filters in the filterchain,
  11884. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11885. applied.
  11886. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11887. the filter output video.
  11888. Note that as a consequence of the application of this filter, the
  11889. output display aspect ratio will change according to the equation
  11890. above.
  11891. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11892. filter may be changed by later filters in the filterchain, e.g. if
  11893. another "setsar" or a "setdar" filter is applied.
  11894. It accepts the following parameters:
  11895. @table @option
  11896. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11897. Set the aspect ratio used by the filter.
  11898. The parameter can be a floating point number string, an expression, or
  11899. a string of the form @var{num}:@var{den}, where @var{num} and
  11900. @var{den} are the numerator and denominator of the aspect ratio. If
  11901. the parameter is not specified, it is assumed the value "0".
  11902. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11903. should be escaped.
  11904. @item max
  11905. Set the maximum integer value to use for expressing numerator and
  11906. denominator when reducing the expressed aspect ratio to a rational.
  11907. Default value is @code{100}.
  11908. @end table
  11909. The parameter @var{sar} is an expression containing
  11910. the following constants:
  11911. @table @option
  11912. @item E, PI, PHI
  11913. These are approximated values for the mathematical constants e
  11914. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11915. @item w, h
  11916. The input width and height.
  11917. @item a
  11918. These are the same as @var{w} / @var{h}.
  11919. @item sar
  11920. The input sample aspect ratio.
  11921. @item dar
  11922. The input display aspect ratio. It is the same as
  11923. (@var{w} / @var{h}) * @var{sar}.
  11924. @item hsub, vsub
  11925. Horizontal and vertical chroma subsample values. For example, for the
  11926. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11927. @end table
  11928. @subsection Examples
  11929. @itemize
  11930. @item
  11931. To change the display aspect ratio to 16:9, specify one of the following:
  11932. @example
  11933. setdar=dar=1.77777
  11934. setdar=dar=16/9
  11935. @end example
  11936. @item
  11937. To change the sample aspect ratio to 10:11, specify:
  11938. @example
  11939. setsar=sar=10/11
  11940. @end example
  11941. @item
  11942. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11943. 1000 in the aspect ratio reduction, use the command:
  11944. @example
  11945. setdar=ratio=16/9:max=1000
  11946. @end example
  11947. @end itemize
  11948. @anchor{setfield}
  11949. @section setfield
  11950. Force field for the output video frame.
  11951. The @code{setfield} filter marks the interlace type field for the
  11952. output frames. It does not change the input frame, but only sets the
  11953. corresponding property, which affects how the frame is treated by
  11954. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11955. The filter accepts the following options:
  11956. @table @option
  11957. @item mode
  11958. Available values are:
  11959. @table @samp
  11960. @item auto
  11961. Keep the same field property.
  11962. @item bff
  11963. Mark the frame as bottom-field-first.
  11964. @item tff
  11965. Mark the frame as top-field-first.
  11966. @item prog
  11967. Mark the frame as progressive.
  11968. @end table
  11969. @end table
  11970. @anchor{setparams}
  11971. @section setparams
  11972. Force frame parameter for the output video frame.
  11973. The @code{setparams} filter marks interlace and color range for the
  11974. output frames. It does not change the input frame, but only sets the
  11975. corresponding property, which affects how the frame is treated by
  11976. filters/encoders.
  11977. @table @option
  11978. @item field_mode
  11979. Available values are:
  11980. @table @samp
  11981. @item auto
  11982. Keep the same field property (default).
  11983. @item bff
  11984. Mark the frame as bottom-field-first.
  11985. @item tff
  11986. Mark the frame as top-field-first.
  11987. @item prog
  11988. Mark the frame as progressive.
  11989. @end table
  11990. @item range
  11991. Available values are:
  11992. @table @samp
  11993. @item auto
  11994. Keep the same color range property (default).
  11995. @item unspecified, unknown
  11996. Mark the frame as unspecified color range.
  11997. @item limited, tv, mpeg
  11998. Mark the frame as limited range.
  11999. @item full, pc, jpeg
  12000. Mark the frame as full range.
  12001. @end table
  12002. @item color_primaries
  12003. Set the color primaries.
  12004. Available values are:
  12005. @table @samp
  12006. @item auto
  12007. Keep the same color primaries property (default).
  12008. @item bt709
  12009. @item unknown
  12010. @item bt470m
  12011. @item bt470bg
  12012. @item smpte170m
  12013. @item smpte240m
  12014. @item film
  12015. @item bt2020
  12016. @item smpte428
  12017. @item smpte431
  12018. @item smpte432
  12019. @item jedec-p22
  12020. @end table
  12021. @item color_trc
  12022. Set the color transfer.
  12023. Available values are:
  12024. @table @samp
  12025. @item auto
  12026. Keep the same color trc property (default).
  12027. @item bt709
  12028. @item unknown
  12029. @item bt470m
  12030. @item bt470bg
  12031. @item smpte170m
  12032. @item smpte240m
  12033. @item linear
  12034. @item log100
  12035. @item log316
  12036. @item iec61966-2-4
  12037. @item bt1361e
  12038. @item iec61966-2-1
  12039. @item bt2020-10
  12040. @item bt2020-12
  12041. @item smpte2084
  12042. @item smpte428
  12043. @item arib-std-b67
  12044. @end table
  12045. @item colorspace
  12046. Set the colorspace.
  12047. Available values are:
  12048. @table @samp
  12049. @item auto
  12050. Keep the same colorspace property (default).
  12051. @item gbr
  12052. @item bt709
  12053. @item unknown
  12054. @item fcc
  12055. @item bt470bg
  12056. @item smpte170m
  12057. @item smpte240m
  12058. @item ycgco
  12059. @item bt2020nc
  12060. @item bt2020c
  12061. @item smpte2085
  12062. @item chroma-derived-nc
  12063. @item chroma-derived-c
  12064. @item ictcp
  12065. @end table
  12066. @end table
  12067. @section showinfo
  12068. Show a line containing various information for each input video frame.
  12069. The input video is not modified.
  12070. This filter supports the following options:
  12071. @table @option
  12072. @item checksum
  12073. Calculate checksums of each plane. By default enabled.
  12074. @end table
  12075. The shown line contains a sequence of key/value pairs of the form
  12076. @var{key}:@var{value}.
  12077. The following values are shown in the output:
  12078. @table @option
  12079. @item n
  12080. The (sequential) number of the input frame, starting from 0.
  12081. @item pts
  12082. The Presentation TimeStamp of the input frame, expressed as a number of
  12083. time base units. The time base unit depends on the filter input pad.
  12084. @item pts_time
  12085. The Presentation TimeStamp of the input frame, expressed as a number of
  12086. seconds.
  12087. @item pos
  12088. The position of the frame in the input stream, or -1 if this information is
  12089. unavailable and/or meaningless (for example in case of synthetic video).
  12090. @item fmt
  12091. The pixel format name.
  12092. @item sar
  12093. The sample aspect ratio of the input frame, expressed in the form
  12094. @var{num}/@var{den}.
  12095. @item s
  12096. The size of the input frame. For the syntax of this option, check the
  12097. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12098. @item i
  12099. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12100. for bottom field first).
  12101. @item iskey
  12102. This is 1 if the frame is a key frame, 0 otherwise.
  12103. @item type
  12104. The picture type of the input frame ("I" for an I-frame, "P" for a
  12105. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12106. Also refer to the documentation of the @code{AVPictureType} enum and of
  12107. the @code{av_get_picture_type_char} function defined in
  12108. @file{libavutil/avutil.h}.
  12109. @item checksum
  12110. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12111. @item plane_checksum
  12112. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12113. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12114. @end table
  12115. @section showpalette
  12116. Displays the 256 colors palette of each frame. This filter is only relevant for
  12117. @var{pal8} pixel format frames.
  12118. It accepts the following option:
  12119. @table @option
  12120. @item s
  12121. Set the size of the box used to represent one palette color entry. Default is
  12122. @code{30} (for a @code{30x30} pixel box).
  12123. @end table
  12124. @section shuffleframes
  12125. Reorder and/or duplicate and/or drop video frames.
  12126. It accepts the following parameters:
  12127. @table @option
  12128. @item mapping
  12129. Set the destination indexes of input frames.
  12130. This is space or '|' separated list of indexes that maps input frames to output
  12131. frames. Number of indexes also sets maximal value that each index may have.
  12132. '-1' index have special meaning and that is to drop frame.
  12133. @end table
  12134. The first frame has the index 0. The default is to keep the input unchanged.
  12135. @subsection Examples
  12136. @itemize
  12137. @item
  12138. Swap second and third frame of every three frames of the input:
  12139. @example
  12140. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12141. @end example
  12142. @item
  12143. Swap 10th and 1st frame of every ten frames of the input:
  12144. @example
  12145. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12146. @end example
  12147. @end itemize
  12148. @section shuffleplanes
  12149. Reorder and/or duplicate video planes.
  12150. It accepts the following parameters:
  12151. @table @option
  12152. @item map0
  12153. The index of the input plane to be used as the first output plane.
  12154. @item map1
  12155. The index of the input plane to be used as the second output plane.
  12156. @item map2
  12157. The index of the input plane to be used as the third output plane.
  12158. @item map3
  12159. The index of the input plane to be used as the fourth output plane.
  12160. @end table
  12161. The first plane has the index 0. The default is to keep the input unchanged.
  12162. @subsection Examples
  12163. @itemize
  12164. @item
  12165. Swap the second and third planes of the input:
  12166. @example
  12167. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12168. @end example
  12169. @end itemize
  12170. @anchor{signalstats}
  12171. @section signalstats
  12172. Evaluate various visual metrics that assist in determining issues associated
  12173. with the digitization of analog video media.
  12174. By default the filter will log these metadata values:
  12175. @table @option
  12176. @item YMIN
  12177. Display the minimal Y value contained within the input frame. Expressed in
  12178. range of [0-255].
  12179. @item YLOW
  12180. Display the Y value at the 10% percentile within the input frame. Expressed in
  12181. range of [0-255].
  12182. @item YAVG
  12183. Display the average Y value within the input frame. Expressed in range of
  12184. [0-255].
  12185. @item YHIGH
  12186. Display the Y value at the 90% percentile within the input frame. Expressed in
  12187. range of [0-255].
  12188. @item YMAX
  12189. Display the maximum Y value contained within the input frame. Expressed in
  12190. range of [0-255].
  12191. @item UMIN
  12192. Display the minimal U value contained within the input frame. Expressed in
  12193. range of [0-255].
  12194. @item ULOW
  12195. Display the U value at the 10% percentile within the input frame. Expressed in
  12196. range of [0-255].
  12197. @item UAVG
  12198. Display the average U value within the input frame. Expressed in range of
  12199. [0-255].
  12200. @item UHIGH
  12201. Display the U value at the 90% percentile within the input frame. Expressed in
  12202. range of [0-255].
  12203. @item UMAX
  12204. Display the maximum U value contained within the input frame. Expressed in
  12205. range of [0-255].
  12206. @item VMIN
  12207. Display the minimal V value contained within the input frame. Expressed in
  12208. range of [0-255].
  12209. @item VLOW
  12210. Display the V value at the 10% percentile within the input frame. Expressed in
  12211. range of [0-255].
  12212. @item VAVG
  12213. Display the average V value within the input frame. Expressed in range of
  12214. [0-255].
  12215. @item VHIGH
  12216. Display the V value at the 90% percentile within the input frame. Expressed in
  12217. range of [0-255].
  12218. @item VMAX
  12219. Display the maximum V value contained within the input frame. Expressed in
  12220. range of [0-255].
  12221. @item SATMIN
  12222. Display the minimal saturation value contained within the input frame.
  12223. Expressed in range of [0-~181.02].
  12224. @item SATLOW
  12225. Display the saturation value at the 10% percentile within the input frame.
  12226. Expressed in range of [0-~181.02].
  12227. @item SATAVG
  12228. Display the average saturation value within the input frame. Expressed in range
  12229. of [0-~181.02].
  12230. @item SATHIGH
  12231. Display the saturation value at the 90% percentile within the input frame.
  12232. Expressed in range of [0-~181.02].
  12233. @item SATMAX
  12234. Display the maximum saturation value contained within the input frame.
  12235. Expressed in range of [0-~181.02].
  12236. @item HUEMED
  12237. Display the median value for hue within the input frame. Expressed in range of
  12238. [0-360].
  12239. @item HUEAVG
  12240. Display the average value for hue within the input frame. Expressed in range of
  12241. [0-360].
  12242. @item YDIF
  12243. Display the average of sample value difference between all values of the Y
  12244. plane in the current frame and corresponding values of the previous input frame.
  12245. Expressed in range of [0-255].
  12246. @item UDIF
  12247. Display the average of sample value difference between all values of the U
  12248. plane in the current frame and corresponding values of the previous input frame.
  12249. Expressed in range of [0-255].
  12250. @item VDIF
  12251. Display the average of sample value difference between all values of the V
  12252. plane in the current frame and corresponding values of the previous input frame.
  12253. Expressed in range of [0-255].
  12254. @item YBITDEPTH
  12255. Display bit depth of Y plane in current frame.
  12256. Expressed in range of [0-16].
  12257. @item UBITDEPTH
  12258. Display bit depth of U plane in current frame.
  12259. Expressed in range of [0-16].
  12260. @item VBITDEPTH
  12261. Display bit depth of V plane in current frame.
  12262. Expressed in range of [0-16].
  12263. @end table
  12264. The filter accepts the following options:
  12265. @table @option
  12266. @item stat
  12267. @item out
  12268. @option{stat} specify an additional form of image analysis.
  12269. @option{out} output video with the specified type of pixel highlighted.
  12270. Both options accept the following values:
  12271. @table @samp
  12272. @item tout
  12273. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12274. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12275. include the results of video dropouts, head clogs, or tape tracking issues.
  12276. @item vrep
  12277. Identify @var{vertical line repetition}. Vertical line repetition includes
  12278. similar rows of pixels within a frame. In born-digital video vertical line
  12279. repetition is common, but this pattern is uncommon in video digitized from an
  12280. analog source. When it occurs in video that results from the digitization of an
  12281. analog source it can indicate concealment from a dropout compensator.
  12282. @item brng
  12283. Identify pixels that fall outside of legal broadcast range.
  12284. @end table
  12285. @item color, c
  12286. Set the highlight color for the @option{out} option. The default color is
  12287. yellow.
  12288. @end table
  12289. @subsection Examples
  12290. @itemize
  12291. @item
  12292. Output data of various video metrics:
  12293. @example
  12294. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12295. @end example
  12296. @item
  12297. Output specific data about the minimum and maximum values of the Y plane per frame:
  12298. @example
  12299. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12300. @end example
  12301. @item
  12302. Playback video while highlighting pixels that are outside of broadcast range in red.
  12303. @example
  12304. ffplay example.mov -vf signalstats="out=brng:color=red"
  12305. @end example
  12306. @item
  12307. Playback video with signalstats metadata drawn over the frame.
  12308. @example
  12309. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12310. @end example
  12311. The contents of signalstat_drawtext.txt used in the command are:
  12312. @example
  12313. time %@{pts:hms@}
  12314. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12315. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12316. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12317. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12318. @end example
  12319. @end itemize
  12320. @anchor{signature}
  12321. @section signature
  12322. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12323. input. In this case the matching between the inputs can be calculated additionally.
  12324. The filter always passes through the first input. The signature of each stream can
  12325. be written into a file.
  12326. It accepts the following options:
  12327. @table @option
  12328. @item detectmode
  12329. Enable or disable the matching process.
  12330. Available values are:
  12331. @table @samp
  12332. @item off
  12333. Disable the calculation of a matching (default).
  12334. @item full
  12335. Calculate the matching for the whole video and output whether the whole video
  12336. matches or only parts.
  12337. @item fast
  12338. Calculate only until a matching is found or the video ends. Should be faster in
  12339. some cases.
  12340. @end table
  12341. @item nb_inputs
  12342. Set the number of inputs. The option value must be a non negative integer.
  12343. Default value is 1.
  12344. @item filename
  12345. Set the path to which the output is written. If there is more than one input,
  12346. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12347. integer), that will be replaced with the input number. If no filename is
  12348. specified, no output will be written. This is the default.
  12349. @item format
  12350. Choose the output format.
  12351. Available values are:
  12352. @table @samp
  12353. @item binary
  12354. Use the specified binary representation (default).
  12355. @item xml
  12356. Use the specified xml representation.
  12357. @end table
  12358. @item th_d
  12359. Set threshold to detect one word as similar. The option value must be an integer
  12360. greater than zero. The default value is 9000.
  12361. @item th_dc
  12362. Set threshold to detect all words as similar. The option value must be an integer
  12363. greater than zero. The default value is 60000.
  12364. @item th_xh
  12365. Set threshold to detect frames as similar. The option value must be an integer
  12366. greater than zero. The default value is 116.
  12367. @item th_di
  12368. Set the minimum length of a sequence in frames to recognize it as matching
  12369. sequence. The option value must be a non negative integer value.
  12370. The default value is 0.
  12371. @item th_it
  12372. Set the minimum relation, that matching frames to all frames must have.
  12373. The option value must be a double value between 0 and 1. The default value is 0.5.
  12374. @end table
  12375. @subsection Examples
  12376. @itemize
  12377. @item
  12378. To calculate the signature of an input video and store it in signature.bin:
  12379. @example
  12380. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12381. @end example
  12382. @item
  12383. To detect whether two videos match and store the signatures in XML format in
  12384. signature0.xml and signature1.xml:
  12385. @example
  12386. 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 -
  12387. @end example
  12388. @end itemize
  12389. @anchor{smartblur}
  12390. @section smartblur
  12391. Blur the input video without impacting the outlines.
  12392. It accepts the following options:
  12393. @table @option
  12394. @item luma_radius, lr
  12395. Set the luma radius. The option value must be a float number in
  12396. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12397. used to blur the image (slower if larger). Default value is 1.0.
  12398. @item luma_strength, ls
  12399. Set the luma strength. The option value must be a float number
  12400. in the range [-1.0,1.0] that configures the blurring. A value included
  12401. in [0.0,1.0] will blur the image whereas a value included in
  12402. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12403. @item luma_threshold, lt
  12404. Set the luma threshold used as a coefficient to determine
  12405. whether a pixel should be blurred or not. The option value must be an
  12406. integer in the range [-30,30]. A value of 0 will filter all the image,
  12407. a value included in [0,30] will filter flat areas and a value included
  12408. in [-30,0] will filter edges. Default value is 0.
  12409. @item chroma_radius, cr
  12410. Set the chroma radius. The option value must be a float number in
  12411. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12412. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12413. @item chroma_strength, cs
  12414. Set the chroma strength. The option value must be a float number
  12415. in the range [-1.0,1.0] that configures the blurring. A value included
  12416. in [0.0,1.0] will blur the image whereas a value included in
  12417. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12418. @item chroma_threshold, ct
  12419. Set the chroma threshold used as a coefficient to determine
  12420. whether a pixel should be blurred or not. The option value must be an
  12421. integer in the range [-30,30]. A value of 0 will filter all the image,
  12422. a value included in [0,30] will filter flat areas and a value included
  12423. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12424. @end table
  12425. If a chroma option is not explicitly set, the corresponding luma value
  12426. is set.
  12427. @section ssim
  12428. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12429. This filter takes in input two input videos, the first input is
  12430. considered the "main" source and is passed unchanged to the
  12431. output. The second input is used as a "reference" video for computing
  12432. the SSIM.
  12433. Both video inputs must have the same resolution and pixel format for
  12434. this filter to work correctly. Also it assumes that both inputs
  12435. have the same number of frames, which are compared one by one.
  12436. The filter stores the calculated SSIM of each frame.
  12437. The description of the accepted parameters follows.
  12438. @table @option
  12439. @item stats_file, f
  12440. If specified the filter will use the named file to save the SSIM of
  12441. each individual frame. When filename equals "-" the data is sent to
  12442. standard output.
  12443. @end table
  12444. The file printed if @var{stats_file} is selected, contains a sequence of
  12445. key/value pairs of the form @var{key}:@var{value} for each compared
  12446. couple of frames.
  12447. A description of each shown parameter follows:
  12448. @table @option
  12449. @item n
  12450. sequential number of the input frame, starting from 1
  12451. @item Y, U, V, R, G, B
  12452. SSIM of the compared frames for the component specified by the suffix.
  12453. @item All
  12454. SSIM of the compared frames for the whole frame.
  12455. @item dB
  12456. Same as above but in dB representation.
  12457. @end table
  12458. This filter also supports the @ref{framesync} options.
  12459. For example:
  12460. @example
  12461. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12462. [main][ref] ssim="stats_file=stats.log" [out]
  12463. @end example
  12464. On this example the input file being processed is compared with the
  12465. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12466. is stored in @file{stats.log}.
  12467. Another example with both psnr and ssim at same time:
  12468. @example
  12469. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12470. @end example
  12471. @section stereo3d
  12472. Convert between different stereoscopic image formats.
  12473. The filters accept the following options:
  12474. @table @option
  12475. @item in
  12476. Set stereoscopic image format of input.
  12477. Available values for input image formats are:
  12478. @table @samp
  12479. @item sbsl
  12480. side by side parallel (left eye left, right eye right)
  12481. @item sbsr
  12482. side by side crosseye (right eye left, left eye right)
  12483. @item sbs2l
  12484. side by side parallel with half width resolution
  12485. (left eye left, right eye right)
  12486. @item sbs2r
  12487. side by side crosseye with half width resolution
  12488. (right eye left, left eye right)
  12489. @item abl
  12490. above-below (left eye above, right eye below)
  12491. @item abr
  12492. above-below (right eye above, left eye below)
  12493. @item ab2l
  12494. above-below with half height resolution
  12495. (left eye above, right eye below)
  12496. @item ab2r
  12497. above-below with half height resolution
  12498. (right eye above, left eye below)
  12499. @item al
  12500. alternating frames (left eye first, right eye second)
  12501. @item ar
  12502. alternating frames (right eye first, left eye second)
  12503. @item irl
  12504. interleaved rows (left eye has top row, right eye starts on next row)
  12505. @item irr
  12506. interleaved rows (right eye has top row, left eye starts on next row)
  12507. @item icl
  12508. interleaved columns, left eye first
  12509. @item icr
  12510. interleaved columns, right eye first
  12511. Default value is @samp{sbsl}.
  12512. @end table
  12513. @item out
  12514. Set stereoscopic image format of output.
  12515. @table @samp
  12516. @item sbsl
  12517. side by side parallel (left eye left, right eye right)
  12518. @item sbsr
  12519. side by side crosseye (right eye left, left eye right)
  12520. @item sbs2l
  12521. side by side parallel with half width resolution
  12522. (left eye left, right eye right)
  12523. @item sbs2r
  12524. side by side crosseye with half width resolution
  12525. (right eye left, left eye right)
  12526. @item abl
  12527. above-below (left eye above, right eye below)
  12528. @item abr
  12529. above-below (right eye above, left eye below)
  12530. @item ab2l
  12531. above-below with half height resolution
  12532. (left eye above, right eye below)
  12533. @item ab2r
  12534. above-below with half height resolution
  12535. (right eye above, left eye below)
  12536. @item al
  12537. alternating frames (left eye first, right eye second)
  12538. @item ar
  12539. alternating frames (right eye first, left eye second)
  12540. @item irl
  12541. interleaved rows (left eye has top row, right eye starts on next row)
  12542. @item irr
  12543. interleaved rows (right eye has top row, left eye starts on next row)
  12544. @item arbg
  12545. anaglyph red/blue gray
  12546. (red filter on left eye, blue filter on right eye)
  12547. @item argg
  12548. anaglyph red/green gray
  12549. (red filter on left eye, green filter on right eye)
  12550. @item arcg
  12551. anaglyph red/cyan gray
  12552. (red filter on left eye, cyan filter on right eye)
  12553. @item arch
  12554. anaglyph red/cyan half colored
  12555. (red filter on left eye, cyan filter on right eye)
  12556. @item arcc
  12557. anaglyph red/cyan color
  12558. (red filter on left eye, cyan filter on right eye)
  12559. @item arcd
  12560. anaglyph red/cyan color optimized with the least squares projection of dubois
  12561. (red filter on left eye, cyan filter on right eye)
  12562. @item agmg
  12563. anaglyph green/magenta gray
  12564. (green filter on left eye, magenta filter on right eye)
  12565. @item agmh
  12566. anaglyph green/magenta half colored
  12567. (green filter on left eye, magenta filter on right eye)
  12568. @item agmc
  12569. anaglyph green/magenta colored
  12570. (green filter on left eye, magenta filter on right eye)
  12571. @item agmd
  12572. anaglyph green/magenta color optimized with the least squares projection of dubois
  12573. (green filter on left eye, magenta filter on right eye)
  12574. @item aybg
  12575. anaglyph yellow/blue gray
  12576. (yellow filter on left eye, blue filter on right eye)
  12577. @item aybh
  12578. anaglyph yellow/blue half colored
  12579. (yellow filter on left eye, blue filter on right eye)
  12580. @item aybc
  12581. anaglyph yellow/blue colored
  12582. (yellow filter on left eye, blue filter on right eye)
  12583. @item aybd
  12584. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12585. (yellow filter on left eye, blue filter on right eye)
  12586. @item ml
  12587. mono output (left eye only)
  12588. @item mr
  12589. mono output (right eye only)
  12590. @item chl
  12591. checkerboard, left eye first
  12592. @item chr
  12593. checkerboard, right eye first
  12594. @item icl
  12595. interleaved columns, left eye first
  12596. @item icr
  12597. interleaved columns, right eye first
  12598. @item hdmi
  12599. HDMI frame pack
  12600. @end table
  12601. Default value is @samp{arcd}.
  12602. @end table
  12603. @subsection Examples
  12604. @itemize
  12605. @item
  12606. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12607. @example
  12608. stereo3d=sbsl:aybd
  12609. @end example
  12610. @item
  12611. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12612. @example
  12613. stereo3d=abl:sbsr
  12614. @end example
  12615. @end itemize
  12616. @section streamselect, astreamselect
  12617. Select video or audio streams.
  12618. The filter accepts the following options:
  12619. @table @option
  12620. @item inputs
  12621. Set number of inputs. Default is 2.
  12622. @item map
  12623. Set input indexes to remap to outputs.
  12624. @end table
  12625. @subsection Commands
  12626. The @code{streamselect} and @code{astreamselect} filter supports the following
  12627. commands:
  12628. @table @option
  12629. @item map
  12630. Set input indexes to remap to outputs.
  12631. @end table
  12632. @subsection Examples
  12633. @itemize
  12634. @item
  12635. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12636. @example
  12637. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12638. @end example
  12639. @item
  12640. Same as above, but for audio:
  12641. @example
  12642. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12643. @end example
  12644. @end itemize
  12645. @section sobel
  12646. Apply sobel operator to input video stream.
  12647. The filter accepts the following option:
  12648. @table @option
  12649. @item planes
  12650. Set which planes will be processed, unprocessed planes will be copied.
  12651. By default value 0xf, all planes will be processed.
  12652. @item scale
  12653. Set value which will be multiplied with filtered result.
  12654. @item delta
  12655. Set value which will be added to filtered result.
  12656. @end table
  12657. @anchor{spp}
  12658. @section spp
  12659. Apply a simple postprocessing filter that compresses and decompresses the image
  12660. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12661. and average the results.
  12662. The filter accepts the following options:
  12663. @table @option
  12664. @item quality
  12665. Set quality. This option defines the number of levels for averaging. It accepts
  12666. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12667. effect. A value of @code{6} means the higher quality. For each increment of
  12668. that value the speed drops by a factor of approximately 2. Default value is
  12669. @code{3}.
  12670. @item qp
  12671. Force a constant quantization parameter. If not set, the filter will use the QP
  12672. from the video stream (if available).
  12673. @item mode
  12674. Set thresholding mode. Available modes are:
  12675. @table @samp
  12676. @item hard
  12677. Set hard thresholding (default).
  12678. @item soft
  12679. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12680. @end table
  12681. @item use_bframe_qp
  12682. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12683. option may cause flicker since the B-Frames have often larger QP. Default is
  12684. @code{0} (not enabled).
  12685. @end table
  12686. @section sr
  12687. Scale the input by applying one of the super-resolution methods based on
  12688. convolutional neural networks. Supported models:
  12689. @itemize
  12690. @item
  12691. Super-Resolution Convolutional Neural Network model (SRCNN).
  12692. See @url{https://arxiv.org/abs/1501.00092}.
  12693. @item
  12694. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12695. See @url{https://arxiv.org/abs/1609.05158}.
  12696. @end itemize
  12697. Training scripts as well as scripts for model file (.pb) saving can be found at
  12698. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  12699. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12700. Native model files (.model) can be generated from TensorFlow model
  12701. files (.pb) by using tools/python/convert.py
  12702. The filter accepts the following options:
  12703. @table @option
  12704. @item dnn_backend
  12705. Specify which DNN backend to use for model loading and execution. This option accepts
  12706. the following values:
  12707. @table @samp
  12708. @item native
  12709. Native implementation of DNN loading and execution.
  12710. @item tensorflow
  12711. TensorFlow backend. To enable this backend you
  12712. need to install the TensorFlow for C library (see
  12713. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12714. @code{--enable-libtensorflow}
  12715. @end table
  12716. Default value is @samp{native}.
  12717. @item model
  12718. Set path to model file specifying network architecture and its parameters.
  12719. Note that different backends use different file formats. TensorFlow backend
  12720. can load files for both formats, while native backend can load files for only
  12721. its format.
  12722. @item scale_factor
  12723. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12724. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12725. input upscaled using bicubic upscaling with proper scale factor.
  12726. @end table
  12727. @anchor{subtitles}
  12728. @section subtitles
  12729. Draw subtitles on top of input video using the libass library.
  12730. To enable compilation of this filter you need to configure FFmpeg with
  12731. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12732. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12733. Alpha) subtitles format.
  12734. The filter accepts the following options:
  12735. @table @option
  12736. @item filename, f
  12737. Set the filename of the subtitle file to read. It must be specified.
  12738. @item original_size
  12739. Specify the size of the original video, the video for which the ASS file
  12740. was composed. For the syntax of this option, check the
  12741. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12742. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12743. correctly scale the fonts if the aspect ratio has been changed.
  12744. @item fontsdir
  12745. Set a directory path containing fonts that can be used by the filter.
  12746. These fonts will be used in addition to whatever the font provider uses.
  12747. @item alpha
  12748. Process alpha channel, by default alpha channel is untouched.
  12749. @item charenc
  12750. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12751. useful if not UTF-8.
  12752. @item stream_index, si
  12753. Set subtitles stream index. @code{subtitles} filter only.
  12754. @item force_style
  12755. Override default style or script info parameters of the subtitles. It accepts a
  12756. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12757. @end table
  12758. If the first key is not specified, it is assumed that the first value
  12759. specifies the @option{filename}.
  12760. For example, to render the file @file{sub.srt} on top of the input
  12761. video, use the command:
  12762. @example
  12763. subtitles=sub.srt
  12764. @end example
  12765. which is equivalent to:
  12766. @example
  12767. subtitles=filename=sub.srt
  12768. @end example
  12769. To render the default subtitles stream from file @file{video.mkv}, use:
  12770. @example
  12771. subtitles=video.mkv
  12772. @end example
  12773. To render the second subtitles stream from that file, use:
  12774. @example
  12775. subtitles=video.mkv:si=1
  12776. @end example
  12777. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12778. @code{DejaVu Serif}, use:
  12779. @example
  12780. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12781. @end example
  12782. @section super2xsai
  12783. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12784. Interpolate) pixel art scaling algorithm.
  12785. Useful for enlarging pixel art images without reducing sharpness.
  12786. @section swaprect
  12787. Swap two rectangular objects in video.
  12788. This filter accepts the following options:
  12789. @table @option
  12790. @item w
  12791. Set object width.
  12792. @item h
  12793. Set object height.
  12794. @item x1
  12795. Set 1st rect x coordinate.
  12796. @item y1
  12797. Set 1st rect y coordinate.
  12798. @item x2
  12799. Set 2nd rect x coordinate.
  12800. @item y2
  12801. Set 2nd rect y coordinate.
  12802. All expressions are evaluated once for each frame.
  12803. @end table
  12804. The all options are expressions containing the following constants:
  12805. @table @option
  12806. @item w
  12807. @item h
  12808. The input width and height.
  12809. @item a
  12810. same as @var{w} / @var{h}
  12811. @item sar
  12812. input sample aspect ratio
  12813. @item dar
  12814. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12815. @item n
  12816. The number of the input frame, starting from 0.
  12817. @item t
  12818. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12819. @item pos
  12820. the position in the file of the input frame, NAN if unknown
  12821. @end table
  12822. @section swapuv
  12823. Swap U & V plane.
  12824. @section telecine
  12825. Apply telecine process to the video.
  12826. This filter accepts the following options:
  12827. @table @option
  12828. @item first_field
  12829. @table @samp
  12830. @item top, t
  12831. top field first
  12832. @item bottom, b
  12833. bottom field first
  12834. The default value is @code{top}.
  12835. @end table
  12836. @item pattern
  12837. A string of numbers representing the pulldown pattern you wish to apply.
  12838. The default value is @code{23}.
  12839. @end table
  12840. @example
  12841. Some typical patterns:
  12842. NTSC output (30i):
  12843. 27.5p: 32222
  12844. 24p: 23 (classic)
  12845. 24p: 2332 (preferred)
  12846. 20p: 33
  12847. 18p: 334
  12848. 16p: 3444
  12849. PAL output (25i):
  12850. 27.5p: 12222
  12851. 24p: 222222222223 ("Euro pulldown")
  12852. 16.67p: 33
  12853. 16p: 33333334
  12854. @end example
  12855. @section threshold
  12856. Apply threshold effect to video stream.
  12857. This filter needs four video streams to perform thresholding.
  12858. First stream is stream we are filtering.
  12859. Second stream is holding threshold values, third stream is holding min values,
  12860. and last, fourth stream is holding max values.
  12861. The filter accepts the following option:
  12862. @table @option
  12863. @item planes
  12864. Set which planes will be processed, unprocessed planes will be copied.
  12865. By default value 0xf, all planes will be processed.
  12866. @end table
  12867. For example if first stream pixel's component value is less then threshold value
  12868. of pixel component from 2nd threshold stream, third stream value will picked,
  12869. otherwise fourth stream pixel component value will be picked.
  12870. Using color source filter one can perform various types of thresholding:
  12871. @subsection Examples
  12872. @itemize
  12873. @item
  12874. Binary threshold, using gray color as threshold:
  12875. @example
  12876. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12877. @end example
  12878. @item
  12879. Inverted binary threshold, using gray color as threshold:
  12880. @example
  12881. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12882. @end example
  12883. @item
  12884. Truncate binary threshold, using gray color as threshold:
  12885. @example
  12886. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12887. @end example
  12888. @item
  12889. Threshold to zero, using gray color as threshold:
  12890. @example
  12891. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12892. @end example
  12893. @item
  12894. Inverted threshold to zero, using gray color as threshold:
  12895. @example
  12896. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12897. @end example
  12898. @end itemize
  12899. @section thumbnail
  12900. Select the most representative frame in a given sequence of consecutive frames.
  12901. The filter accepts the following options:
  12902. @table @option
  12903. @item n
  12904. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12905. will pick one of them, and then handle the next batch of @var{n} frames until
  12906. the end. Default is @code{100}.
  12907. @end table
  12908. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12909. value will result in a higher memory usage, so a high value is not recommended.
  12910. @subsection Examples
  12911. @itemize
  12912. @item
  12913. Extract one picture each 50 frames:
  12914. @example
  12915. thumbnail=50
  12916. @end example
  12917. @item
  12918. Complete example of a thumbnail creation with @command{ffmpeg}:
  12919. @example
  12920. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12921. @end example
  12922. @end itemize
  12923. @section tile
  12924. Tile several successive frames together.
  12925. The filter accepts the following options:
  12926. @table @option
  12927. @item layout
  12928. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12929. this option, check the
  12930. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12931. @item nb_frames
  12932. Set the maximum number of frames to render in the given area. It must be less
  12933. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12934. the area will be used.
  12935. @item margin
  12936. Set the outer border margin in pixels.
  12937. @item padding
  12938. Set the inner border thickness (i.e. the number of pixels between frames). For
  12939. more advanced padding options (such as having different values for the edges),
  12940. refer to the pad video filter.
  12941. @item color
  12942. Specify the color of the unused area. For the syntax of this option, check the
  12943. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12944. The default value of @var{color} is "black".
  12945. @item overlap
  12946. Set the number of frames to overlap when tiling several successive frames together.
  12947. The value must be between @code{0} and @var{nb_frames - 1}.
  12948. @item init_padding
  12949. Set the number of frames to initially be empty before displaying first output frame.
  12950. This controls how soon will one get first output frame.
  12951. The value must be between @code{0} and @var{nb_frames - 1}.
  12952. @end table
  12953. @subsection Examples
  12954. @itemize
  12955. @item
  12956. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12957. @example
  12958. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12959. @end example
  12960. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12961. duplicating each output frame to accommodate the originally detected frame
  12962. rate.
  12963. @item
  12964. Display @code{5} pictures in an area of @code{3x2} frames,
  12965. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12966. mixed flat and named options:
  12967. @example
  12968. tile=3x2:nb_frames=5:padding=7:margin=2
  12969. @end example
  12970. @end itemize
  12971. @section tinterlace
  12972. Perform various types of temporal field interlacing.
  12973. Frames are counted starting from 1, so the first input frame is
  12974. considered odd.
  12975. The filter accepts the following options:
  12976. @table @option
  12977. @item mode
  12978. Specify the mode of the interlacing. This option can also be specified
  12979. as a value alone. See below for a list of values for this option.
  12980. Available values are:
  12981. @table @samp
  12982. @item merge, 0
  12983. Move odd frames into the upper field, even into the lower field,
  12984. generating a double height frame at half frame rate.
  12985. @example
  12986. ------> time
  12987. Input:
  12988. Frame 1 Frame 2 Frame 3 Frame 4
  12989. 11111 22222 33333 44444
  12990. 11111 22222 33333 44444
  12991. 11111 22222 33333 44444
  12992. 11111 22222 33333 44444
  12993. Output:
  12994. 11111 33333
  12995. 22222 44444
  12996. 11111 33333
  12997. 22222 44444
  12998. 11111 33333
  12999. 22222 44444
  13000. 11111 33333
  13001. 22222 44444
  13002. @end example
  13003. @item drop_even, 1
  13004. Only output odd frames, even frames are dropped, generating a frame with
  13005. unchanged height at half frame rate.
  13006. @example
  13007. ------> time
  13008. Input:
  13009. Frame 1 Frame 2 Frame 3 Frame 4
  13010. 11111 22222 33333 44444
  13011. 11111 22222 33333 44444
  13012. 11111 22222 33333 44444
  13013. 11111 22222 33333 44444
  13014. Output:
  13015. 11111 33333
  13016. 11111 33333
  13017. 11111 33333
  13018. 11111 33333
  13019. @end example
  13020. @item drop_odd, 2
  13021. Only output even frames, odd frames are dropped, generating a frame with
  13022. unchanged height at half frame rate.
  13023. @example
  13024. ------> time
  13025. Input:
  13026. Frame 1 Frame 2 Frame 3 Frame 4
  13027. 11111 22222 33333 44444
  13028. 11111 22222 33333 44444
  13029. 11111 22222 33333 44444
  13030. 11111 22222 33333 44444
  13031. Output:
  13032. 22222 44444
  13033. 22222 44444
  13034. 22222 44444
  13035. 22222 44444
  13036. @end example
  13037. @item pad, 3
  13038. Expand each frame to full height, but pad alternate lines with black,
  13039. generating a frame with double height at the same input frame rate.
  13040. @example
  13041. ------> time
  13042. Input:
  13043. Frame 1 Frame 2 Frame 3 Frame 4
  13044. 11111 22222 33333 44444
  13045. 11111 22222 33333 44444
  13046. 11111 22222 33333 44444
  13047. 11111 22222 33333 44444
  13048. Output:
  13049. 11111 ..... 33333 .....
  13050. ..... 22222 ..... 44444
  13051. 11111 ..... 33333 .....
  13052. ..... 22222 ..... 44444
  13053. 11111 ..... 33333 .....
  13054. ..... 22222 ..... 44444
  13055. 11111 ..... 33333 .....
  13056. ..... 22222 ..... 44444
  13057. @end example
  13058. @item interleave_top, 4
  13059. Interleave the upper field from odd frames with the lower field from
  13060. even frames, generating a frame with unchanged height at half frame rate.
  13061. @example
  13062. ------> time
  13063. Input:
  13064. Frame 1 Frame 2 Frame 3 Frame 4
  13065. 11111<- 22222 33333<- 44444
  13066. 11111 22222<- 33333 44444<-
  13067. 11111<- 22222 33333<- 44444
  13068. 11111 22222<- 33333 44444<-
  13069. Output:
  13070. 11111 33333
  13071. 22222 44444
  13072. 11111 33333
  13073. 22222 44444
  13074. @end example
  13075. @item interleave_bottom, 5
  13076. Interleave the lower field from odd frames with the upper field from
  13077. even frames, generating a frame with unchanged height at half frame rate.
  13078. @example
  13079. ------> time
  13080. Input:
  13081. Frame 1 Frame 2 Frame 3 Frame 4
  13082. 11111 22222<- 33333 44444<-
  13083. 11111<- 22222 33333<- 44444
  13084. 11111 22222<- 33333 44444<-
  13085. 11111<- 22222 33333<- 44444
  13086. Output:
  13087. 22222 44444
  13088. 11111 33333
  13089. 22222 44444
  13090. 11111 33333
  13091. @end example
  13092. @item interlacex2, 6
  13093. Double frame rate with unchanged height. Frames are inserted each
  13094. containing the second temporal field from the previous input frame and
  13095. the first temporal field from the next input frame. This mode relies on
  13096. the top_field_first flag. Useful for interlaced video displays with no
  13097. field synchronisation.
  13098. @example
  13099. ------> time
  13100. Input:
  13101. Frame 1 Frame 2 Frame 3 Frame 4
  13102. 11111 22222 33333 44444
  13103. 11111 22222 33333 44444
  13104. 11111 22222 33333 44444
  13105. 11111 22222 33333 44444
  13106. Output:
  13107. 11111 22222 22222 33333 33333 44444 44444
  13108. 11111 11111 22222 22222 33333 33333 44444
  13109. 11111 22222 22222 33333 33333 44444 44444
  13110. 11111 11111 22222 22222 33333 33333 44444
  13111. @end example
  13112. @item mergex2, 7
  13113. Move odd frames into the upper field, even into the lower field,
  13114. generating a double height frame at same frame rate.
  13115. @example
  13116. ------> time
  13117. Input:
  13118. Frame 1 Frame 2 Frame 3 Frame 4
  13119. 11111 22222 33333 44444
  13120. 11111 22222 33333 44444
  13121. 11111 22222 33333 44444
  13122. 11111 22222 33333 44444
  13123. Output:
  13124. 11111 33333 33333 55555
  13125. 22222 22222 44444 44444
  13126. 11111 33333 33333 55555
  13127. 22222 22222 44444 44444
  13128. 11111 33333 33333 55555
  13129. 22222 22222 44444 44444
  13130. 11111 33333 33333 55555
  13131. 22222 22222 44444 44444
  13132. @end example
  13133. @end table
  13134. Numeric values are deprecated but are accepted for backward
  13135. compatibility reasons.
  13136. Default mode is @code{merge}.
  13137. @item flags
  13138. Specify flags influencing the filter process.
  13139. Available value for @var{flags} is:
  13140. @table @option
  13141. @item low_pass_filter, vlpf
  13142. Enable linear vertical low-pass filtering in the filter.
  13143. Vertical low-pass filtering is required when creating an interlaced
  13144. destination from a progressive source which contains high-frequency
  13145. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13146. patterning.
  13147. @item complex_filter, cvlpf
  13148. Enable complex vertical low-pass filtering.
  13149. This will slightly less reduce interlace 'twitter' and Moire
  13150. patterning but better retain detail and subjective sharpness impression.
  13151. @end table
  13152. Vertical low-pass filtering can only be enabled for @option{mode}
  13153. @var{interleave_top} and @var{interleave_bottom}.
  13154. @end table
  13155. @section tmix
  13156. Mix successive video frames.
  13157. A description of the accepted options follows.
  13158. @table @option
  13159. @item frames
  13160. The number of successive frames to mix. If unspecified, it defaults to 3.
  13161. @item weights
  13162. Specify weight of each input video frame.
  13163. Each weight is separated by space. If number of weights is smaller than
  13164. number of @var{frames} last specified weight will be used for all remaining
  13165. unset weights.
  13166. @item scale
  13167. Specify scale, if it is set it will be multiplied with sum
  13168. of each weight multiplied with pixel values to give final destination
  13169. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13170. @end table
  13171. @subsection Examples
  13172. @itemize
  13173. @item
  13174. Average 7 successive frames:
  13175. @example
  13176. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13177. @end example
  13178. @item
  13179. Apply simple temporal convolution:
  13180. @example
  13181. tmix=frames=3:weights="-1 3 -1"
  13182. @end example
  13183. @item
  13184. Similar as above but only showing temporal differences:
  13185. @example
  13186. tmix=frames=3:weights="-1 2 -1":scale=1
  13187. @end example
  13188. @end itemize
  13189. @anchor{tonemap}
  13190. @section tonemap
  13191. Tone map colors from different dynamic ranges.
  13192. This filter expects data in single precision floating point, as it needs to
  13193. operate on (and can output) out-of-range values. Another filter, such as
  13194. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13195. The tonemapping algorithms implemented only work on linear light, so input
  13196. data should be linearized beforehand (and possibly correctly tagged).
  13197. @example
  13198. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13199. @end example
  13200. @subsection Options
  13201. The filter accepts the following options.
  13202. @table @option
  13203. @item tonemap
  13204. Set the tone map algorithm to use.
  13205. Possible values are:
  13206. @table @var
  13207. @item none
  13208. Do not apply any tone map, only desaturate overbright pixels.
  13209. @item clip
  13210. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13211. in-range values, while distorting out-of-range values.
  13212. @item linear
  13213. Stretch the entire reference gamut to a linear multiple of the display.
  13214. @item gamma
  13215. Fit a logarithmic transfer between the tone curves.
  13216. @item reinhard
  13217. Preserve overall image brightness with a simple curve, using nonlinear
  13218. contrast, which results in flattening details and degrading color accuracy.
  13219. @item hable
  13220. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13221. of slightly darkening everything. Use it when detail preservation is more
  13222. important than color and brightness accuracy.
  13223. @item mobius
  13224. Smoothly map out-of-range values, while retaining contrast and colors for
  13225. in-range material as much as possible. Use it when color accuracy is more
  13226. important than detail preservation.
  13227. @end table
  13228. Default is none.
  13229. @item param
  13230. Tune the tone mapping algorithm.
  13231. This affects the following algorithms:
  13232. @table @var
  13233. @item none
  13234. Ignored.
  13235. @item linear
  13236. Specifies the scale factor to use while stretching.
  13237. Default to 1.0.
  13238. @item gamma
  13239. Specifies the exponent of the function.
  13240. Default to 1.8.
  13241. @item clip
  13242. Specify an extra linear coefficient to multiply into the signal before clipping.
  13243. Default to 1.0.
  13244. @item reinhard
  13245. Specify the local contrast coefficient at the display peak.
  13246. Default to 0.5, which means that in-gamut values will be about half as bright
  13247. as when clipping.
  13248. @item hable
  13249. Ignored.
  13250. @item mobius
  13251. Specify the transition point from linear to mobius transform. Every value
  13252. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13253. more accurate the result will be, at the cost of losing bright details.
  13254. Default to 0.3, which due to the steep initial slope still preserves in-range
  13255. colors fairly accurately.
  13256. @end table
  13257. @item desat
  13258. Apply desaturation for highlights that exceed this level of brightness. The
  13259. higher the parameter, the more color information will be preserved. This
  13260. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13261. (smoothly) turning into white instead. This makes images feel more natural,
  13262. at the cost of reducing information about out-of-range colors.
  13263. The default of 2.0 is somewhat conservative and will mostly just apply to
  13264. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13265. This option works only if the input frame has a supported color tag.
  13266. @item peak
  13267. Override signal/nominal/reference peak with this value. Useful when the
  13268. embedded peak information in display metadata is not reliable or when tone
  13269. mapping from a lower range to a higher range.
  13270. @end table
  13271. @section tpad
  13272. Temporarily pad video frames.
  13273. The filter accepts the following options:
  13274. @table @option
  13275. @item start
  13276. Specify number of delay frames before input video stream.
  13277. @item stop
  13278. Specify number of padding frames after input video stream.
  13279. Set to -1 to pad indefinitely.
  13280. @item start_mode
  13281. Set kind of frames added to beginning of stream.
  13282. Can be either @var{add} or @var{clone}.
  13283. With @var{add} frames of solid-color are added.
  13284. With @var{clone} frames are clones of first frame.
  13285. @item stop_mode
  13286. Set kind of frames added to end of stream.
  13287. Can be either @var{add} or @var{clone}.
  13288. With @var{add} frames of solid-color are added.
  13289. With @var{clone} frames are clones of last frame.
  13290. @item start_duration, stop_duration
  13291. Specify the duration of the start/stop delay. See
  13292. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13293. for the accepted syntax.
  13294. These options override @var{start} and @var{stop}.
  13295. @item color
  13296. Specify the color of the padded area. For the syntax of this option,
  13297. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13298. manual,ffmpeg-utils}.
  13299. The default value of @var{color} is "black".
  13300. @end table
  13301. @anchor{transpose}
  13302. @section transpose
  13303. Transpose rows with columns in the input video and optionally flip it.
  13304. It accepts the following parameters:
  13305. @table @option
  13306. @item dir
  13307. Specify the transposition direction.
  13308. Can assume the following values:
  13309. @table @samp
  13310. @item 0, 4, cclock_flip
  13311. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13312. @example
  13313. L.R L.l
  13314. . . -> . .
  13315. l.r R.r
  13316. @end example
  13317. @item 1, 5, clock
  13318. Rotate by 90 degrees clockwise, that is:
  13319. @example
  13320. L.R l.L
  13321. . . -> . .
  13322. l.r r.R
  13323. @end example
  13324. @item 2, 6, cclock
  13325. Rotate by 90 degrees counterclockwise, that is:
  13326. @example
  13327. L.R R.r
  13328. . . -> . .
  13329. l.r L.l
  13330. @end example
  13331. @item 3, 7, clock_flip
  13332. Rotate by 90 degrees clockwise and vertically flip, that is:
  13333. @example
  13334. L.R r.R
  13335. . . -> . .
  13336. l.r l.L
  13337. @end example
  13338. @end table
  13339. For values between 4-7, the transposition is only done if the input
  13340. video geometry is portrait and not landscape. These values are
  13341. deprecated, the @code{passthrough} option should be used instead.
  13342. Numerical values are deprecated, and should be dropped in favor of
  13343. symbolic constants.
  13344. @item passthrough
  13345. Do not apply the transposition if the input geometry matches the one
  13346. specified by the specified value. It accepts the following values:
  13347. @table @samp
  13348. @item none
  13349. Always apply transposition.
  13350. @item portrait
  13351. Preserve portrait geometry (when @var{height} >= @var{width}).
  13352. @item landscape
  13353. Preserve landscape geometry (when @var{width} >= @var{height}).
  13354. @end table
  13355. Default value is @code{none}.
  13356. @end table
  13357. For example to rotate by 90 degrees clockwise and preserve portrait
  13358. layout:
  13359. @example
  13360. transpose=dir=1:passthrough=portrait
  13361. @end example
  13362. The command above can also be specified as:
  13363. @example
  13364. transpose=1:portrait
  13365. @end example
  13366. @section transpose_npp
  13367. Transpose rows with columns in the input video and optionally flip it.
  13368. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13369. It accepts the following parameters:
  13370. @table @option
  13371. @item dir
  13372. Specify the transposition direction.
  13373. Can assume the following values:
  13374. @table @samp
  13375. @item cclock_flip
  13376. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13377. @item clock
  13378. Rotate by 90 degrees clockwise.
  13379. @item cclock
  13380. Rotate by 90 degrees counterclockwise.
  13381. @item clock_flip
  13382. Rotate by 90 degrees clockwise and vertically flip.
  13383. @end table
  13384. @item passthrough
  13385. Do not apply the transposition if the input geometry matches the one
  13386. specified by the specified value. It accepts the following values:
  13387. @table @samp
  13388. @item none
  13389. Always apply transposition. (default)
  13390. @item portrait
  13391. Preserve portrait geometry (when @var{height} >= @var{width}).
  13392. @item landscape
  13393. Preserve landscape geometry (when @var{width} >= @var{height}).
  13394. @end table
  13395. @end table
  13396. @section trim
  13397. Trim the input so that the output contains one continuous subpart of the input.
  13398. It accepts the following parameters:
  13399. @table @option
  13400. @item start
  13401. Specify the time of the start of the kept section, i.e. the frame with the
  13402. timestamp @var{start} will be the first frame in the output.
  13403. @item end
  13404. Specify the time of the first frame that will be dropped, i.e. the frame
  13405. immediately preceding the one with the timestamp @var{end} will be the last
  13406. frame in the output.
  13407. @item start_pts
  13408. This is the same as @var{start}, except this option sets the start timestamp
  13409. in timebase units instead of seconds.
  13410. @item end_pts
  13411. This is the same as @var{end}, except this option sets the end timestamp
  13412. in timebase units instead of seconds.
  13413. @item duration
  13414. The maximum duration of the output in seconds.
  13415. @item start_frame
  13416. The number of the first frame that should be passed to the output.
  13417. @item end_frame
  13418. The number of the first frame that should be dropped.
  13419. @end table
  13420. @option{start}, @option{end}, and @option{duration} are expressed as time
  13421. duration specifications; see
  13422. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13423. for the accepted syntax.
  13424. Note that the first two sets of the start/end options and the @option{duration}
  13425. option look at the frame timestamp, while the _frame variants simply count the
  13426. frames that pass through the filter. Also note that this filter does not modify
  13427. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13428. setpts filter after the trim filter.
  13429. If multiple start or end options are set, this filter tries to be greedy and
  13430. keep all the frames that match at least one of the specified constraints. To keep
  13431. only the part that matches all the constraints at once, chain multiple trim
  13432. filters.
  13433. The defaults are such that all the input is kept. So it is possible to set e.g.
  13434. just the end values to keep everything before the specified time.
  13435. Examples:
  13436. @itemize
  13437. @item
  13438. Drop everything except the second minute of input:
  13439. @example
  13440. ffmpeg -i INPUT -vf trim=60:120
  13441. @end example
  13442. @item
  13443. Keep only the first second:
  13444. @example
  13445. ffmpeg -i INPUT -vf trim=duration=1
  13446. @end example
  13447. @end itemize
  13448. @section unpremultiply
  13449. Apply alpha unpremultiply effect to input video stream using first plane
  13450. of second stream as alpha.
  13451. Both streams must have same dimensions and same pixel format.
  13452. The filter accepts the following option:
  13453. @table @option
  13454. @item planes
  13455. Set which planes will be processed, unprocessed planes will be copied.
  13456. By default value 0xf, all planes will be processed.
  13457. If the format has 1 or 2 components, then luma is bit 0.
  13458. If the format has 3 or 4 components:
  13459. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13460. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13461. If present, the alpha channel is always the last bit.
  13462. @item inplace
  13463. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13464. @end table
  13465. @anchor{unsharp}
  13466. @section unsharp
  13467. Sharpen or blur the input video.
  13468. It accepts the following parameters:
  13469. @table @option
  13470. @item luma_msize_x, lx
  13471. Set the luma matrix horizontal size. It must be an odd integer between
  13472. 3 and 23. The default value is 5.
  13473. @item luma_msize_y, ly
  13474. Set the luma matrix vertical size. It must be an odd integer between 3
  13475. and 23. The default value is 5.
  13476. @item luma_amount, la
  13477. Set the luma effect strength. It must be a floating point number, reasonable
  13478. values lay between -1.5 and 1.5.
  13479. Negative values will blur the input video, while positive values will
  13480. sharpen it, a value of zero will disable the effect.
  13481. Default value is 1.0.
  13482. @item chroma_msize_x, cx
  13483. Set the chroma matrix horizontal size. It must be an odd integer
  13484. between 3 and 23. The default value is 5.
  13485. @item chroma_msize_y, cy
  13486. Set the chroma matrix vertical size. It must be an odd integer
  13487. between 3 and 23. The default value is 5.
  13488. @item chroma_amount, ca
  13489. Set the chroma effect strength. It must be a floating point number, reasonable
  13490. values lay between -1.5 and 1.5.
  13491. Negative values will blur the input video, while positive values will
  13492. sharpen it, a value of zero will disable the effect.
  13493. Default value is 0.0.
  13494. @end table
  13495. All parameters are optional and default to the equivalent of the
  13496. string '5:5:1.0:5:5:0.0'.
  13497. @subsection Examples
  13498. @itemize
  13499. @item
  13500. Apply strong luma sharpen effect:
  13501. @example
  13502. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13503. @end example
  13504. @item
  13505. Apply a strong blur of both luma and chroma parameters:
  13506. @example
  13507. unsharp=7:7:-2:7:7:-2
  13508. @end example
  13509. @end itemize
  13510. @section uspp
  13511. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13512. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13513. shifts and average the results.
  13514. The way this differs from the behavior of spp is that uspp actually encodes &
  13515. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13516. DCT similar to MJPEG.
  13517. The filter accepts the following options:
  13518. @table @option
  13519. @item quality
  13520. Set quality. This option defines the number of levels for averaging. It accepts
  13521. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13522. effect. A value of @code{8} means the higher quality. For each increment of
  13523. that value the speed drops by a factor of approximately 2. Default value is
  13524. @code{3}.
  13525. @item qp
  13526. Force a constant quantization parameter. If not set, the filter will use the QP
  13527. from the video stream (if available).
  13528. @end table
  13529. @section vaguedenoiser
  13530. Apply a wavelet based denoiser.
  13531. It transforms each frame from the video input into the wavelet domain,
  13532. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13533. the obtained coefficients. It does an inverse wavelet transform after.
  13534. Due to wavelet properties, it should give a nice smoothed result, and
  13535. reduced noise, without blurring picture features.
  13536. This filter accepts the following options:
  13537. @table @option
  13538. @item threshold
  13539. The filtering strength. The higher, the more filtered the video will be.
  13540. Hard thresholding can use a higher threshold than soft thresholding
  13541. before the video looks overfiltered. Default value is 2.
  13542. @item method
  13543. The filtering method the filter will use.
  13544. It accepts the following values:
  13545. @table @samp
  13546. @item hard
  13547. All values under the threshold will be zeroed.
  13548. @item soft
  13549. All values under the threshold will be zeroed. All values above will be
  13550. reduced by the threshold.
  13551. @item garrote
  13552. Scales or nullifies coefficients - intermediary between (more) soft and
  13553. (less) hard thresholding.
  13554. @end table
  13555. Default is garrote.
  13556. @item nsteps
  13557. Number of times, the wavelet will decompose the picture. Picture can't
  13558. be decomposed beyond a particular point (typically, 8 for a 640x480
  13559. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13560. @item percent
  13561. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13562. @item planes
  13563. A list of the planes to process. By default all planes are processed.
  13564. @end table
  13565. @section vectorscope
  13566. Display 2 color component values in the two dimensional graph (which is called
  13567. a vectorscope).
  13568. This filter accepts the following options:
  13569. @table @option
  13570. @item mode, m
  13571. Set vectorscope mode.
  13572. It accepts the following values:
  13573. @table @samp
  13574. @item gray
  13575. Gray values are displayed on graph, higher brightness means more pixels have
  13576. same component color value on location in graph. This is the default mode.
  13577. @item color
  13578. Gray values are displayed on graph. Surrounding pixels values which are not
  13579. present in video frame are drawn in gradient of 2 color components which are
  13580. set by option @code{x} and @code{y}. The 3rd color component is static.
  13581. @item color2
  13582. Actual color components values present in video frame are displayed on graph.
  13583. @item color3
  13584. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13585. on graph increases value of another color component, which is luminance by
  13586. default values of @code{x} and @code{y}.
  13587. @item color4
  13588. Actual colors present in video frame are displayed on graph. If two different
  13589. colors map to same position on graph then color with higher value of component
  13590. not present in graph is picked.
  13591. @item color5
  13592. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13593. component picked from radial gradient.
  13594. @end table
  13595. @item x
  13596. Set which color component will be represented on X-axis. Default is @code{1}.
  13597. @item y
  13598. Set which color component will be represented on Y-axis. Default is @code{2}.
  13599. @item intensity, i
  13600. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13601. of color component which represents frequency of (X, Y) location in graph.
  13602. @item envelope, e
  13603. @table @samp
  13604. @item none
  13605. No envelope, this is default.
  13606. @item instant
  13607. Instant envelope, even darkest single pixel will be clearly highlighted.
  13608. @item peak
  13609. Hold maximum and minimum values presented in graph over time. This way you
  13610. can still spot out of range values without constantly looking at vectorscope.
  13611. @item peak+instant
  13612. Peak and instant envelope combined together.
  13613. @end table
  13614. @item graticule, g
  13615. Set what kind of graticule to draw.
  13616. @table @samp
  13617. @item none
  13618. @item green
  13619. @item color
  13620. @end table
  13621. @item opacity, o
  13622. Set graticule opacity.
  13623. @item flags, f
  13624. Set graticule flags.
  13625. @table @samp
  13626. @item white
  13627. Draw graticule for white point.
  13628. @item black
  13629. Draw graticule for black point.
  13630. @item name
  13631. Draw color points short names.
  13632. @end table
  13633. @item bgopacity, b
  13634. Set background opacity.
  13635. @item lthreshold, l
  13636. Set low threshold for color component not represented on X or Y axis.
  13637. Values lower than this value will be ignored. Default is 0.
  13638. Note this value is multiplied with actual max possible value one pixel component
  13639. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13640. is 0.1 * 255 = 25.
  13641. @item hthreshold, h
  13642. Set high threshold for color component not represented on X or Y axis.
  13643. Values higher than this value will be ignored. Default is 1.
  13644. Note this value is multiplied with actual max possible value one pixel component
  13645. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13646. is 0.9 * 255 = 230.
  13647. @item colorspace, c
  13648. Set what kind of colorspace to use when drawing graticule.
  13649. @table @samp
  13650. @item auto
  13651. @item 601
  13652. @item 709
  13653. @end table
  13654. Default is auto.
  13655. @end table
  13656. @anchor{vidstabdetect}
  13657. @section vidstabdetect
  13658. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13659. @ref{vidstabtransform} for pass 2.
  13660. This filter generates a file with relative translation and rotation
  13661. transform information about subsequent frames, which is then used by
  13662. the @ref{vidstabtransform} filter.
  13663. To enable compilation of this filter you need to configure FFmpeg with
  13664. @code{--enable-libvidstab}.
  13665. This filter accepts the following options:
  13666. @table @option
  13667. @item result
  13668. Set the path to the file used to write the transforms information.
  13669. Default value is @file{transforms.trf}.
  13670. @item shakiness
  13671. Set how shaky the video is and how quick the camera is. It accepts an
  13672. integer in the range 1-10, a value of 1 means little shakiness, a
  13673. value of 10 means strong shakiness. Default value is 5.
  13674. @item accuracy
  13675. Set the accuracy of the detection process. It must be a value in the
  13676. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13677. accuracy. Default value is 15.
  13678. @item stepsize
  13679. Set stepsize of the search process. The region around minimum is
  13680. scanned with 1 pixel resolution. Default value is 6.
  13681. @item mincontrast
  13682. Set minimum contrast. Below this value a local measurement field is
  13683. discarded. Must be a floating point value in the range 0-1. Default
  13684. value is 0.3.
  13685. @item tripod
  13686. Set reference frame number for tripod mode.
  13687. If enabled, the motion of the frames is compared to a reference frame
  13688. in the filtered stream, identified by the specified number. The idea
  13689. is to compensate all movements in a more-or-less static scene and keep
  13690. the camera view absolutely still.
  13691. If set to 0, it is disabled. The frames are counted starting from 1.
  13692. @item show
  13693. Show fields and transforms in the resulting frames. It accepts an
  13694. integer in the range 0-2. Default value is 0, which disables any
  13695. visualization.
  13696. @end table
  13697. @subsection Examples
  13698. @itemize
  13699. @item
  13700. Use default values:
  13701. @example
  13702. vidstabdetect
  13703. @end example
  13704. @item
  13705. Analyze strongly shaky movie and put the results in file
  13706. @file{mytransforms.trf}:
  13707. @example
  13708. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13709. @end example
  13710. @item
  13711. Visualize the result of internal transformations in the resulting
  13712. video:
  13713. @example
  13714. vidstabdetect=show=1
  13715. @end example
  13716. @item
  13717. Analyze a video with medium shakiness using @command{ffmpeg}:
  13718. @example
  13719. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13720. @end example
  13721. @end itemize
  13722. @anchor{vidstabtransform}
  13723. @section vidstabtransform
  13724. Video stabilization/deshaking: pass 2 of 2,
  13725. see @ref{vidstabdetect} for pass 1.
  13726. Read a file with transform information for each frame and
  13727. apply/compensate them. Together with the @ref{vidstabdetect}
  13728. filter this can be used to deshake videos. See also
  13729. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13730. the @ref{unsharp} filter, see below.
  13731. To enable compilation of this filter you need to configure FFmpeg with
  13732. @code{--enable-libvidstab}.
  13733. @subsection Options
  13734. @table @option
  13735. @item input
  13736. Set path to the file used to read the transforms. Default value is
  13737. @file{transforms.trf}.
  13738. @item smoothing
  13739. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13740. camera movements. Default value is 10.
  13741. For example a number of 10 means that 21 frames are used (10 in the
  13742. past and 10 in the future) to smoothen the motion in the video. A
  13743. larger value leads to a smoother video, but limits the acceleration of
  13744. the camera (pan/tilt movements). 0 is a special case where a static
  13745. camera is simulated.
  13746. @item optalgo
  13747. Set the camera path optimization algorithm.
  13748. Accepted values are:
  13749. @table @samp
  13750. @item gauss
  13751. gaussian kernel low-pass filter on camera motion (default)
  13752. @item avg
  13753. averaging on transformations
  13754. @end table
  13755. @item maxshift
  13756. Set maximal number of pixels to translate frames. Default value is -1,
  13757. meaning no limit.
  13758. @item maxangle
  13759. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13760. value is -1, meaning no limit.
  13761. @item crop
  13762. Specify how to deal with borders that may be visible due to movement
  13763. compensation.
  13764. Available values are:
  13765. @table @samp
  13766. @item keep
  13767. keep image information from previous frame (default)
  13768. @item black
  13769. fill the border black
  13770. @end table
  13771. @item invert
  13772. Invert transforms if set to 1. Default value is 0.
  13773. @item relative
  13774. Consider transforms as relative to previous frame if set to 1,
  13775. absolute if set to 0. Default value is 0.
  13776. @item zoom
  13777. Set percentage to zoom. A positive value will result in a zoom-in
  13778. effect, a negative value in a zoom-out effect. Default value is 0 (no
  13779. zoom).
  13780. @item optzoom
  13781. Set optimal zooming to avoid borders.
  13782. Accepted values are:
  13783. @table @samp
  13784. @item 0
  13785. disabled
  13786. @item 1
  13787. optimal static zoom value is determined (only very strong movements
  13788. will lead to visible borders) (default)
  13789. @item 2
  13790. optimal adaptive zoom value is determined (no borders will be
  13791. visible), see @option{zoomspeed}
  13792. @end table
  13793. Note that the value given at zoom is added to the one calculated here.
  13794. @item zoomspeed
  13795. Set percent to zoom maximally each frame (enabled when
  13796. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  13797. 0.25.
  13798. @item interpol
  13799. Specify type of interpolation.
  13800. Available values are:
  13801. @table @samp
  13802. @item no
  13803. no interpolation
  13804. @item linear
  13805. linear only horizontal
  13806. @item bilinear
  13807. linear in both directions (default)
  13808. @item bicubic
  13809. cubic in both directions (slow)
  13810. @end table
  13811. @item tripod
  13812. Enable virtual tripod mode if set to 1, which is equivalent to
  13813. @code{relative=0:smoothing=0}. Default value is 0.
  13814. Use also @code{tripod} option of @ref{vidstabdetect}.
  13815. @item debug
  13816. Increase log verbosity if set to 1. Also the detected global motions
  13817. are written to the temporary file @file{global_motions.trf}. Default
  13818. value is 0.
  13819. @end table
  13820. @subsection Examples
  13821. @itemize
  13822. @item
  13823. Use @command{ffmpeg} for a typical stabilization with default values:
  13824. @example
  13825. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13826. @end example
  13827. Note the use of the @ref{unsharp} filter which is always recommended.
  13828. @item
  13829. Zoom in a bit more and load transform data from a given file:
  13830. @example
  13831. vidstabtransform=zoom=5:input="mytransforms.trf"
  13832. @end example
  13833. @item
  13834. Smoothen the video even more:
  13835. @example
  13836. vidstabtransform=smoothing=30
  13837. @end example
  13838. @end itemize
  13839. @section vflip
  13840. Flip the input video vertically.
  13841. For example, to vertically flip a video with @command{ffmpeg}:
  13842. @example
  13843. ffmpeg -i in.avi -vf "vflip" out.avi
  13844. @end example
  13845. @section vfrdet
  13846. Detect variable frame rate video.
  13847. This filter tries to detect if the input is variable or constant frame rate.
  13848. At end it will output number of frames detected as having variable delta pts,
  13849. and ones with constant delta pts.
  13850. If there was frames with variable delta, than it will also show min and max delta
  13851. encountered.
  13852. @section vibrance
  13853. Boost or alter saturation.
  13854. The filter accepts the following options:
  13855. @table @option
  13856. @item intensity
  13857. Set strength of boost if positive value or strength of alter if negative value.
  13858. Default is 0. Allowed range is from -2 to 2.
  13859. @item rbal
  13860. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  13861. @item gbal
  13862. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  13863. @item bbal
  13864. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  13865. @item rlum
  13866. Set the red luma coefficient.
  13867. @item glum
  13868. Set the green luma coefficient.
  13869. @item blum
  13870. Set the blue luma coefficient.
  13871. @item alternate
  13872. If @code{intensity} is negative and this is set to 1, colors will change,
  13873. otherwise colors will be less saturated, more towards gray.
  13874. @end table
  13875. @anchor{vignette}
  13876. @section vignette
  13877. Make or reverse a natural vignetting effect.
  13878. The filter accepts the following options:
  13879. @table @option
  13880. @item angle, a
  13881. Set lens angle expression as a number of radians.
  13882. The value is clipped in the @code{[0,PI/2]} range.
  13883. Default value: @code{"PI/5"}
  13884. @item x0
  13885. @item y0
  13886. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13887. by default.
  13888. @item mode
  13889. Set forward/backward mode.
  13890. Available modes are:
  13891. @table @samp
  13892. @item forward
  13893. The larger the distance from the central point, the darker the image becomes.
  13894. @item backward
  13895. The larger the distance from the central point, the brighter the image becomes.
  13896. This can be used to reverse a vignette effect, though there is no automatic
  13897. detection to extract the lens @option{angle} and other settings (yet). It can
  13898. also be used to create a burning effect.
  13899. @end table
  13900. Default value is @samp{forward}.
  13901. @item eval
  13902. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13903. It accepts the following values:
  13904. @table @samp
  13905. @item init
  13906. Evaluate expressions only once during the filter initialization.
  13907. @item frame
  13908. Evaluate expressions for each incoming frame. This is way slower than the
  13909. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13910. allows advanced dynamic expressions.
  13911. @end table
  13912. Default value is @samp{init}.
  13913. @item dither
  13914. Set dithering to reduce the circular banding effects. Default is @code{1}
  13915. (enabled).
  13916. @item aspect
  13917. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13918. Setting this value to the SAR of the input will make a rectangular vignetting
  13919. following the dimensions of the video.
  13920. Default is @code{1/1}.
  13921. @end table
  13922. @subsection Expressions
  13923. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13924. following parameters.
  13925. @table @option
  13926. @item w
  13927. @item h
  13928. input width and height
  13929. @item n
  13930. the number of input frame, starting from 0
  13931. @item pts
  13932. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13933. @var{TB} units, NAN if undefined
  13934. @item r
  13935. frame rate of the input video, NAN if the input frame rate is unknown
  13936. @item t
  13937. the PTS (Presentation TimeStamp) of the filtered video frame,
  13938. expressed in seconds, NAN if undefined
  13939. @item tb
  13940. time base of the input video
  13941. @end table
  13942. @subsection Examples
  13943. @itemize
  13944. @item
  13945. Apply simple strong vignetting effect:
  13946. @example
  13947. vignette=PI/4
  13948. @end example
  13949. @item
  13950. Make a flickering vignetting:
  13951. @example
  13952. vignette='PI/4+random(1)*PI/50':eval=frame
  13953. @end example
  13954. @end itemize
  13955. @section vmafmotion
  13956. Obtain the average vmaf motion score of a video.
  13957. It is one of the component filters of VMAF.
  13958. The obtained average motion score is printed through the logging system.
  13959. In the below example the input file @file{ref.mpg} is being processed and score
  13960. is computed.
  13961. @example
  13962. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  13963. @end example
  13964. @section vstack
  13965. Stack input videos vertically.
  13966. All streams must be of same pixel format and of same width.
  13967. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  13968. to create same output.
  13969. The filter accept the following option:
  13970. @table @option
  13971. @item inputs
  13972. Set number of input streams. Default is 2.
  13973. @item shortest
  13974. If set to 1, force the output to terminate when the shortest input
  13975. terminates. Default value is 0.
  13976. @end table
  13977. @section w3fdif
  13978. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  13979. Deinterlacing Filter").
  13980. Based on the process described by Martin Weston for BBC R&D, and
  13981. implemented based on the de-interlace algorithm written by Jim
  13982. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  13983. uses filter coefficients calculated by BBC R&D.
  13984. This filter use field-dominance information in frame to decide which
  13985. of each pair of fields to place first in the output.
  13986. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  13987. There are two sets of filter coefficients, so called "simple":
  13988. and "complex". Which set of filter coefficients is used can
  13989. be set by passing an optional parameter:
  13990. @table @option
  13991. @item filter
  13992. Set the interlacing filter coefficients. Accepts one of the following values:
  13993. @table @samp
  13994. @item simple
  13995. Simple filter coefficient set.
  13996. @item complex
  13997. More-complex filter coefficient set.
  13998. @end table
  13999. Default value is @samp{complex}.
  14000. @item deint
  14001. Specify which frames to deinterlace. Accept one of the following values:
  14002. @table @samp
  14003. @item all
  14004. Deinterlace all frames,
  14005. @item interlaced
  14006. Only deinterlace frames marked as interlaced.
  14007. @end table
  14008. Default value is @samp{all}.
  14009. @end table
  14010. @section waveform
  14011. Video waveform monitor.
  14012. The waveform monitor plots color component intensity. By default luminance
  14013. only. Each column of the waveform corresponds to a column of pixels in the
  14014. source video.
  14015. It accepts the following options:
  14016. @table @option
  14017. @item mode, m
  14018. Can be either @code{row}, or @code{column}. Default is @code{column}.
  14019. In row mode, the graph on the left side represents color component value 0 and
  14020. the right side represents value = 255. In column mode, the top side represents
  14021. color component value = 0 and bottom side represents value = 255.
  14022. @item intensity, i
  14023. Set intensity. Smaller values are useful to find out how many values of the same
  14024. luminance are distributed across input rows/columns.
  14025. Default value is @code{0.04}. Allowed range is [0, 1].
  14026. @item mirror, r
  14027. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  14028. In mirrored mode, higher values will be represented on the left
  14029. side for @code{row} mode and at the top for @code{column} mode. Default is
  14030. @code{1} (mirrored).
  14031. @item display, d
  14032. Set display mode.
  14033. It accepts the following values:
  14034. @table @samp
  14035. @item overlay
  14036. Presents information identical to that in the @code{parade}, except
  14037. that the graphs representing color components are superimposed directly
  14038. over one another.
  14039. This display mode makes it easier to spot relative differences or similarities
  14040. in overlapping areas of the color components that are supposed to be identical,
  14041. such as neutral whites, grays, or blacks.
  14042. @item stack
  14043. Display separate graph for the color components side by side in
  14044. @code{row} mode or one below the other in @code{column} mode.
  14045. @item parade
  14046. Display separate graph for the color components side by side in
  14047. @code{column} mode or one below the other in @code{row} mode.
  14048. Using this display mode makes it easy to spot color casts in the highlights
  14049. and shadows of an image, by comparing the contours of the top and the bottom
  14050. graphs of each waveform. Since whites, grays, and blacks are characterized
  14051. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  14052. should display three waveforms of roughly equal width/height. If not, the
  14053. correction is easy to perform by making level adjustments the three waveforms.
  14054. @end table
  14055. Default is @code{stack}.
  14056. @item components, c
  14057. Set which color components to display. Default is 1, which means only luminance
  14058. or red color component if input is in RGB colorspace. If is set for example to
  14059. 7 it will display all 3 (if) available color components.
  14060. @item envelope, e
  14061. @table @samp
  14062. @item none
  14063. No envelope, this is default.
  14064. @item instant
  14065. Instant envelope, minimum and maximum values presented in graph will be easily
  14066. visible even with small @code{step} value.
  14067. @item peak
  14068. Hold minimum and maximum values presented in graph across time. This way you
  14069. can still spot out of range values without constantly looking at waveforms.
  14070. @item peak+instant
  14071. Peak and instant envelope combined together.
  14072. @end table
  14073. @item filter, f
  14074. @table @samp
  14075. @item lowpass
  14076. No filtering, this is default.
  14077. @item flat
  14078. Luma and chroma combined together.
  14079. @item aflat
  14080. Similar as above, but shows difference between blue and red chroma.
  14081. @item xflat
  14082. Similar as above, but use different colors.
  14083. @item chroma
  14084. Displays only chroma.
  14085. @item color
  14086. Displays actual color value on waveform.
  14087. @item acolor
  14088. Similar as above, but with luma showing frequency of chroma values.
  14089. @end table
  14090. @item graticule, g
  14091. Set which graticule to display.
  14092. @table @samp
  14093. @item none
  14094. Do not display graticule.
  14095. @item green
  14096. Display green graticule showing legal broadcast ranges.
  14097. @item orange
  14098. Display orange graticule showing legal broadcast ranges.
  14099. @end table
  14100. @item opacity, o
  14101. Set graticule opacity.
  14102. @item flags, fl
  14103. Set graticule flags.
  14104. @table @samp
  14105. @item numbers
  14106. Draw numbers above lines. By default enabled.
  14107. @item dots
  14108. Draw dots instead of lines.
  14109. @end table
  14110. @item scale, s
  14111. Set scale used for displaying graticule.
  14112. @table @samp
  14113. @item digital
  14114. @item millivolts
  14115. @item ire
  14116. @end table
  14117. Default is digital.
  14118. @item bgopacity, b
  14119. Set background opacity.
  14120. @end table
  14121. @section weave, doubleweave
  14122. The @code{weave} takes a field-based video input and join
  14123. each two sequential fields into single frame, producing a new double
  14124. height clip with half the frame rate and half the frame count.
  14125. The @code{doubleweave} works same as @code{weave} but without
  14126. halving frame rate and frame count.
  14127. It accepts the following option:
  14128. @table @option
  14129. @item first_field
  14130. Set first field. Available values are:
  14131. @table @samp
  14132. @item top, t
  14133. Set the frame as top-field-first.
  14134. @item bottom, b
  14135. Set the frame as bottom-field-first.
  14136. @end table
  14137. @end table
  14138. @subsection Examples
  14139. @itemize
  14140. @item
  14141. Interlace video using @ref{select} and @ref{separatefields} filter:
  14142. @example
  14143. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  14144. @end example
  14145. @end itemize
  14146. @section xbr
  14147. Apply the xBR high-quality magnification filter which is designed for pixel
  14148. art. It follows a set of edge-detection rules, see
  14149. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  14150. It accepts the following option:
  14151. @table @option
  14152. @item n
  14153. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  14154. @code{3xBR} and @code{4} for @code{4xBR}.
  14155. Default is @code{3}.
  14156. @end table
  14157. @section xmedian
  14158. Pick median pixels from several input videos.
  14159. The filter accept the following options:
  14160. @table @option
  14161. @item inputs
  14162. Set number of inputs.
  14163. Default is 3. Allowed range is from 3 to 255.
  14164. If number of inputs is even number, than result will be mean value between two median values.
  14165. @item planes
  14166. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14167. @end table
  14168. @section xstack
  14169. Stack video inputs into custom layout.
  14170. All streams must be of same pixel format.
  14171. The filter accept the following option:
  14172. @table @option
  14173. @item inputs
  14174. Set number of input streams. Default is 2.
  14175. @item layout
  14176. Specify layout of inputs.
  14177. This option requires the desired layout configuration to be explicitly set by the user.
  14178. This sets position of each video input in output. Each input
  14179. is separated by '|'.
  14180. The first number represents the column, and the second number represents the row.
  14181. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  14182. where X is video input from which to take width or height.
  14183. Multiple values can be used when separated by '+'. In such
  14184. case values are summed together.
  14185. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  14186. a layout must be set by the user.
  14187. @item shortest
  14188. If set to 1, force the output to terminate when the shortest input
  14189. terminates. Default value is 0.
  14190. @end table
  14191. @subsection Examples
  14192. @itemize
  14193. @item
  14194. Display 4 inputs into 2x2 grid,
  14195. note that if inputs are of different sizes unused gaps might appear,
  14196. as not all of output video is used.
  14197. @example
  14198. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  14199. @end example
  14200. @item
  14201. Display 4 inputs into 1x4 grid,
  14202. note that if inputs are of different sizes unused gaps might appear,
  14203. as not all of output video is used.
  14204. @example
  14205. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  14206. @end example
  14207. @item
  14208. Display 9 inputs into 3x3 grid,
  14209. note that if inputs are of different sizes unused gaps might appear,
  14210. as not all of output video is used.
  14211. @example
  14212. xstack=inputs=9:layout=w3_0|w3_h0+h2|w3_h0|0_h4|0_0|w3+w1_0|0_h1+h2|w3+w1_h0|w3+w1_h1+h2
  14213. @end example
  14214. @end itemize
  14215. @anchor{yadif}
  14216. @section yadif
  14217. Deinterlace the input video ("yadif" means "yet another deinterlacing
  14218. filter").
  14219. It accepts the following parameters:
  14220. @table @option
  14221. @item mode
  14222. The interlacing mode to adopt. It accepts one of the following values:
  14223. @table @option
  14224. @item 0, send_frame
  14225. Output one frame for each frame.
  14226. @item 1, send_field
  14227. Output one frame for each field.
  14228. @item 2, send_frame_nospatial
  14229. Like @code{send_frame}, but it skips the spatial interlacing check.
  14230. @item 3, send_field_nospatial
  14231. Like @code{send_field}, but it skips the spatial interlacing check.
  14232. @end table
  14233. The default value is @code{send_frame}.
  14234. @item parity
  14235. The picture field parity assumed for the input interlaced video. It accepts one
  14236. of the following values:
  14237. @table @option
  14238. @item 0, tff
  14239. Assume the top field is first.
  14240. @item 1, bff
  14241. Assume the bottom field is first.
  14242. @item -1, auto
  14243. Enable automatic detection of field parity.
  14244. @end table
  14245. The default value is @code{auto}.
  14246. If the interlacing is unknown or the decoder does not export this information,
  14247. top field first will be assumed.
  14248. @item deint
  14249. Specify which frames to deinterlace. Accept one of the following
  14250. values:
  14251. @table @option
  14252. @item 0, all
  14253. Deinterlace all frames.
  14254. @item 1, interlaced
  14255. Only deinterlace frames marked as interlaced.
  14256. @end table
  14257. The default value is @code{all}.
  14258. @end table
  14259. @section yadif_cuda
  14260. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  14261. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  14262. and/or nvenc.
  14263. It accepts the following parameters:
  14264. @table @option
  14265. @item mode
  14266. The interlacing mode to adopt. It accepts one of the following values:
  14267. @table @option
  14268. @item 0, send_frame
  14269. Output one frame for each frame.
  14270. @item 1, send_field
  14271. Output one frame for each field.
  14272. @item 2, send_frame_nospatial
  14273. Like @code{send_frame}, but it skips the spatial interlacing check.
  14274. @item 3, send_field_nospatial
  14275. Like @code{send_field}, but it skips the spatial interlacing check.
  14276. @end table
  14277. The default value is @code{send_frame}.
  14278. @item parity
  14279. The picture field parity assumed for the input interlaced video. It accepts one
  14280. of the following values:
  14281. @table @option
  14282. @item 0, tff
  14283. Assume the top field is first.
  14284. @item 1, bff
  14285. Assume the bottom field is first.
  14286. @item -1, auto
  14287. Enable automatic detection of field parity.
  14288. @end table
  14289. The default value is @code{auto}.
  14290. If the interlacing is unknown or the decoder does not export this information,
  14291. top field first will be assumed.
  14292. @item deint
  14293. Specify which frames to deinterlace. Accept one of the following
  14294. values:
  14295. @table @option
  14296. @item 0, all
  14297. Deinterlace all frames.
  14298. @item 1, interlaced
  14299. Only deinterlace frames marked as interlaced.
  14300. @end table
  14301. The default value is @code{all}.
  14302. @end table
  14303. @section zoompan
  14304. Apply Zoom & Pan effect.
  14305. This filter accepts the following options:
  14306. @table @option
  14307. @item zoom, z
  14308. Set the zoom expression. Range is 1-10. Default is 1.
  14309. @item x
  14310. @item y
  14311. Set the x and y expression. Default is 0.
  14312. @item d
  14313. Set the duration expression in number of frames.
  14314. This sets for how many number of frames effect will last for
  14315. single input image.
  14316. @item s
  14317. Set the output image size, default is 'hd720'.
  14318. @item fps
  14319. Set the output frame rate, default is '25'.
  14320. @end table
  14321. Each expression can contain the following constants:
  14322. @table @option
  14323. @item in_w, iw
  14324. Input width.
  14325. @item in_h, ih
  14326. Input height.
  14327. @item out_w, ow
  14328. Output width.
  14329. @item out_h, oh
  14330. Output height.
  14331. @item in
  14332. Input frame count.
  14333. @item on
  14334. Output frame count.
  14335. @item x
  14336. @item y
  14337. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14338. for current input frame.
  14339. @item px
  14340. @item py
  14341. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14342. not yet such frame (first input frame).
  14343. @item zoom
  14344. Last calculated zoom from 'z' expression for current input frame.
  14345. @item pzoom
  14346. Last calculated zoom of last output frame of previous input frame.
  14347. @item duration
  14348. Number of output frames for current input frame. Calculated from 'd' expression
  14349. for each input frame.
  14350. @item pduration
  14351. number of output frames created for previous input frame
  14352. @item a
  14353. Rational number: input width / input height
  14354. @item sar
  14355. sample aspect ratio
  14356. @item dar
  14357. display aspect ratio
  14358. @end table
  14359. @subsection Examples
  14360. @itemize
  14361. @item
  14362. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14363. @example
  14364. 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
  14365. @end example
  14366. @item
  14367. Zoom-in up to 1.5 and pan always at center of picture:
  14368. @example
  14369. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14370. @end example
  14371. @item
  14372. Same as above but without pausing:
  14373. @example
  14374. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14375. @end example
  14376. @end itemize
  14377. @anchor{zscale}
  14378. @section zscale
  14379. Scale (resize) the input video, using the z.lib library:
  14380. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14381. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14382. The zscale filter forces the output display aspect ratio to be the same
  14383. as the input, by changing the output sample aspect ratio.
  14384. If the input image format is different from the format requested by
  14385. the next filter, the zscale filter will convert the input to the
  14386. requested format.
  14387. @subsection Options
  14388. The filter accepts the following options.
  14389. @table @option
  14390. @item width, w
  14391. @item height, h
  14392. Set the output video dimension expression. Default value is the input
  14393. dimension.
  14394. If the @var{width} or @var{w} value is 0, the input width is used for
  14395. the output. If the @var{height} or @var{h} value is 0, the input height
  14396. is used for the output.
  14397. If one and only one of the values is -n with n >= 1, the zscale filter
  14398. will use a value that maintains the aspect ratio of the input image,
  14399. calculated from the other specified dimension. After that it will,
  14400. however, make sure that the calculated dimension is divisible by n and
  14401. adjust the value if necessary.
  14402. If both values are -n with n >= 1, the behavior will be identical to
  14403. both values being set to 0 as previously detailed.
  14404. See below for the list of accepted constants for use in the dimension
  14405. expression.
  14406. @item size, s
  14407. Set the video size. For the syntax of this option, check the
  14408. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14409. @item dither, d
  14410. Set the dither type.
  14411. Possible values are:
  14412. @table @var
  14413. @item none
  14414. @item ordered
  14415. @item random
  14416. @item error_diffusion
  14417. @end table
  14418. Default is none.
  14419. @item filter, f
  14420. Set the resize filter type.
  14421. Possible values are:
  14422. @table @var
  14423. @item point
  14424. @item bilinear
  14425. @item bicubic
  14426. @item spline16
  14427. @item spline36
  14428. @item lanczos
  14429. @end table
  14430. Default is bilinear.
  14431. @item range, r
  14432. Set the color range.
  14433. Possible values are:
  14434. @table @var
  14435. @item input
  14436. @item limited
  14437. @item full
  14438. @end table
  14439. Default is same as input.
  14440. @item primaries, p
  14441. Set the color primaries.
  14442. Possible values are:
  14443. @table @var
  14444. @item input
  14445. @item 709
  14446. @item unspecified
  14447. @item 170m
  14448. @item 240m
  14449. @item 2020
  14450. @end table
  14451. Default is same as input.
  14452. @item transfer, t
  14453. Set the transfer characteristics.
  14454. Possible values are:
  14455. @table @var
  14456. @item input
  14457. @item 709
  14458. @item unspecified
  14459. @item 601
  14460. @item linear
  14461. @item 2020_10
  14462. @item 2020_12
  14463. @item smpte2084
  14464. @item iec61966-2-1
  14465. @item arib-std-b67
  14466. @end table
  14467. Default is same as input.
  14468. @item matrix, m
  14469. Set the colorspace matrix.
  14470. Possible value are:
  14471. @table @var
  14472. @item input
  14473. @item 709
  14474. @item unspecified
  14475. @item 470bg
  14476. @item 170m
  14477. @item 2020_ncl
  14478. @item 2020_cl
  14479. @end table
  14480. Default is same as input.
  14481. @item rangein, rin
  14482. Set the input color range.
  14483. Possible values are:
  14484. @table @var
  14485. @item input
  14486. @item limited
  14487. @item full
  14488. @end table
  14489. Default is same as input.
  14490. @item primariesin, pin
  14491. Set the input color primaries.
  14492. Possible values are:
  14493. @table @var
  14494. @item input
  14495. @item 709
  14496. @item unspecified
  14497. @item 170m
  14498. @item 240m
  14499. @item 2020
  14500. @end table
  14501. Default is same as input.
  14502. @item transferin, tin
  14503. Set the input transfer characteristics.
  14504. Possible values are:
  14505. @table @var
  14506. @item input
  14507. @item 709
  14508. @item unspecified
  14509. @item 601
  14510. @item linear
  14511. @item 2020_10
  14512. @item 2020_12
  14513. @end table
  14514. Default is same as input.
  14515. @item matrixin, min
  14516. Set the input colorspace matrix.
  14517. Possible value are:
  14518. @table @var
  14519. @item input
  14520. @item 709
  14521. @item unspecified
  14522. @item 470bg
  14523. @item 170m
  14524. @item 2020_ncl
  14525. @item 2020_cl
  14526. @end table
  14527. @item chromal, c
  14528. Set the output chroma location.
  14529. Possible values are:
  14530. @table @var
  14531. @item input
  14532. @item left
  14533. @item center
  14534. @item topleft
  14535. @item top
  14536. @item bottomleft
  14537. @item bottom
  14538. @end table
  14539. @item chromalin, cin
  14540. Set the input chroma location.
  14541. Possible values are:
  14542. @table @var
  14543. @item input
  14544. @item left
  14545. @item center
  14546. @item topleft
  14547. @item top
  14548. @item bottomleft
  14549. @item bottom
  14550. @end table
  14551. @item npl
  14552. Set the nominal peak luminance.
  14553. @end table
  14554. The values of the @option{w} and @option{h} options are expressions
  14555. containing the following constants:
  14556. @table @var
  14557. @item in_w
  14558. @item in_h
  14559. The input width and height
  14560. @item iw
  14561. @item ih
  14562. These are the same as @var{in_w} and @var{in_h}.
  14563. @item out_w
  14564. @item out_h
  14565. The output (scaled) width and height
  14566. @item ow
  14567. @item oh
  14568. These are the same as @var{out_w} and @var{out_h}
  14569. @item a
  14570. The same as @var{iw} / @var{ih}
  14571. @item sar
  14572. input sample aspect ratio
  14573. @item dar
  14574. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14575. @item hsub
  14576. @item vsub
  14577. horizontal and vertical input chroma subsample values. For example for the
  14578. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14579. @item ohsub
  14580. @item ovsub
  14581. horizontal and vertical output chroma subsample values. For example for the
  14582. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14583. @end table
  14584. @table @option
  14585. @end table
  14586. @c man end VIDEO FILTERS
  14587. @chapter OpenCL Video Filters
  14588. @c man begin OPENCL VIDEO FILTERS
  14589. Below is a description of the currently available OpenCL video filters.
  14590. To enable compilation of these filters you need to configure FFmpeg with
  14591. @code{--enable-opencl}.
  14592. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  14593. @table @option
  14594. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  14595. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  14596. given device parameters.
  14597. @item -filter_hw_device @var{name}
  14598. Pass the hardware device called @var{name} to all filters in any filter graph.
  14599. @end table
  14600. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  14601. @itemize
  14602. @item
  14603. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  14604. @example
  14605. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  14606. @end example
  14607. @end itemize
  14608. 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.
  14609. @section avgblur_opencl
  14610. Apply average blur filter.
  14611. The filter accepts the following options:
  14612. @table @option
  14613. @item sizeX
  14614. Set horizontal radius size.
  14615. Range is @code{[1, 1024]} and default value is @code{1}.
  14616. @item planes
  14617. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14618. @item sizeY
  14619. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  14620. @end table
  14621. @subsection Example
  14622. @itemize
  14623. @item
  14624. 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.
  14625. @example
  14626. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  14627. @end example
  14628. @end itemize
  14629. @section boxblur_opencl
  14630. Apply a boxblur algorithm to the input video.
  14631. It accepts the following parameters:
  14632. @table @option
  14633. @item luma_radius, lr
  14634. @item luma_power, lp
  14635. @item chroma_radius, cr
  14636. @item chroma_power, cp
  14637. @item alpha_radius, ar
  14638. @item alpha_power, ap
  14639. @end table
  14640. A description of the accepted options follows.
  14641. @table @option
  14642. @item luma_radius, lr
  14643. @item chroma_radius, cr
  14644. @item alpha_radius, ar
  14645. Set an expression for the box radius in pixels used for blurring the
  14646. corresponding input plane.
  14647. The radius value must be a non-negative number, and must not be
  14648. greater than the value of the expression @code{min(w,h)/2} for the
  14649. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  14650. planes.
  14651. Default value for @option{luma_radius} is "2". If not specified,
  14652. @option{chroma_radius} and @option{alpha_radius} default to the
  14653. corresponding value set for @option{luma_radius}.
  14654. The expressions can contain the following constants:
  14655. @table @option
  14656. @item w
  14657. @item h
  14658. The input width and height in pixels.
  14659. @item cw
  14660. @item ch
  14661. The input chroma image width and height in pixels.
  14662. @item hsub
  14663. @item vsub
  14664. The horizontal and vertical chroma subsample values. For example, for the
  14665. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  14666. @end table
  14667. @item luma_power, lp
  14668. @item chroma_power, cp
  14669. @item alpha_power, ap
  14670. Specify how many times the boxblur filter is applied to the
  14671. corresponding plane.
  14672. Default value for @option{luma_power} is 2. If not specified,
  14673. @option{chroma_power} and @option{alpha_power} default to the
  14674. corresponding value set for @option{luma_power}.
  14675. A value of 0 will disable the effect.
  14676. @end table
  14677. @subsection Examples
  14678. 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.
  14679. @itemize
  14680. @item
  14681. Apply a boxblur filter with the luma, chroma, and alpha radius
  14682. 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.
  14683. @example
  14684. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  14685. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  14686. @end example
  14687. @item
  14688. 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.
  14689. For the luma plane, a 2x2 box radius will be run once.
  14690. For the chroma plane, a 4x4 box radius will be run 5 times.
  14691. For the alpha plane, a 3x3 box radius will be run 7 times.
  14692. @example
  14693. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  14694. @end example
  14695. @end itemize
  14696. @section convolution_opencl
  14697. Apply convolution of 3x3, 5x5, 7x7 matrix.
  14698. The filter accepts the following options:
  14699. @table @option
  14700. @item 0m
  14701. @item 1m
  14702. @item 2m
  14703. @item 3m
  14704. Set matrix for each plane.
  14705. Matrix is sequence of 9, 25 or 49 signed numbers.
  14706. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  14707. @item 0rdiv
  14708. @item 1rdiv
  14709. @item 2rdiv
  14710. @item 3rdiv
  14711. Set multiplier for calculated value for each plane.
  14712. If unset or 0, it will be sum of all matrix elements.
  14713. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  14714. @item 0bias
  14715. @item 1bias
  14716. @item 2bias
  14717. @item 3bias
  14718. Set bias for each plane. This value is added to the result of the multiplication.
  14719. Useful for making the overall image brighter or darker.
  14720. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  14721. @end table
  14722. @subsection Examples
  14723. @itemize
  14724. @item
  14725. Apply sharpen:
  14726. @example
  14727. -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
  14728. @end example
  14729. @item
  14730. Apply blur:
  14731. @example
  14732. -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
  14733. @end example
  14734. @item
  14735. Apply edge enhance:
  14736. @example
  14737. -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
  14738. @end example
  14739. @item
  14740. Apply edge detect:
  14741. @example
  14742. -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
  14743. @end example
  14744. @item
  14745. Apply laplacian edge detector which includes diagonals:
  14746. @example
  14747. -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
  14748. @end example
  14749. @item
  14750. Apply emboss:
  14751. @example
  14752. -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
  14753. @end example
  14754. @end itemize
  14755. @section dilation_opencl
  14756. Apply dilation effect to the video.
  14757. This filter replaces the pixel by the local(3x3) maximum.
  14758. It accepts the following options:
  14759. @table @option
  14760. @item threshold0
  14761. @item threshold1
  14762. @item threshold2
  14763. @item threshold3
  14764. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14765. If @code{0}, plane will remain unchanged.
  14766. @item coordinates
  14767. Flag which specifies the pixel to refer to.
  14768. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14769. Flags to local 3x3 coordinates region centered on @code{x}:
  14770. 1 2 3
  14771. 4 x 5
  14772. 6 7 8
  14773. @end table
  14774. @subsection Example
  14775. @itemize
  14776. @item
  14777. 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.
  14778. @example
  14779. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14780. @end example
  14781. @end itemize
  14782. @section erosion_opencl
  14783. Apply erosion effect to the video.
  14784. This filter replaces the pixel by the local(3x3) minimum.
  14785. It accepts the following options:
  14786. @table @option
  14787. @item threshold0
  14788. @item threshold1
  14789. @item threshold2
  14790. @item threshold3
  14791. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14792. If @code{0}, plane will remain unchanged.
  14793. @item coordinates
  14794. Flag which specifies the pixel to refer to.
  14795. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14796. Flags to local 3x3 coordinates region centered on @code{x}:
  14797. 1 2 3
  14798. 4 x 5
  14799. 6 7 8
  14800. @end table
  14801. @subsection Example
  14802. @itemize
  14803. @item
  14804. 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.
  14805. @example
  14806. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14807. @end example
  14808. @end itemize
  14809. @section colorkey_opencl
  14810. RGB colorspace color keying.
  14811. The filter accepts the following options:
  14812. @table @option
  14813. @item color
  14814. The color which will be replaced with transparency.
  14815. @item similarity
  14816. Similarity percentage with the key color.
  14817. 0.01 matches only the exact key color, while 1.0 matches everything.
  14818. @item blend
  14819. Blend percentage.
  14820. 0.0 makes pixels either fully transparent, or not transparent at all.
  14821. Higher values result in semi-transparent pixels, with a higher transparency
  14822. the more similar the pixels color is to the key color.
  14823. @end table
  14824. @subsection Examples
  14825. @itemize
  14826. @item
  14827. Make every semi-green pixel in the input transparent with some slight blending:
  14828. @example
  14829. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  14830. @end example
  14831. @end itemize
  14832. @section nlmeans_opencl
  14833. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  14834. @section overlay_opencl
  14835. Overlay one video on top of another.
  14836. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  14837. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  14838. The filter accepts the following options:
  14839. @table @option
  14840. @item x
  14841. Set the x coordinate of the overlaid video on the main video.
  14842. Default value is @code{0}.
  14843. @item y
  14844. Set the x coordinate of the overlaid video on the main video.
  14845. Default value is @code{0}.
  14846. @end table
  14847. @subsection Examples
  14848. @itemize
  14849. @item
  14850. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  14851. @example
  14852. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14853. @end example
  14854. @item
  14855. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  14856. @example
  14857. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14858. @end example
  14859. @end itemize
  14860. @section prewitt_opencl
  14861. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  14862. The filter accepts the following option:
  14863. @table @option
  14864. @item planes
  14865. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14866. @item scale
  14867. Set value which will be multiplied with filtered result.
  14868. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14869. @item delta
  14870. Set value which will be added to filtered result.
  14871. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14872. @end table
  14873. @subsection Example
  14874. @itemize
  14875. @item
  14876. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  14877. @example
  14878. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14879. @end example
  14880. @end itemize
  14881. @section roberts_opencl
  14882. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  14883. The filter accepts the following option:
  14884. @table @option
  14885. @item planes
  14886. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14887. @item scale
  14888. Set value which will be multiplied with filtered result.
  14889. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14890. @item delta
  14891. Set value which will be added to filtered result.
  14892. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14893. @end table
  14894. @subsection Example
  14895. @itemize
  14896. @item
  14897. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  14898. @example
  14899. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14900. @end example
  14901. @end itemize
  14902. @section sobel_opencl
  14903. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  14904. The filter accepts the following option:
  14905. @table @option
  14906. @item planes
  14907. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14908. @item scale
  14909. Set value which will be multiplied with filtered result.
  14910. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14911. @item delta
  14912. Set value which will be added to filtered result.
  14913. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14914. @end table
  14915. @subsection Example
  14916. @itemize
  14917. @item
  14918. Apply sobel operator with scale set to 2 and delta set to 10
  14919. @example
  14920. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14921. @end example
  14922. @end itemize
  14923. @section tonemap_opencl
  14924. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  14925. It accepts the following parameters:
  14926. @table @option
  14927. @item tonemap
  14928. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  14929. @item param
  14930. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  14931. @item desat
  14932. Apply desaturation for highlights that exceed this level of brightness. The
  14933. higher the parameter, the more color information will be preserved. This
  14934. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14935. (smoothly) turning into white instead. This makes images feel more natural,
  14936. at the cost of reducing information about out-of-range colors.
  14937. The default value is 0.5, and the algorithm here is a little different from
  14938. the cpu version tonemap currently. A setting of 0.0 disables this option.
  14939. @item threshold
  14940. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  14941. is used to detect whether the scene has changed or not. If the distance between
  14942. the current frame average brightness and the current running average exceeds
  14943. a threshold value, we would re-calculate scene average and peak brightness.
  14944. The default value is 0.2.
  14945. @item format
  14946. Specify the output pixel format.
  14947. Currently supported formats are:
  14948. @table @var
  14949. @item p010
  14950. @item nv12
  14951. @end table
  14952. @item range, r
  14953. Set the output color range.
  14954. Possible values are:
  14955. @table @var
  14956. @item tv/mpeg
  14957. @item pc/jpeg
  14958. @end table
  14959. Default is same as input.
  14960. @item primaries, p
  14961. Set the output color primaries.
  14962. Possible values are:
  14963. @table @var
  14964. @item bt709
  14965. @item bt2020
  14966. @end table
  14967. Default is same as input.
  14968. @item transfer, t
  14969. Set the output transfer characteristics.
  14970. Possible values are:
  14971. @table @var
  14972. @item bt709
  14973. @item bt2020
  14974. @end table
  14975. Default is bt709.
  14976. @item matrix, m
  14977. Set the output colorspace matrix.
  14978. Possible value are:
  14979. @table @var
  14980. @item bt709
  14981. @item bt2020
  14982. @end table
  14983. Default is same as input.
  14984. @end table
  14985. @subsection Example
  14986. @itemize
  14987. @item
  14988. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  14989. @example
  14990. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  14991. @end example
  14992. @end itemize
  14993. @section unsharp_opencl
  14994. Sharpen or blur the input video.
  14995. It accepts the following parameters:
  14996. @table @option
  14997. @item luma_msize_x, lx
  14998. Set the luma matrix horizontal size.
  14999. Range is @code{[1, 23]} and default value is @code{5}.
  15000. @item luma_msize_y, ly
  15001. Set the luma matrix vertical size.
  15002. Range is @code{[1, 23]} and default value is @code{5}.
  15003. @item luma_amount, la
  15004. Set the luma effect strength.
  15005. Range is @code{[-10, 10]} and default value is @code{1.0}.
  15006. Negative values will blur the input video, while positive values will
  15007. sharpen it, a value of zero will disable the effect.
  15008. @item chroma_msize_x, cx
  15009. Set the chroma matrix horizontal size.
  15010. Range is @code{[1, 23]} and default value is @code{5}.
  15011. @item chroma_msize_y, cy
  15012. Set the chroma matrix vertical size.
  15013. Range is @code{[1, 23]} and default value is @code{5}.
  15014. @item chroma_amount, ca
  15015. Set the chroma effect strength.
  15016. Range is @code{[-10, 10]} and default value is @code{0.0}.
  15017. Negative values will blur the input video, while positive values will
  15018. sharpen it, a value of zero will disable the effect.
  15019. @end table
  15020. All parameters are optional and default to the equivalent of the
  15021. string '5:5:1.0:5:5:0.0'.
  15022. @subsection Examples
  15023. @itemize
  15024. @item
  15025. Apply strong luma sharpen effect:
  15026. @example
  15027. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  15028. @end example
  15029. @item
  15030. Apply a strong blur of both luma and chroma parameters:
  15031. @example
  15032. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  15033. @end example
  15034. @end itemize
  15035. @c man end OPENCL VIDEO FILTERS
  15036. @chapter Video Sources
  15037. @c man begin VIDEO SOURCES
  15038. Below is a description of the currently available video sources.
  15039. @section buffer
  15040. Buffer video frames, and make them available to the filter chain.
  15041. This source is mainly intended for a programmatic use, in particular
  15042. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  15043. It accepts the following parameters:
  15044. @table @option
  15045. @item video_size
  15046. Specify the size (width and height) of the buffered video frames. For the
  15047. syntax of this option, check the
  15048. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15049. @item width
  15050. The input video width.
  15051. @item height
  15052. The input video height.
  15053. @item pix_fmt
  15054. A string representing the pixel format of the buffered video frames.
  15055. It may be a number corresponding to a pixel format, or a pixel format
  15056. name.
  15057. @item time_base
  15058. Specify the timebase assumed by the timestamps of the buffered frames.
  15059. @item frame_rate
  15060. Specify the frame rate expected for the video stream.
  15061. @item pixel_aspect, sar
  15062. The sample (pixel) aspect ratio of the input video.
  15063. @item sws_param
  15064. Specify the optional parameters to be used for the scale filter which
  15065. is automatically inserted when an input change is detected in the
  15066. input size or format.
  15067. @item hw_frames_ctx
  15068. When using a hardware pixel format, this should be a reference to an
  15069. AVHWFramesContext describing input frames.
  15070. @end table
  15071. For example:
  15072. @example
  15073. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  15074. @end example
  15075. will instruct the source to accept video frames with size 320x240 and
  15076. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  15077. square pixels (1:1 sample aspect ratio).
  15078. Since the pixel format with name "yuv410p" corresponds to the number 6
  15079. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  15080. this example corresponds to:
  15081. @example
  15082. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  15083. @end example
  15084. Alternatively, the options can be specified as a flat string, but this
  15085. syntax is deprecated:
  15086. @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}]
  15087. @section cellauto
  15088. Create a pattern generated by an elementary cellular automaton.
  15089. The initial state of the cellular automaton can be defined through the
  15090. @option{filename} and @option{pattern} options. If such options are
  15091. not specified an initial state is created randomly.
  15092. At each new frame a new row in the video is filled with the result of
  15093. the cellular automaton next generation. The behavior when the whole
  15094. frame is filled is defined by the @option{scroll} option.
  15095. This source accepts the following options:
  15096. @table @option
  15097. @item filename, f
  15098. Read the initial cellular automaton state, i.e. the starting row, from
  15099. the specified file.
  15100. In the file, each non-whitespace character is considered an alive
  15101. cell, a newline will terminate the row, and further characters in the
  15102. file will be ignored.
  15103. @item pattern, p
  15104. Read the initial cellular automaton state, i.e. the starting row, from
  15105. the specified string.
  15106. Each non-whitespace character in the string is considered an alive
  15107. cell, a newline will terminate the row, and further characters in the
  15108. string will be ignored.
  15109. @item rate, r
  15110. Set the video rate, that is the number of frames generated per second.
  15111. Default is 25.
  15112. @item random_fill_ratio, ratio
  15113. Set the random fill ratio for the initial cellular automaton row. It
  15114. is a floating point number value ranging from 0 to 1, defaults to
  15115. 1/PHI.
  15116. This option is ignored when a file or a pattern is specified.
  15117. @item random_seed, seed
  15118. Set the seed for filling randomly the initial row, must be an integer
  15119. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15120. set to -1, the filter will try to use a good random seed on a best
  15121. effort basis.
  15122. @item rule
  15123. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  15124. Default value is 110.
  15125. @item size, s
  15126. Set the size of the output video. For the syntax of this option, check the
  15127. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15128. If @option{filename} or @option{pattern} is specified, the size is set
  15129. by default to the width of the specified initial state row, and the
  15130. height is set to @var{width} * PHI.
  15131. If @option{size} is set, it must contain the width of the specified
  15132. pattern string, and the specified pattern will be centered in the
  15133. larger row.
  15134. If a filename or a pattern string is not specified, the size value
  15135. defaults to "320x518" (used for a randomly generated initial state).
  15136. @item scroll
  15137. If set to 1, scroll the output upward when all the rows in the output
  15138. have been already filled. If set to 0, the new generated row will be
  15139. written over the top row just after the bottom row is filled.
  15140. Defaults to 1.
  15141. @item start_full, full
  15142. If set to 1, completely fill the output with generated rows before
  15143. outputting the first frame.
  15144. This is the default behavior, for disabling set the value to 0.
  15145. @item stitch
  15146. If set to 1, stitch the left and right row edges together.
  15147. This is the default behavior, for disabling set the value to 0.
  15148. @end table
  15149. @subsection Examples
  15150. @itemize
  15151. @item
  15152. Read the initial state from @file{pattern}, and specify an output of
  15153. size 200x400.
  15154. @example
  15155. cellauto=f=pattern:s=200x400
  15156. @end example
  15157. @item
  15158. Generate a random initial row with a width of 200 cells, with a fill
  15159. ratio of 2/3:
  15160. @example
  15161. cellauto=ratio=2/3:s=200x200
  15162. @end example
  15163. @item
  15164. Create a pattern generated by rule 18 starting by a single alive cell
  15165. centered on an initial row with width 100:
  15166. @example
  15167. cellauto=p=@@:s=100x400:full=0:rule=18
  15168. @end example
  15169. @item
  15170. Specify a more elaborated initial pattern:
  15171. @example
  15172. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  15173. @end example
  15174. @end itemize
  15175. @anchor{coreimagesrc}
  15176. @section coreimagesrc
  15177. Video source generated on GPU using Apple's CoreImage API on OSX.
  15178. This video source is a specialized version of the @ref{coreimage} video filter.
  15179. Use a core image generator at the beginning of the applied filterchain to
  15180. generate the content.
  15181. The coreimagesrc video source accepts the following options:
  15182. @table @option
  15183. @item list_generators
  15184. List all available generators along with all their respective options as well as
  15185. possible minimum and maximum values along with the default values.
  15186. @example
  15187. list_generators=true
  15188. @end example
  15189. @item size, s
  15190. Specify the size of the sourced video. For the syntax of this option, check the
  15191. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15192. The default value is @code{320x240}.
  15193. @item rate, r
  15194. Specify the frame rate of the sourced video, as the number of frames
  15195. generated per second. It has to be a string in the format
  15196. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15197. number or a valid video frame rate abbreviation. The default value is
  15198. "25".
  15199. @item sar
  15200. Set the sample aspect ratio of the sourced video.
  15201. @item duration, d
  15202. Set the duration of the sourced video. See
  15203. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15204. for the accepted syntax.
  15205. If not specified, or the expressed duration is negative, the video is
  15206. supposed to be generated forever.
  15207. @end table
  15208. Additionally, all options of the @ref{coreimage} video filter are accepted.
  15209. A complete filterchain can be used for further processing of the
  15210. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  15211. and examples for details.
  15212. @subsection Examples
  15213. @itemize
  15214. @item
  15215. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  15216. given as complete and escaped command-line for Apple's standard bash shell:
  15217. @example
  15218. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  15219. @end example
  15220. This example is equivalent to the QRCode example of @ref{coreimage} without the
  15221. need for a nullsrc video source.
  15222. @end itemize
  15223. @section mandelbrot
  15224. Generate a Mandelbrot set fractal, and progressively zoom towards the
  15225. point specified with @var{start_x} and @var{start_y}.
  15226. This source accepts the following options:
  15227. @table @option
  15228. @item end_pts
  15229. Set the terminal pts value. Default value is 400.
  15230. @item end_scale
  15231. Set the terminal scale value.
  15232. Must be a floating point value. Default value is 0.3.
  15233. @item inner
  15234. Set the inner coloring mode, that is the algorithm used to draw the
  15235. Mandelbrot fractal internal region.
  15236. It shall assume one of the following values:
  15237. @table @option
  15238. @item black
  15239. Set black mode.
  15240. @item convergence
  15241. Show time until convergence.
  15242. @item mincol
  15243. Set color based on point closest to the origin of the iterations.
  15244. @item period
  15245. Set period mode.
  15246. @end table
  15247. Default value is @var{mincol}.
  15248. @item bailout
  15249. Set the bailout value. Default value is 10.0.
  15250. @item maxiter
  15251. Set the maximum of iterations performed by the rendering
  15252. algorithm. Default value is 7189.
  15253. @item outer
  15254. Set outer coloring mode.
  15255. It shall assume one of following values:
  15256. @table @option
  15257. @item iteration_count
  15258. Set iteration count mode.
  15259. @item normalized_iteration_count
  15260. set normalized iteration count mode.
  15261. @end table
  15262. Default value is @var{normalized_iteration_count}.
  15263. @item rate, r
  15264. Set frame rate, expressed as number of frames per second. Default
  15265. value is "25".
  15266. @item size, s
  15267. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  15268. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  15269. @item start_scale
  15270. Set the initial scale value. Default value is 3.0.
  15271. @item start_x
  15272. Set the initial x position. Must be a floating point value between
  15273. -100 and 100. Default value is -0.743643887037158704752191506114774.
  15274. @item start_y
  15275. Set the initial y position. Must be a floating point value between
  15276. -100 and 100. Default value is -0.131825904205311970493132056385139.
  15277. @end table
  15278. @section mptestsrc
  15279. Generate various test patterns, as generated by the MPlayer test filter.
  15280. The size of the generated video is fixed, and is 256x256.
  15281. This source is useful in particular for testing encoding features.
  15282. This source accepts the following options:
  15283. @table @option
  15284. @item rate, r
  15285. Specify the frame rate of the sourced video, as the number of frames
  15286. generated per second. It has to be a string in the format
  15287. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15288. number or a valid video frame rate abbreviation. The default value is
  15289. "25".
  15290. @item duration, d
  15291. Set the duration of the sourced video. See
  15292. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15293. for the accepted syntax.
  15294. If not specified, or the expressed duration is negative, the video is
  15295. supposed to be generated forever.
  15296. @item test, t
  15297. Set the number or the name of the test to perform. Supported tests are:
  15298. @table @option
  15299. @item dc_luma
  15300. @item dc_chroma
  15301. @item freq_luma
  15302. @item freq_chroma
  15303. @item amp_luma
  15304. @item amp_chroma
  15305. @item cbp
  15306. @item mv
  15307. @item ring1
  15308. @item ring2
  15309. @item all
  15310. @end table
  15311. Default value is "all", which will cycle through the list of all tests.
  15312. @end table
  15313. Some examples:
  15314. @example
  15315. mptestsrc=t=dc_luma
  15316. @end example
  15317. will generate a "dc_luma" test pattern.
  15318. @section frei0r_src
  15319. Provide a frei0r source.
  15320. To enable compilation of this filter you need to install the frei0r
  15321. header and configure FFmpeg with @code{--enable-frei0r}.
  15322. This source accepts the following parameters:
  15323. @table @option
  15324. @item size
  15325. The size of the video to generate. For the syntax of this option, check the
  15326. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15327. @item framerate
  15328. The framerate of the generated video. It may be a string of the form
  15329. @var{num}/@var{den} or a frame rate abbreviation.
  15330. @item filter_name
  15331. The name to the frei0r source to load. For more information regarding frei0r and
  15332. how to set the parameters, read the @ref{frei0r} section in the video filters
  15333. documentation.
  15334. @item filter_params
  15335. A '|'-separated list of parameters to pass to the frei0r source.
  15336. @end table
  15337. For example, to generate a frei0r partik0l source with size 200x200
  15338. and frame rate 10 which is overlaid on the overlay filter main input:
  15339. @example
  15340. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  15341. @end example
  15342. @section life
  15343. Generate a life pattern.
  15344. This source is based on a generalization of John Conway's life game.
  15345. The sourced input represents a life grid, each pixel represents a cell
  15346. which can be in one of two possible states, alive or dead. Every cell
  15347. interacts with its eight neighbours, which are the cells that are
  15348. horizontally, vertically, or diagonally adjacent.
  15349. At each interaction the grid evolves according to the adopted rule,
  15350. which specifies the number of neighbor alive cells which will make a
  15351. cell stay alive or born. The @option{rule} option allows one to specify
  15352. the rule to adopt.
  15353. This source accepts the following options:
  15354. @table @option
  15355. @item filename, f
  15356. Set the file from which to read the initial grid state. In the file,
  15357. each non-whitespace character is considered an alive cell, and newline
  15358. is used to delimit the end of each row.
  15359. If this option is not specified, the initial grid is generated
  15360. randomly.
  15361. @item rate, r
  15362. Set the video rate, that is the number of frames generated per second.
  15363. Default is 25.
  15364. @item random_fill_ratio, ratio
  15365. Set the random fill ratio for the initial random grid. It is a
  15366. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15367. It is ignored when a file is specified.
  15368. @item random_seed, seed
  15369. Set the seed for filling the initial random grid, must be an integer
  15370. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15371. set to -1, the filter will try to use a good random seed on a best
  15372. effort basis.
  15373. @item rule
  15374. Set the life rule.
  15375. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15376. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15377. @var{NS} specifies the number of alive neighbor cells which make a
  15378. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15379. which make a dead cell to become alive (i.e. to "born").
  15380. "s" and "b" can be used in place of "S" and "B", respectively.
  15381. Alternatively a rule can be specified by an 18-bits integer. The 9
  15382. high order bits are used to encode the next cell state if it is alive
  15383. for each number of neighbor alive cells, the low order bits specify
  15384. the rule for "borning" new cells. Higher order bits encode for an
  15385. higher number of neighbor cells.
  15386. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15387. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15388. Default value is "S23/B3", which is the original Conway's game of life
  15389. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15390. cells, and will born a new cell if there are three alive cells around
  15391. a dead cell.
  15392. @item size, s
  15393. Set the size of the output video. For the syntax of this option, check the
  15394. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15395. If @option{filename} is specified, the size is set by default to the
  15396. same size of the input file. If @option{size} is set, it must contain
  15397. the size specified in the input file, and the initial grid defined in
  15398. that file is centered in the larger resulting area.
  15399. If a filename is not specified, the size value defaults to "320x240"
  15400. (used for a randomly generated initial grid).
  15401. @item stitch
  15402. If set to 1, stitch the left and right grid edges together, and the
  15403. top and bottom edges also. Defaults to 1.
  15404. @item mold
  15405. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15406. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15407. value from 0 to 255.
  15408. @item life_color
  15409. Set the color of living (or new born) cells.
  15410. @item death_color
  15411. Set the color of dead cells. If @option{mold} is set, this is the first color
  15412. used to represent a dead cell.
  15413. @item mold_color
  15414. Set mold color, for definitely dead and moldy cells.
  15415. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15416. ffmpeg-utils manual,ffmpeg-utils}.
  15417. @end table
  15418. @subsection Examples
  15419. @itemize
  15420. @item
  15421. Read a grid from @file{pattern}, and center it on a grid of size
  15422. 300x300 pixels:
  15423. @example
  15424. life=f=pattern:s=300x300
  15425. @end example
  15426. @item
  15427. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15428. @example
  15429. life=ratio=2/3:s=200x200
  15430. @end example
  15431. @item
  15432. Specify a custom rule for evolving a randomly generated grid:
  15433. @example
  15434. life=rule=S14/B34
  15435. @end example
  15436. @item
  15437. Full example with slow death effect (mold) using @command{ffplay}:
  15438. @example
  15439. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15440. @end example
  15441. @end itemize
  15442. @anchor{allrgb}
  15443. @anchor{allyuv}
  15444. @anchor{color}
  15445. @anchor{haldclutsrc}
  15446. @anchor{nullsrc}
  15447. @anchor{pal75bars}
  15448. @anchor{pal100bars}
  15449. @anchor{rgbtestsrc}
  15450. @anchor{smptebars}
  15451. @anchor{smptehdbars}
  15452. @anchor{testsrc}
  15453. @anchor{testsrc2}
  15454. @anchor{yuvtestsrc}
  15455. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15456. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15457. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15458. The @code{color} source provides an uniformly colored input.
  15459. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15460. @ref{haldclut} filter.
  15461. The @code{nullsrc} source returns unprocessed video frames. It is
  15462. mainly useful to be employed in analysis / debugging tools, or as the
  15463. source for filters which ignore the input data.
  15464. The @code{pal75bars} source generates a color bars pattern, based on
  15465. EBU PAL recommendations with 75% color levels.
  15466. The @code{pal100bars} source generates a color bars pattern, based on
  15467. EBU PAL recommendations with 100% color levels.
  15468. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15469. detecting RGB vs BGR issues. You should see a red, green and blue
  15470. stripe from top to bottom.
  15471. The @code{smptebars} source generates a color bars pattern, based on
  15472. the SMPTE Engineering Guideline EG 1-1990.
  15473. The @code{smptehdbars} source generates a color bars pattern, based on
  15474. the SMPTE RP 219-2002.
  15475. The @code{testsrc} source generates a test video pattern, showing a
  15476. color pattern, a scrolling gradient and a timestamp. This is mainly
  15477. intended for testing purposes.
  15478. The @code{testsrc2} source is similar to testsrc, but supports more
  15479. pixel formats instead of just @code{rgb24}. This allows using it as an
  15480. input for other tests without requiring a format conversion.
  15481. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15482. see a y, cb and cr stripe from top to bottom.
  15483. The sources accept the following parameters:
  15484. @table @option
  15485. @item level
  15486. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15487. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  15488. pixels to be used as identity matrix for 3D lookup tables. Each component is
  15489. coded on a @code{1/(N*N)} scale.
  15490. @item color, c
  15491. Specify the color of the source, only available in the @code{color}
  15492. source. For the syntax of this option, check the
  15493. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15494. @item size, s
  15495. Specify the size of the sourced video. For the syntax of this option, check the
  15496. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15497. The default value is @code{320x240}.
  15498. This option is not available with the @code{allrgb}, @code{allyuv}, and
  15499. @code{haldclutsrc} filters.
  15500. @item rate, r
  15501. Specify the frame rate of the sourced video, as the number of frames
  15502. generated per second. It has to be a string in the format
  15503. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15504. number or a valid video frame rate abbreviation. The default value is
  15505. "25".
  15506. @item duration, d
  15507. Set the duration of the sourced video. See
  15508. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15509. for the accepted syntax.
  15510. If not specified, or the expressed duration is negative, the video is
  15511. supposed to be generated forever.
  15512. @item sar
  15513. Set the sample aspect ratio of the sourced video.
  15514. @item alpha
  15515. Specify the alpha (opacity) of the background, only available in the
  15516. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15517. 255 (fully opaque, the default).
  15518. @item decimals, n
  15519. Set the number of decimals to show in the timestamp, only available in the
  15520. @code{testsrc} source.
  15521. The displayed timestamp value will correspond to the original
  15522. timestamp value multiplied by the power of 10 of the specified
  15523. value. Default value is 0.
  15524. @end table
  15525. @subsection Examples
  15526. @itemize
  15527. @item
  15528. Generate a video with a duration of 5.3 seconds, with size
  15529. 176x144 and a frame rate of 10 frames per second:
  15530. @example
  15531. testsrc=duration=5.3:size=qcif:rate=10
  15532. @end example
  15533. @item
  15534. The following graph description will generate a red source
  15535. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  15536. frames per second:
  15537. @example
  15538. color=c=red@@0.2:s=qcif:r=10
  15539. @end example
  15540. @item
  15541. If the input content is to be ignored, @code{nullsrc} can be used. The
  15542. following command generates noise in the luminance plane by employing
  15543. the @code{geq} filter:
  15544. @example
  15545. nullsrc=s=256x256, geq=random(1)*255:128:128
  15546. @end example
  15547. @end itemize
  15548. @subsection Commands
  15549. The @code{color} source supports the following commands:
  15550. @table @option
  15551. @item c, color
  15552. Set the color of the created image. Accepts the same syntax of the
  15553. corresponding @option{color} option.
  15554. @end table
  15555. @section openclsrc
  15556. Generate video using an OpenCL program.
  15557. @table @option
  15558. @item source
  15559. OpenCL program source file.
  15560. @item kernel
  15561. Kernel name in program.
  15562. @item size, s
  15563. Size of frames to generate. This must be set.
  15564. @item format
  15565. Pixel format to use for the generated frames. This must be set.
  15566. @item rate, r
  15567. Number of frames generated every second. Default value is '25'.
  15568. @end table
  15569. For details of how the program loading works, see the @ref{program_opencl}
  15570. filter.
  15571. Example programs:
  15572. @itemize
  15573. @item
  15574. Generate a colour ramp by setting pixel values from the position of the pixel
  15575. in the output image. (Note that this will work with all pixel formats, but
  15576. the generated output will not be the same.)
  15577. @verbatim
  15578. __kernel void ramp(__write_only image2d_t dst,
  15579. unsigned int index)
  15580. {
  15581. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15582. float4 val;
  15583. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  15584. write_imagef(dst, loc, val);
  15585. }
  15586. @end verbatim
  15587. @item
  15588. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  15589. @verbatim
  15590. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  15591. unsigned int index)
  15592. {
  15593. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15594. float4 value = 0.0f;
  15595. int x = loc.x + index;
  15596. int y = loc.y + index;
  15597. while (x > 0 || y > 0) {
  15598. if (x % 3 == 1 && y % 3 == 1) {
  15599. value = 1.0f;
  15600. break;
  15601. }
  15602. x /= 3;
  15603. y /= 3;
  15604. }
  15605. write_imagef(dst, loc, value);
  15606. }
  15607. @end verbatim
  15608. @end itemize
  15609. @c man end VIDEO SOURCES
  15610. @chapter Video Sinks
  15611. @c man begin VIDEO SINKS
  15612. Below is a description of the currently available video sinks.
  15613. @section buffersink
  15614. Buffer video frames, and make them available to the end of the filter
  15615. graph.
  15616. This sink is mainly intended for programmatic use, in particular
  15617. through the interface defined in @file{libavfilter/buffersink.h}
  15618. or the options system.
  15619. It accepts a pointer to an AVBufferSinkContext structure, which
  15620. defines the incoming buffers' formats, to be passed as the opaque
  15621. parameter to @code{avfilter_init_filter} for initialization.
  15622. @section nullsink
  15623. Null video sink: do absolutely nothing with the input video. It is
  15624. mainly useful as a template and for use in analysis / debugging
  15625. tools.
  15626. @c man end VIDEO SINKS
  15627. @chapter Multimedia Filters
  15628. @c man begin MULTIMEDIA FILTERS
  15629. Below is a description of the currently available multimedia filters.
  15630. @section abitscope
  15631. Convert input audio to a video output, displaying the audio bit scope.
  15632. The filter accepts the following options:
  15633. @table @option
  15634. @item rate, r
  15635. Set frame rate, expressed as number of frames per second. Default
  15636. value is "25".
  15637. @item size, s
  15638. Specify the video size for the output. For the syntax of this option, check the
  15639. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15640. Default value is @code{1024x256}.
  15641. @item colors
  15642. Specify list of colors separated by space or by '|' which will be used to
  15643. draw channels. Unrecognized or missing colors will be replaced
  15644. by white color.
  15645. @end table
  15646. @section ahistogram
  15647. Convert input audio to a video output, displaying the volume histogram.
  15648. The filter accepts the following options:
  15649. @table @option
  15650. @item dmode
  15651. Specify how histogram is calculated.
  15652. It accepts the following values:
  15653. @table @samp
  15654. @item single
  15655. Use single histogram for all channels.
  15656. @item separate
  15657. Use separate histogram for each channel.
  15658. @end table
  15659. Default is @code{single}.
  15660. @item rate, r
  15661. Set frame rate, expressed as number of frames per second. Default
  15662. value is "25".
  15663. @item size, s
  15664. Specify the video size for the output. For the syntax of this option, check the
  15665. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15666. Default value is @code{hd720}.
  15667. @item scale
  15668. Set display scale.
  15669. It accepts the following values:
  15670. @table @samp
  15671. @item log
  15672. logarithmic
  15673. @item sqrt
  15674. square root
  15675. @item cbrt
  15676. cubic root
  15677. @item lin
  15678. linear
  15679. @item rlog
  15680. reverse logarithmic
  15681. @end table
  15682. Default is @code{log}.
  15683. @item ascale
  15684. Set amplitude scale.
  15685. It accepts the following values:
  15686. @table @samp
  15687. @item log
  15688. logarithmic
  15689. @item lin
  15690. linear
  15691. @end table
  15692. Default is @code{log}.
  15693. @item acount
  15694. Set how much frames to accumulate in histogram.
  15695. Default is 1. Setting this to -1 accumulates all frames.
  15696. @item rheight
  15697. Set histogram ratio of window height.
  15698. @item slide
  15699. Set sonogram sliding.
  15700. It accepts the following values:
  15701. @table @samp
  15702. @item replace
  15703. replace old rows with new ones.
  15704. @item scroll
  15705. scroll from top to bottom.
  15706. @end table
  15707. Default is @code{replace}.
  15708. @end table
  15709. @section aphasemeter
  15710. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  15711. representing mean phase of current audio frame. A video output can also be produced and is
  15712. enabled by default. The audio is passed through as first output.
  15713. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  15714. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  15715. and @code{1} means channels are in phase.
  15716. The filter accepts the following options, all related to its video output:
  15717. @table @option
  15718. @item rate, r
  15719. Set the output frame rate. Default value is @code{25}.
  15720. @item size, s
  15721. Set the video size for the output. For the syntax of this option, check the
  15722. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15723. Default value is @code{800x400}.
  15724. @item rc
  15725. @item gc
  15726. @item bc
  15727. Specify the red, green, blue contrast. Default values are @code{2},
  15728. @code{7} and @code{1}.
  15729. Allowed range is @code{[0, 255]}.
  15730. @item mpc
  15731. Set color which will be used for drawing median phase. If color is
  15732. @code{none} which is default, no median phase value will be drawn.
  15733. @item video
  15734. Enable video output. Default is enabled.
  15735. @end table
  15736. @section avectorscope
  15737. Convert input audio to a video output, representing the audio vector
  15738. scope.
  15739. The filter is used to measure the difference between channels of stereo
  15740. audio stream. A monoaural signal, consisting of identical left and right
  15741. signal, results in straight vertical line. Any stereo separation is visible
  15742. as a deviation from this line, creating a Lissajous figure.
  15743. If the straight (or deviation from it) but horizontal line appears this
  15744. indicates that the left and right channels are out of phase.
  15745. The filter accepts the following options:
  15746. @table @option
  15747. @item mode, m
  15748. Set the vectorscope mode.
  15749. Available values are:
  15750. @table @samp
  15751. @item lissajous
  15752. Lissajous rotated by 45 degrees.
  15753. @item lissajous_xy
  15754. Same as above but not rotated.
  15755. @item polar
  15756. Shape resembling half of circle.
  15757. @end table
  15758. Default value is @samp{lissajous}.
  15759. @item size, s
  15760. Set the video size for the output. For the syntax of this option, check the
  15761. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15762. Default value is @code{400x400}.
  15763. @item rate, r
  15764. Set the output frame rate. Default value is @code{25}.
  15765. @item rc
  15766. @item gc
  15767. @item bc
  15768. @item ac
  15769. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  15770. @code{160}, @code{80} and @code{255}.
  15771. Allowed range is @code{[0, 255]}.
  15772. @item rf
  15773. @item gf
  15774. @item bf
  15775. @item af
  15776. Specify the red, green, blue and alpha fade. Default values are @code{15},
  15777. @code{10}, @code{5} and @code{5}.
  15778. Allowed range is @code{[0, 255]}.
  15779. @item zoom
  15780. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  15781. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  15782. @item draw
  15783. Set the vectorscope drawing mode.
  15784. Available values are:
  15785. @table @samp
  15786. @item dot
  15787. Draw dot for each sample.
  15788. @item line
  15789. Draw line between previous and current sample.
  15790. @end table
  15791. Default value is @samp{dot}.
  15792. @item scale
  15793. Specify amplitude scale of audio samples.
  15794. Available values are:
  15795. @table @samp
  15796. @item lin
  15797. Linear.
  15798. @item sqrt
  15799. Square root.
  15800. @item cbrt
  15801. Cubic root.
  15802. @item log
  15803. Logarithmic.
  15804. @end table
  15805. @item swap
  15806. Swap left channel axis with right channel axis.
  15807. @item mirror
  15808. Mirror axis.
  15809. @table @samp
  15810. @item none
  15811. No mirror.
  15812. @item x
  15813. Mirror only x axis.
  15814. @item y
  15815. Mirror only y axis.
  15816. @item xy
  15817. Mirror both axis.
  15818. @end table
  15819. @end table
  15820. @subsection Examples
  15821. @itemize
  15822. @item
  15823. Complete example using @command{ffplay}:
  15824. @example
  15825. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15826. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  15827. @end example
  15828. @end itemize
  15829. @section bench, abench
  15830. Benchmark part of a filtergraph.
  15831. The filter accepts the following options:
  15832. @table @option
  15833. @item action
  15834. Start or stop a timer.
  15835. Available values are:
  15836. @table @samp
  15837. @item start
  15838. Get the current time, set it as frame metadata (using the key
  15839. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  15840. @item stop
  15841. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  15842. the input frame metadata to get the time difference. Time difference, average,
  15843. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  15844. @code{min}) are then printed. The timestamps are expressed in seconds.
  15845. @end table
  15846. @end table
  15847. @subsection Examples
  15848. @itemize
  15849. @item
  15850. Benchmark @ref{selectivecolor} filter:
  15851. @example
  15852. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  15853. @end example
  15854. @end itemize
  15855. @section concat
  15856. Concatenate audio and video streams, joining them together one after the
  15857. other.
  15858. The filter works on segments of synchronized video and audio streams. All
  15859. segments must have the same number of streams of each type, and that will
  15860. also be the number of streams at output.
  15861. The filter accepts the following options:
  15862. @table @option
  15863. @item n
  15864. Set the number of segments. Default is 2.
  15865. @item v
  15866. Set the number of output video streams, that is also the number of video
  15867. streams in each segment. Default is 1.
  15868. @item a
  15869. Set the number of output audio streams, that is also the number of audio
  15870. streams in each segment. Default is 0.
  15871. @item unsafe
  15872. Activate unsafe mode: do not fail if segments have a different format.
  15873. @end table
  15874. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  15875. @var{a} audio outputs.
  15876. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  15877. segment, in the same order as the outputs, then the inputs for the second
  15878. segment, etc.
  15879. Related streams do not always have exactly the same duration, for various
  15880. reasons including codec frame size or sloppy authoring. For that reason,
  15881. related synchronized streams (e.g. a video and its audio track) should be
  15882. concatenated at once. The concat filter will use the duration of the longest
  15883. stream in each segment (except the last one), and if necessary pad shorter
  15884. audio streams with silence.
  15885. For this filter to work correctly, all segments must start at timestamp 0.
  15886. All corresponding streams must have the same parameters in all segments; the
  15887. filtering system will automatically select a common pixel format for video
  15888. streams, and a common sample format, sample rate and channel layout for
  15889. audio streams, but other settings, such as resolution, must be converted
  15890. explicitly by the user.
  15891. Different frame rates are acceptable but will result in variable frame rate
  15892. at output; be sure to configure the output file to handle it.
  15893. @subsection Examples
  15894. @itemize
  15895. @item
  15896. Concatenate an opening, an episode and an ending, all in bilingual version
  15897. (video in stream 0, audio in streams 1 and 2):
  15898. @example
  15899. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  15900. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  15901. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  15902. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  15903. @end example
  15904. @item
  15905. Concatenate two parts, handling audio and video separately, using the
  15906. (a)movie sources, and adjusting the resolution:
  15907. @example
  15908. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  15909. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  15910. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  15911. @end example
  15912. Note that a desync will happen at the stitch if the audio and video streams
  15913. do not have exactly the same duration in the first file.
  15914. @end itemize
  15915. @subsection Commands
  15916. This filter supports the following commands:
  15917. @table @option
  15918. @item next
  15919. Close the current segment and step to the next one
  15920. @end table
  15921. @section drawgraph, adrawgraph
  15922. Draw a graph using input video or audio metadata.
  15923. It accepts the following parameters:
  15924. @table @option
  15925. @item m1
  15926. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  15927. @item fg1
  15928. Set 1st foreground color expression.
  15929. @item m2
  15930. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  15931. @item fg2
  15932. Set 2nd foreground color expression.
  15933. @item m3
  15934. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  15935. @item fg3
  15936. Set 3rd foreground color expression.
  15937. @item m4
  15938. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  15939. @item fg4
  15940. Set 4th foreground color expression.
  15941. @item min
  15942. Set minimal value of metadata value.
  15943. @item max
  15944. Set maximal value of metadata value.
  15945. @item bg
  15946. Set graph background color. Default is white.
  15947. @item mode
  15948. Set graph mode.
  15949. Available values for mode is:
  15950. @table @samp
  15951. @item bar
  15952. @item dot
  15953. @item line
  15954. @end table
  15955. Default is @code{line}.
  15956. @item slide
  15957. Set slide mode.
  15958. Available values for slide is:
  15959. @table @samp
  15960. @item frame
  15961. Draw new frame when right border is reached.
  15962. @item replace
  15963. Replace old columns with new ones.
  15964. @item scroll
  15965. Scroll from right to left.
  15966. @item rscroll
  15967. Scroll from left to right.
  15968. @item picture
  15969. Draw single picture.
  15970. @end table
  15971. Default is @code{frame}.
  15972. @item size
  15973. Set size of graph video. For the syntax of this option, check the
  15974. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15975. The default value is @code{900x256}.
  15976. The foreground color expressions can use the following variables:
  15977. @table @option
  15978. @item MIN
  15979. Minimal value of metadata value.
  15980. @item MAX
  15981. Maximal value of metadata value.
  15982. @item VAL
  15983. Current metadata key value.
  15984. @end table
  15985. The color is defined as 0xAABBGGRR.
  15986. @end table
  15987. Example using metadata from @ref{signalstats} filter:
  15988. @example
  15989. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  15990. @end example
  15991. Example using metadata from @ref{ebur128} filter:
  15992. @example
  15993. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  15994. @end example
  15995. @anchor{ebur128}
  15996. @section ebur128
  15997. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  15998. level. By default, it logs a message at a frequency of 10Hz with the
  15999. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  16000. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  16001. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  16002. sample format is double-precision floating point. The input stream will be converted to
  16003. this specification, if needed. Users may need to insert aformat and/or aresample filters
  16004. after this filter to obtain the original parameters.
  16005. The filter also has a video output (see the @var{video} option) with a real
  16006. time graph to observe the loudness evolution. The graphic contains the logged
  16007. message mentioned above, so it is not printed anymore when this option is set,
  16008. unless the verbose logging is set. The main graphing area contains the
  16009. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  16010. the momentary loudness (400 milliseconds), but can optionally be configured
  16011. to instead display short-term loudness (see @var{gauge}).
  16012. The green area marks a +/- 1LU target range around the target loudness
  16013. (-23LUFS by default, unless modified through @var{target}).
  16014. More information about the Loudness Recommendation EBU R128 on
  16015. @url{http://tech.ebu.ch/loudness}.
  16016. The filter accepts the following options:
  16017. @table @option
  16018. @item video
  16019. Activate the video output. The audio stream is passed unchanged whether this
  16020. option is set or no. The video stream will be the first output stream if
  16021. activated. Default is @code{0}.
  16022. @item size
  16023. Set the video size. This option is for video only. For the syntax of this
  16024. option, check the
  16025. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16026. Default and minimum resolution is @code{640x480}.
  16027. @item meter
  16028. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  16029. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  16030. other integer value between this range is allowed.
  16031. @item metadata
  16032. Set metadata injection. If set to @code{1}, the audio input will be segmented
  16033. into 100ms output frames, each of them containing various loudness information
  16034. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  16035. Default is @code{0}.
  16036. @item framelog
  16037. Force the frame logging level.
  16038. Available values are:
  16039. @table @samp
  16040. @item info
  16041. information logging level
  16042. @item verbose
  16043. verbose logging level
  16044. @end table
  16045. By default, the logging level is set to @var{info}. If the @option{video} or
  16046. the @option{metadata} options are set, it switches to @var{verbose}.
  16047. @item peak
  16048. Set peak mode(s).
  16049. Available modes can be cumulated (the option is a @code{flag} type). Possible
  16050. values are:
  16051. @table @samp
  16052. @item none
  16053. Disable any peak mode (default).
  16054. @item sample
  16055. Enable sample-peak mode.
  16056. Simple peak mode looking for the higher sample value. It logs a message
  16057. for sample-peak (identified by @code{SPK}).
  16058. @item true
  16059. Enable true-peak mode.
  16060. If enabled, the peak lookup is done on an over-sampled version of the input
  16061. stream for better peak accuracy. It logs a message for true-peak.
  16062. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  16063. This mode requires a build with @code{libswresample}.
  16064. @end table
  16065. @item dualmono
  16066. Treat mono input files as "dual mono". If a mono file is intended for playback
  16067. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  16068. If set to @code{true}, this option will compensate for this effect.
  16069. Multi-channel input files are not affected by this option.
  16070. @item panlaw
  16071. Set a specific pan law to be used for the measurement of dual mono files.
  16072. This parameter is optional, and has a default value of -3.01dB.
  16073. @item target
  16074. Set a specific target level (in LUFS) used as relative zero in the visualization.
  16075. This parameter is optional and has a default value of -23LUFS as specified
  16076. by EBU R128. However, material published online may prefer a level of -16LUFS
  16077. (e.g. for use with podcasts or video platforms).
  16078. @item gauge
  16079. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  16080. @code{shortterm}. By default the momentary value will be used, but in certain
  16081. scenarios it may be more useful to observe the short term value instead (e.g.
  16082. live mixing).
  16083. @item scale
  16084. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  16085. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  16086. video output, not the summary or continuous log output.
  16087. @end table
  16088. @subsection Examples
  16089. @itemize
  16090. @item
  16091. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  16092. @example
  16093. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  16094. @end example
  16095. @item
  16096. Run an analysis with @command{ffmpeg}:
  16097. @example
  16098. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  16099. @end example
  16100. @end itemize
  16101. @section interleave, ainterleave
  16102. Temporally interleave frames from several inputs.
  16103. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  16104. These filters read frames from several inputs and send the oldest
  16105. queued frame to the output.
  16106. Input streams must have well defined, monotonically increasing frame
  16107. timestamp values.
  16108. In order to submit one frame to output, these filters need to enqueue
  16109. at least one frame for each input, so they cannot work in case one
  16110. input is not yet terminated and will not receive incoming frames.
  16111. For example consider the case when one input is a @code{select} filter
  16112. which always drops input frames. The @code{interleave} filter will keep
  16113. reading from that input, but it will never be able to send new frames
  16114. to output until the input sends an end-of-stream signal.
  16115. Also, depending on inputs synchronization, the filters will drop
  16116. frames in case one input receives more frames than the other ones, and
  16117. the queue is already filled.
  16118. These filters accept the following options:
  16119. @table @option
  16120. @item nb_inputs, n
  16121. Set the number of different inputs, it is 2 by default.
  16122. @end table
  16123. @subsection Examples
  16124. @itemize
  16125. @item
  16126. Interleave frames belonging to different streams using @command{ffmpeg}:
  16127. @example
  16128. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  16129. @end example
  16130. @item
  16131. Add flickering blur effect:
  16132. @example
  16133. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  16134. @end example
  16135. @end itemize
  16136. @section metadata, ametadata
  16137. Manipulate frame metadata.
  16138. This filter accepts the following options:
  16139. @table @option
  16140. @item mode
  16141. Set mode of operation of the filter.
  16142. Can be one of the following:
  16143. @table @samp
  16144. @item select
  16145. If both @code{value} and @code{key} is set, select frames
  16146. which have such metadata. If only @code{key} is set, select
  16147. every frame that has such key in metadata.
  16148. @item add
  16149. Add new metadata @code{key} and @code{value}. If key is already available
  16150. do nothing.
  16151. @item modify
  16152. Modify value of already present key.
  16153. @item delete
  16154. If @code{value} is set, delete only keys that have such value.
  16155. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  16156. the frame.
  16157. @item print
  16158. Print key and its value if metadata was found. If @code{key} is not set print all
  16159. metadata values available in frame.
  16160. @end table
  16161. @item key
  16162. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  16163. @item value
  16164. Set metadata value which will be used. This option is mandatory for
  16165. @code{modify} and @code{add} mode.
  16166. @item function
  16167. Which function to use when comparing metadata value and @code{value}.
  16168. Can be one of following:
  16169. @table @samp
  16170. @item same_str
  16171. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  16172. @item starts_with
  16173. Values are interpreted as strings, returns true if metadata value starts with
  16174. the @code{value} option string.
  16175. @item less
  16176. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  16177. @item equal
  16178. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  16179. @item greater
  16180. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  16181. @item expr
  16182. Values are interpreted as floats, returns true if expression from option @code{expr}
  16183. evaluates to true.
  16184. @end table
  16185. @item expr
  16186. Set expression which is used when @code{function} is set to @code{expr}.
  16187. The expression is evaluated through the eval API and can contain the following
  16188. constants:
  16189. @table @option
  16190. @item VALUE1
  16191. Float representation of @code{value} from metadata key.
  16192. @item VALUE2
  16193. Float representation of @code{value} as supplied by user in @code{value} option.
  16194. @end table
  16195. @item file
  16196. If specified in @code{print} mode, output is written to the named file. Instead of
  16197. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  16198. for standard output. If @code{file} option is not set, output is written to the log
  16199. with AV_LOG_INFO loglevel.
  16200. @end table
  16201. @subsection Examples
  16202. @itemize
  16203. @item
  16204. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  16205. between 0 and 1.
  16206. @example
  16207. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  16208. @end example
  16209. @item
  16210. Print silencedetect output to file @file{metadata.txt}.
  16211. @example
  16212. silencedetect,ametadata=mode=print:file=metadata.txt
  16213. @end example
  16214. @item
  16215. Direct all metadata to a pipe with file descriptor 4.
  16216. @example
  16217. metadata=mode=print:file='pipe\:4'
  16218. @end example
  16219. @end itemize
  16220. @section perms, aperms
  16221. Set read/write permissions for the output frames.
  16222. These filters are mainly aimed at developers to test direct path in the
  16223. following filter in the filtergraph.
  16224. The filters accept the following options:
  16225. @table @option
  16226. @item mode
  16227. Select the permissions mode.
  16228. It accepts the following values:
  16229. @table @samp
  16230. @item none
  16231. Do nothing. This is the default.
  16232. @item ro
  16233. Set all the output frames read-only.
  16234. @item rw
  16235. Set all the output frames directly writable.
  16236. @item toggle
  16237. Make the frame read-only if writable, and writable if read-only.
  16238. @item random
  16239. Set each output frame read-only or writable randomly.
  16240. @end table
  16241. @item seed
  16242. Set the seed for the @var{random} mode, must be an integer included between
  16243. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  16244. @code{-1}, the filter will try to use a good random seed on a best effort
  16245. basis.
  16246. @end table
  16247. Note: in case of auto-inserted filter between the permission filter and the
  16248. following one, the permission might not be received as expected in that
  16249. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  16250. perms/aperms filter can avoid this problem.
  16251. @section realtime, arealtime
  16252. Slow down filtering to match real time approximately.
  16253. These filters will pause the filtering for a variable amount of time to
  16254. match the output rate with the input timestamps.
  16255. They are similar to the @option{re} option to @code{ffmpeg}.
  16256. They accept the following options:
  16257. @table @option
  16258. @item limit
  16259. Time limit for the pauses. Any pause longer than that will be considered
  16260. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  16261. @item speed
  16262. Speed factor for processing. The value must be a float larger than zero.
  16263. Values larger than 1.0 will result in faster than realtime processing,
  16264. smaller will slow processing down. The @var{limit} is automatically adapted
  16265. accordingly. Default is 1.0.
  16266. A processing speed faster than what is possible without these filters cannot
  16267. be achieved.
  16268. @end table
  16269. @anchor{select}
  16270. @section select, aselect
  16271. Select frames to pass in output.
  16272. This filter accepts the following options:
  16273. @table @option
  16274. @item expr, e
  16275. Set expression, which is evaluated for each input frame.
  16276. If the expression is evaluated to zero, the frame is discarded.
  16277. If the evaluation result is negative or NaN, the frame is sent to the
  16278. first output; otherwise it is sent to the output with index
  16279. @code{ceil(val)-1}, assuming that the input index starts from 0.
  16280. For example a value of @code{1.2} corresponds to the output with index
  16281. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  16282. @item outputs, n
  16283. Set the number of outputs. The output to which to send the selected
  16284. frame is based on the result of the evaluation. Default value is 1.
  16285. @end table
  16286. The expression can contain the following constants:
  16287. @table @option
  16288. @item n
  16289. The (sequential) number of the filtered frame, starting from 0.
  16290. @item selected_n
  16291. The (sequential) number of the selected frame, starting from 0.
  16292. @item prev_selected_n
  16293. The sequential number of the last selected frame. It's NAN if undefined.
  16294. @item TB
  16295. The timebase of the input timestamps.
  16296. @item pts
  16297. The PTS (Presentation TimeStamp) of the filtered video frame,
  16298. expressed in @var{TB} units. It's NAN if undefined.
  16299. @item t
  16300. The PTS of the filtered video frame,
  16301. expressed in seconds. It's NAN if undefined.
  16302. @item prev_pts
  16303. The PTS of the previously filtered video frame. It's NAN if undefined.
  16304. @item prev_selected_pts
  16305. The PTS of the last previously filtered video frame. It's NAN if undefined.
  16306. @item prev_selected_t
  16307. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  16308. @item start_pts
  16309. The PTS of the first video frame in the video. It's NAN if undefined.
  16310. @item start_t
  16311. The time of the first video frame in the video. It's NAN if undefined.
  16312. @item pict_type @emph{(video only)}
  16313. The type of the filtered frame. It can assume one of the following
  16314. values:
  16315. @table @option
  16316. @item I
  16317. @item P
  16318. @item B
  16319. @item S
  16320. @item SI
  16321. @item SP
  16322. @item BI
  16323. @end table
  16324. @item interlace_type @emph{(video only)}
  16325. The frame interlace type. It can assume one of the following values:
  16326. @table @option
  16327. @item PROGRESSIVE
  16328. The frame is progressive (not interlaced).
  16329. @item TOPFIRST
  16330. The frame is top-field-first.
  16331. @item BOTTOMFIRST
  16332. The frame is bottom-field-first.
  16333. @end table
  16334. @item consumed_sample_n @emph{(audio only)}
  16335. the number of selected samples before the current frame
  16336. @item samples_n @emph{(audio only)}
  16337. the number of samples in the current frame
  16338. @item sample_rate @emph{(audio only)}
  16339. the input sample rate
  16340. @item key
  16341. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  16342. @item pos
  16343. the position in the file of the filtered frame, -1 if the information
  16344. is not available (e.g. for synthetic video)
  16345. @item scene @emph{(video only)}
  16346. value between 0 and 1 to indicate a new scene; a low value reflects a low
  16347. probability for the current frame to introduce a new scene, while a higher
  16348. value means the current frame is more likely to be one (see the example below)
  16349. @item concatdec_select
  16350. The concat demuxer can select only part of a concat input file by setting an
  16351. inpoint and an outpoint, but the output packets may not be entirely contained
  16352. in the selected interval. By using this variable, it is possible to skip frames
  16353. generated by the concat demuxer which are not exactly contained in the selected
  16354. interval.
  16355. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  16356. and the @var{lavf.concat.duration} packet metadata values which are also
  16357. present in the decoded frames.
  16358. The @var{concatdec_select} variable is -1 if the frame pts is at least
  16359. start_time and either the duration metadata is missing or the frame pts is less
  16360. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  16361. missing.
  16362. That basically means that an input frame is selected if its pts is within the
  16363. interval set by the concat demuxer.
  16364. @end table
  16365. The default value of the select expression is "1".
  16366. @subsection Examples
  16367. @itemize
  16368. @item
  16369. Select all frames in input:
  16370. @example
  16371. select
  16372. @end example
  16373. The example above is the same as:
  16374. @example
  16375. select=1
  16376. @end example
  16377. @item
  16378. Skip all frames:
  16379. @example
  16380. select=0
  16381. @end example
  16382. @item
  16383. Select only I-frames:
  16384. @example
  16385. select='eq(pict_type\,I)'
  16386. @end example
  16387. @item
  16388. Select one frame every 100:
  16389. @example
  16390. select='not(mod(n\,100))'
  16391. @end example
  16392. @item
  16393. Select only frames contained in the 10-20 time interval:
  16394. @example
  16395. select=between(t\,10\,20)
  16396. @end example
  16397. @item
  16398. Select only I-frames contained in the 10-20 time interval:
  16399. @example
  16400. select=between(t\,10\,20)*eq(pict_type\,I)
  16401. @end example
  16402. @item
  16403. Select frames with a minimum distance of 10 seconds:
  16404. @example
  16405. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16406. @end example
  16407. @item
  16408. Use aselect to select only audio frames with samples number > 100:
  16409. @example
  16410. aselect='gt(samples_n\,100)'
  16411. @end example
  16412. @item
  16413. Create a mosaic of the first scenes:
  16414. @example
  16415. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16416. @end example
  16417. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16418. choice.
  16419. @item
  16420. Send even and odd frames to separate outputs, and compose them:
  16421. @example
  16422. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16423. @end example
  16424. @item
  16425. Select useful frames from an ffconcat file which is using inpoints and
  16426. outpoints but where the source files are not intra frame only.
  16427. @example
  16428. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16429. @end example
  16430. @end itemize
  16431. @section sendcmd, asendcmd
  16432. Send commands to filters in the filtergraph.
  16433. These filters read commands to be sent to other filters in the
  16434. filtergraph.
  16435. @code{sendcmd} must be inserted between two video filters,
  16436. @code{asendcmd} must be inserted between two audio filters, but apart
  16437. from that they act the same way.
  16438. The specification of commands can be provided in the filter arguments
  16439. with the @var{commands} option, or in a file specified by the
  16440. @var{filename} option.
  16441. These filters accept the following options:
  16442. @table @option
  16443. @item commands, c
  16444. Set the commands to be read and sent to the other filters.
  16445. @item filename, f
  16446. Set the filename of the commands to be read and sent to the other
  16447. filters.
  16448. @end table
  16449. @subsection Commands syntax
  16450. A commands description consists of a sequence of interval
  16451. specifications, comprising a list of commands to be executed when a
  16452. particular event related to that interval occurs. The occurring event
  16453. is typically the current frame time entering or leaving a given time
  16454. interval.
  16455. An interval is specified by the following syntax:
  16456. @example
  16457. @var{START}[-@var{END}] @var{COMMANDS};
  16458. @end example
  16459. The time interval is specified by the @var{START} and @var{END} times.
  16460. @var{END} is optional and defaults to the maximum time.
  16461. The current frame time is considered within the specified interval if
  16462. it is included in the interval [@var{START}, @var{END}), that is when
  16463. the time is greater or equal to @var{START} and is lesser than
  16464. @var{END}.
  16465. @var{COMMANDS} consists of a sequence of one or more command
  16466. specifications, separated by ",", relating to that interval. The
  16467. syntax of a command specification is given by:
  16468. @example
  16469. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  16470. @end example
  16471. @var{FLAGS} is optional and specifies the type of events relating to
  16472. the time interval which enable sending the specified command, and must
  16473. be a non-null sequence of identifier flags separated by "+" or "|" and
  16474. enclosed between "[" and "]".
  16475. The following flags are recognized:
  16476. @table @option
  16477. @item enter
  16478. The command is sent when the current frame timestamp enters the
  16479. specified interval. In other words, the command is sent when the
  16480. previous frame timestamp was not in the given interval, and the
  16481. current is.
  16482. @item leave
  16483. The command is sent when the current frame timestamp leaves the
  16484. specified interval. In other words, the command is sent when the
  16485. previous frame timestamp was in the given interval, and the
  16486. current is not.
  16487. @end table
  16488. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  16489. assumed.
  16490. @var{TARGET} specifies the target of the command, usually the name of
  16491. the filter class or a specific filter instance name.
  16492. @var{COMMAND} specifies the name of the command for the target filter.
  16493. @var{ARG} is optional and specifies the optional list of argument for
  16494. the given @var{COMMAND}.
  16495. Between one interval specification and another, whitespaces, or
  16496. sequences of characters starting with @code{#} until the end of line,
  16497. are ignored and can be used to annotate comments.
  16498. A simplified BNF description of the commands specification syntax
  16499. follows:
  16500. @example
  16501. @var{COMMAND_FLAG} ::= "enter" | "leave"
  16502. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  16503. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  16504. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  16505. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  16506. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  16507. @end example
  16508. @subsection Examples
  16509. @itemize
  16510. @item
  16511. Specify audio tempo change at second 4:
  16512. @example
  16513. asendcmd=c='4.0 atempo tempo 1.5',atempo
  16514. @end example
  16515. @item
  16516. Target a specific filter instance:
  16517. @example
  16518. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  16519. @end example
  16520. @item
  16521. Specify a list of drawtext and hue commands in a file.
  16522. @example
  16523. # show text in the interval 5-10
  16524. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  16525. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  16526. # desaturate the image in the interval 15-20
  16527. 15.0-20.0 [enter] hue s 0,
  16528. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  16529. [leave] hue s 1,
  16530. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  16531. # apply an exponential saturation fade-out effect, starting from time 25
  16532. 25 [enter] hue s exp(25-t)
  16533. @end example
  16534. A filtergraph allowing to read and process the above command list
  16535. stored in a file @file{test.cmd}, can be specified with:
  16536. @example
  16537. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  16538. @end example
  16539. @end itemize
  16540. @anchor{setpts}
  16541. @section setpts, asetpts
  16542. Change the PTS (presentation timestamp) of the input frames.
  16543. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  16544. This filter accepts the following options:
  16545. @table @option
  16546. @item expr
  16547. The expression which is evaluated for each frame to construct its timestamp.
  16548. @end table
  16549. The expression is evaluated through the eval API and can contain the following
  16550. constants:
  16551. @table @option
  16552. @item FRAME_RATE, FR
  16553. frame rate, only defined for constant frame-rate video
  16554. @item PTS
  16555. The presentation timestamp in input
  16556. @item N
  16557. The count of the input frame for video or the number of consumed samples,
  16558. not including the current frame for audio, starting from 0.
  16559. @item NB_CONSUMED_SAMPLES
  16560. The number of consumed samples, not including the current frame (only
  16561. audio)
  16562. @item NB_SAMPLES, S
  16563. The number of samples in the current frame (only audio)
  16564. @item SAMPLE_RATE, SR
  16565. The audio sample rate.
  16566. @item STARTPTS
  16567. The PTS of the first frame.
  16568. @item STARTT
  16569. the time in seconds of the first frame
  16570. @item INTERLACED
  16571. State whether the current frame is interlaced.
  16572. @item T
  16573. the time in seconds of the current frame
  16574. @item POS
  16575. original position in the file of the frame, or undefined if undefined
  16576. for the current frame
  16577. @item PREV_INPTS
  16578. The previous input PTS.
  16579. @item PREV_INT
  16580. previous input time in seconds
  16581. @item PREV_OUTPTS
  16582. The previous output PTS.
  16583. @item PREV_OUTT
  16584. previous output time in seconds
  16585. @item RTCTIME
  16586. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  16587. instead.
  16588. @item RTCSTART
  16589. The wallclock (RTC) time at the start of the movie in microseconds.
  16590. @item TB
  16591. The timebase of the input timestamps.
  16592. @end table
  16593. @subsection Examples
  16594. @itemize
  16595. @item
  16596. Start counting PTS from zero
  16597. @example
  16598. setpts=PTS-STARTPTS
  16599. @end example
  16600. @item
  16601. Apply fast motion effect:
  16602. @example
  16603. setpts=0.5*PTS
  16604. @end example
  16605. @item
  16606. Apply slow motion effect:
  16607. @example
  16608. setpts=2.0*PTS
  16609. @end example
  16610. @item
  16611. Set fixed rate of 25 frames per second:
  16612. @example
  16613. setpts=N/(25*TB)
  16614. @end example
  16615. @item
  16616. Set fixed rate 25 fps with some jitter:
  16617. @example
  16618. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  16619. @end example
  16620. @item
  16621. Apply an offset of 10 seconds to the input PTS:
  16622. @example
  16623. setpts=PTS+10/TB
  16624. @end example
  16625. @item
  16626. Generate timestamps from a "live source" and rebase onto the current timebase:
  16627. @example
  16628. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  16629. @end example
  16630. @item
  16631. Generate timestamps by counting samples:
  16632. @example
  16633. asetpts=N/SR/TB
  16634. @end example
  16635. @end itemize
  16636. @section setrange
  16637. Force color range for the output video frame.
  16638. The @code{setrange} filter marks the color range property for the
  16639. output frames. It does not change the input frame, but only sets the
  16640. corresponding property, which affects how the frame is treated by
  16641. following filters.
  16642. The filter accepts the following options:
  16643. @table @option
  16644. @item range
  16645. Available values are:
  16646. @table @samp
  16647. @item auto
  16648. Keep the same color range property.
  16649. @item unspecified, unknown
  16650. Set the color range as unspecified.
  16651. @item limited, tv, mpeg
  16652. Set the color range as limited.
  16653. @item full, pc, jpeg
  16654. Set the color range as full.
  16655. @end table
  16656. @end table
  16657. @section settb, asettb
  16658. Set the timebase to use for the output frames timestamps.
  16659. It is mainly useful for testing timebase configuration.
  16660. It accepts the following parameters:
  16661. @table @option
  16662. @item expr, tb
  16663. The expression which is evaluated into the output timebase.
  16664. @end table
  16665. The value for @option{tb} is an arithmetic expression representing a
  16666. rational. The expression can contain the constants "AVTB" (the default
  16667. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  16668. audio only). Default value is "intb".
  16669. @subsection Examples
  16670. @itemize
  16671. @item
  16672. Set the timebase to 1/25:
  16673. @example
  16674. settb=expr=1/25
  16675. @end example
  16676. @item
  16677. Set the timebase to 1/10:
  16678. @example
  16679. settb=expr=0.1
  16680. @end example
  16681. @item
  16682. Set the timebase to 1001/1000:
  16683. @example
  16684. settb=1+0.001
  16685. @end example
  16686. @item
  16687. Set the timebase to 2*intb:
  16688. @example
  16689. settb=2*intb
  16690. @end example
  16691. @item
  16692. Set the default timebase value:
  16693. @example
  16694. settb=AVTB
  16695. @end example
  16696. @end itemize
  16697. @section showcqt
  16698. Convert input audio to a video output representing frequency spectrum
  16699. logarithmically using Brown-Puckette constant Q transform algorithm with
  16700. direct frequency domain coefficient calculation (but the transform itself
  16701. is not really constant Q, instead the Q factor is actually variable/clamped),
  16702. with musical tone scale, from E0 to D#10.
  16703. The filter accepts the following options:
  16704. @table @option
  16705. @item size, s
  16706. Specify the video size for the output. It must be even. For the syntax of this option,
  16707. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16708. Default value is @code{1920x1080}.
  16709. @item fps, rate, r
  16710. Set the output frame rate. Default value is @code{25}.
  16711. @item bar_h
  16712. Set the bargraph height. It must be even. Default value is @code{-1} which
  16713. computes the bargraph height automatically.
  16714. @item axis_h
  16715. Set the axis height. It must be even. Default value is @code{-1} which computes
  16716. the axis height automatically.
  16717. @item sono_h
  16718. Set the sonogram height. It must be even. Default value is @code{-1} which
  16719. computes the sonogram height automatically.
  16720. @item fullhd
  16721. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  16722. instead. Default value is @code{1}.
  16723. @item sono_v, volume
  16724. Specify the sonogram volume expression. It can contain variables:
  16725. @table @option
  16726. @item bar_v
  16727. the @var{bar_v} evaluated expression
  16728. @item frequency, freq, f
  16729. the frequency where it is evaluated
  16730. @item timeclamp, tc
  16731. the value of @var{timeclamp} option
  16732. @end table
  16733. and functions:
  16734. @table @option
  16735. @item a_weighting(f)
  16736. A-weighting of equal loudness
  16737. @item b_weighting(f)
  16738. B-weighting of equal loudness
  16739. @item c_weighting(f)
  16740. C-weighting of equal loudness.
  16741. @end table
  16742. Default value is @code{16}.
  16743. @item bar_v, volume2
  16744. Specify the bargraph volume expression. It can contain variables:
  16745. @table @option
  16746. @item sono_v
  16747. the @var{sono_v} evaluated expression
  16748. @item frequency, freq, f
  16749. the frequency where it is evaluated
  16750. @item timeclamp, tc
  16751. the value of @var{timeclamp} option
  16752. @end table
  16753. and functions:
  16754. @table @option
  16755. @item a_weighting(f)
  16756. A-weighting of equal loudness
  16757. @item b_weighting(f)
  16758. B-weighting of equal loudness
  16759. @item c_weighting(f)
  16760. C-weighting of equal loudness.
  16761. @end table
  16762. Default value is @code{sono_v}.
  16763. @item sono_g, gamma
  16764. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  16765. higher gamma makes the spectrum having more range. Default value is @code{3}.
  16766. Acceptable range is @code{[1, 7]}.
  16767. @item bar_g, gamma2
  16768. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  16769. @code{[1, 7]}.
  16770. @item bar_t
  16771. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  16772. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  16773. @item timeclamp, tc
  16774. Specify the transform timeclamp. At low frequency, there is trade-off between
  16775. accuracy in time domain and frequency domain. If timeclamp is lower,
  16776. event in time domain is represented more accurately (such as fast bass drum),
  16777. otherwise event in frequency domain is represented more accurately
  16778. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  16779. @item attack
  16780. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  16781. limits future samples by applying asymmetric windowing in time domain, useful
  16782. when low latency is required. Accepted range is @code{[0, 1]}.
  16783. @item basefreq
  16784. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  16785. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  16786. @item endfreq
  16787. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  16788. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  16789. @item coeffclamp
  16790. This option is deprecated and ignored.
  16791. @item tlength
  16792. Specify the transform length in time domain. Use this option to control accuracy
  16793. trade-off between time domain and frequency domain at every frequency sample.
  16794. It can contain variables:
  16795. @table @option
  16796. @item frequency, freq, f
  16797. the frequency where it is evaluated
  16798. @item timeclamp, tc
  16799. the value of @var{timeclamp} option.
  16800. @end table
  16801. Default value is @code{384*tc/(384+tc*f)}.
  16802. @item count
  16803. Specify the transform count for every video frame. Default value is @code{6}.
  16804. Acceptable range is @code{[1, 30]}.
  16805. @item fcount
  16806. Specify the transform count for every single pixel. Default value is @code{0},
  16807. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  16808. @item fontfile
  16809. Specify font file for use with freetype to draw the axis. If not specified,
  16810. use embedded font. Note that drawing with font file or embedded font is not
  16811. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  16812. option instead.
  16813. @item font
  16814. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  16815. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  16816. @item fontcolor
  16817. Specify font color expression. This is arithmetic expression that should return
  16818. integer value 0xRRGGBB. It can contain variables:
  16819. @table @option
  16820. @item frequency, freq, f
  16821. the frequency where it is evaluated
  16822. @item timeclamp, tc
  16823. the value of @var{timeclamp} option
  16824. @end table
  16825. and functions:
  16826. @table @option
  16827. @item midi(f)
  16828. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  16829. @item r(x), g(x), b(x)
  16830. red, green, and blue value of intensity x.
  16831. @end table
  16832. Default value is @code{st(0, (midi(f)-59.5)/12);
  16833. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  16834. r(1-ld(1)) + b(ld(1))}.
  16835. @item axisfile
  16836. Specify image file to draw the axis. This option override @var{fontfile} and
  16837. @var{fontcolor} option.
  16838. @item axis, text
  16839. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  16840. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  16841. Default value is @code{1}.
  16842. @item csp
  16843. Set colorspace. The accepted values are:
  16844. @table @samp
  16845. @item unspecified
  16846. Unspecified (default)
  16847. @item bt709
  16848. BT.709
  16849. @item fcc
  16850. FCC
  16851. @item bt470bg
  16852. BT.470BG or BT.601-6 625
  16853. @item smpte170m
  16854. SMPTE-170M or BT.601-6 525
  16855. @item smpte240m
  16856. SMPTE-240M
  16857. @item bt2020ncl
  16858. BT.2020 with non-constant luminance
  16859. @end table
  16860. @item cscheme
  16861. Set spectrogram color scheme. This is list of floating point values with format
  16862. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  16863. The default is @code{1|0.5|0|0|0.5|1}.
  16864. @end table
  16865. @subsection Examples
  16866. @itemize
  16867. @item
  16868. Playing audio while showing the spectrum:
  16869. @example
  16870. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  16871. @end example
  16872. @item
  16873. Same as above, but with frame rate 30 fps:
  16874. @example
  16875. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  16876. @end example
  16877. @item
  16878. Playing at 1280x720:
  16879. @example
  16880. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  16881. @end example
  16882. @item
  16883. Disable sonogram display:
  16884. @example
  16885. sono_h=0
  16886. @end example
  16887. @item
  16888. A1 and its harmonics: A1, A2, (near)E3, A3:
  16889. @example
  16890. 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),
  16891. asplit[a][out1]; [a] showcqt [out0]'
  16892. @end example
  16893. @item
  16894. Same as above, but with more accuracy in frequency domain:
  16895. @example
  16896. 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),
  16897. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  16898. @end example
  16899. @item
  16900. Custom volume:
  16901. @example
  16902. bar_v=10:sono_v=bar_v*a_weighting(f)
  16903. @end example
  16904. @item
  16905. Custom gamma, now spectrum is linear to the amplitude.
  16906. @example
  16907. bar_g=2:sono_g=2
  16908. @end example
  16909. @item
  16910. Custom tlength equation:
  16911. @example
  16912. 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)))'
  16913. @end example
  16914. @item
  16915. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  16916. @example
  16917. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  16918. @end example
  16919. @item
  16920. Custom font using fontconfig:
  16921. @example
  16922. font='Courier New,Monospace,mono|bold'
  16923. @end example
  16924. @item
  16925. Custom frequency range with custom axis using image file:
  16926. @example
  16927. axisfile=myaxis.png:basefreq=40:endfreq=10000
  16928. @end example
  16929. @end itemize
  16930. @section showfreqs
  16931. Convert input audio to video output representing the audio power spectrum.
  16932. Audio amplitude is on Y-axis while frequency is on X-axis.
  16933. The filter accepts the following options:
  16934. @table @option
  16935. @item size, s
  16936. Specify size of video. For the syntax of this option, check the
  16937. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16938. Default is @code{1024x512}.
  16939. @item mode
  16940. Set display mode.
  16941. This set how each frequency bin will be represented.
  16942. It accepts the following values:
  16943. @table @samp
  16944. @item line
  16945. @item bar
  16946. @item dot
  16947. @end table
  16948. Default is @code{bar}.
  16949. @item ascale
  16950. Set amplitude scale.
  16951. It accepts the following values:
  16952. @table @samp
  16953. @item lin
  16954. Linear scale.
  16955. @item sqrt
  16956. Square root scale.
  16957. @item cbrt
  16958. Cubic root scale.
  16959. @item log
  16960. Logarithmic scale.
  16961. @end table
  16962. Default is @code{log}.
  16963. @item fscale
  16964. Set frequency scale.
  16965. It accepts the following values:
  16966. @table @samp
  16967. @item lin
  16968. Linear scale.
  16969. @item log
  16970. Logarithmic scale.
  16971. @item rlog
  16972. Reverse logarithmic scale.
  16973. @end table
  16974. Default is @code{lin}.
  16975. @item win_size
  16976. Set window size.
  16977. It accepts the following values:
  16978. @table @samp
  16979. @item w16
  16980. @item w32
  16981. @item w64
  16982. @item w128
  16983. @item w256
  16984. @item w512
  16985. @item w1024
  16986. @item w2048
  16987. @item w4096
  16988. @item w8192
  16989. @item w16384
  16990. @item w32768
  16991. @item w65536
  16992. @end table
  16993. Default is @code{w2048}
  16994. @item win_func
  16995. Set windowing function.
  16996. It accepts the following values:
  16997. @table @samp
  16998. @item rect
  16999. @item bartlett
  17000. @item hanning
  17001. @item hamming
  17002. @item blackman
  17003. @item welch
  17004. @item flattop
  17005. @item bharris
  17006. @item bnuttall
  17007. @item bhann
  17008. @item sine
  17009. @item nuttall
  17010. @item lanczos
  17011. @item gauss
  17012. @item tukey
  17013. @item dolph
  17014. @item cauchy
  17015. @item parzen
  17016. @item poisson
  17017. @item bohman
  17018. @end table
  17019. Default is @code{hanning}.
  17020. @item overlap
  17021. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17022. which means optimal overlap for selected window function will be picked.
  17023. @item averaging
  17024. Set time averaging. Setting this to 0 will display current maximal peaks.
  17025. Default is @code{1}, which means time averaging is disabled.
  17026. @item colors
  17027. Specify list of colors separated by space or by '|' which will be used to
  17028. draw channel frequencies. Unrecognized or missing colors will be replaced
  17029. by white color.
  17030. @item cmode
  17031. Set channel display mode.
  17032. It accepts the following values:
  17033. @table @samp
  17034. @item combined
  17035. @item separate
  17036. @end table
  17037. Default is @code{combined}.
  17038. @item minamp
  17039. Set minimum amplitude used in @code{log} amplitude scaler.
  17040. @end table
  17041. @section showspatial
  17042. Convert stereo input audio to a video output, representing the spatial relationship
  17043. between two channels.
  17044. The filter accepts the following options:
  17045. @table @option
  17046. @item size, s
  17047. Specify the video size for the output. For the syntax of this option, check the
  17048. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17049. Default value is @code{512x512}.
  17050. @item win_size
  17051. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  17052. @item win_func
  17053. Set window function.
  17054. It accepts the following values:
  17055. @table @samp
  17056. @item rect
  17057. @item bartlett
  17058. @item hann
  17059. @item hanning
  17060. @item hamming
  17061. @item blackman
  17062. @item welch
  17063. @item flattop
  17064. @item bharris
  17065. @item bnuttall
  17066. @item bhann
  17067. @item sine
  17068. @item nuttall
  17069. @item lanczos
  17070. @item gauss
  17071. @item tukey
  17072. @item dolph
  17073. @item cauchy
  17074. @item parzen
  17075. @item poisson
  17076. @item bohman
  17077. @end table
  17078. Default value is @code{hann}.
  17079. @item overlap
  17080. Set ratio of overlap window. Default value is @code{0.5}.
  17081. When value is @code{1} overlap is set to recommended size for specific
  17082. window function currently used.
  17083. @end table
  17084. @anchor{showspectrum}
  17085. @section showspectrum
  17086. Convert input audio to a video output, representing the audio frequency
  17087. spectrum.
  17088. The filter accepts the following options:
  17089. @table @option
  17090. @item size, s
  17091. Specify the video size for the output. For the syntax of this option, check the
  17092. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17093. Default value is @code{640x512}.
  17094. @item slide
  17095. Specify how the spectrum should slide along the window.
  17096. It accepts the following values:
  17097. @table @samp
  17098. @item replace
  17099. the samples start again on the left when they reach the right
  17100. @item scroll
  17101. the samples scroll from right to left
  17102. @item fullframe
  17103. frames are only produced when the samples reach the right
  17104. @item rscroll
  17105. the samples scroll from left to right
  17106. @end table
  17107. Default value is @code{replace}.
  17108. @item mode
  17109. Specify display mode.
  17110. It accepts the following values:
  17111. @table @samp
  17112. @item combined
  17113. all channels are displayed in the same row
  17114. @item separate
  17115. all channels are displayed in separate rows
  17116. @end table
  17117. Default value is @samp{combined}.
  17118. @item color
  17119. Specify display color mode.
  17120. It accepts the following values:
  17121. @table @samp
  17122. @item channel
  17123. each channel is displayed in a separate color
  17124. @item intensity
  17125. each channel is displayed using the same color scheme
  17126. @item rainbow
  17127. each channel is displayed using the rainbow color scheme
  17128. @item moreland
  17129. each channel is displayed using the moreland color scheme
  17130. @item nebulae
  17131. each channel is displayed using the nebulae color scheme
  17132. @item fire
  17133. each channel is displayed using the fire color scheme
  17134. @item fiery
  17135. each channel is displayed using the fiery color scheme
  17136. @item fruit
  17137. each channel is displayed using the fruit color scheme
  17138. @item cool
  17139. each channel is displayed using the cool color scheme
  17140. @item magma
  17141. each channel is displayed using the magma color scheme
  17142. @item green
  17143. each channel is displayed using the green color scheme
  17144. @item viridis
  17145. each channel is displayed using the viridis color scheme
  17146. @item plasma
  17147. each channel is displayed using the plasma color scheme
  17148. @item cividis
  17149. each channel is displayed using the cividis color scheme
  17150. @item terrain
  17151. each channel is displayed using the terrain color scheme
  17152. @end table
  17153. Default value is @samp{channel}.
  17154. @item scale
  17155. Specify scale used for calculating intensity color values.
  17156. It accepts the following values:
  17157. @table @samp
  17158. @item lin
  17159. linear
  17160. @item sqrt
  17161. square root, default
  17162. @item cbrt
  17163. cubic root
  17164. @item log
  17165. logarithmic
  17166. @item 4thrt
  17167. 4th root
  17168. @item 5thrt
  17169. 5th root
  17170. @end table
  17171. Default value is @samp{sqrt}.
  17172. @item fscale
  17173. Specify frequency scale.
  17174. It accepts the following values:
  17175. @table @samp
  17176. @item lin
  17177. linear
  17178. @item log
  17179. logarithmic
  17180. @end table
  17181. Default value is @samp{lin}.
  17182. @item saturation
  17183. Set saturation modifier for displayed colors. Negative values provide
  17184. alternative color scheme. @code{0} is no saturation at all.
  17185. Saturation must be in [-10.0, 10.0] range.
  17186. Default value is @code{1}.
  17187. @item win_func
  17188. Set window function.
  17189. It accepts the following values:
  17190. @table @samp
  17191. @item rect
  17192. @item bartlett
  17193. @item hann
  17194. @item hanning
  17195. @item hamming
  17196. @item blackman
  17197. @item welch
  17198. @item flattop
  17199. @item bharris
  17200. @item bnuttall
  17201. @item bhann
  17202. @item sine
  17203. @item nuttall
  17204. @item lanczos
  17205. @item gauss
  17206. @item tukey
  17207. @item dolph
  17208. @item cauchy
  17209. @item parzen
  17210. @item poisson
  17211. @item bohman
  17212. @end table
  17213. Default value is @code{hann}.
  17214. @item orientation
  17215. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17216. @code{horizontal}. Default is @code{vertical}.
  17217. @item overlap
  17218. Set ratio of overlap window. Default value is @code{0}.
  17219. When value is @code{1} overlap is set to recommended size for specific
  17220. window function currently used.
  17221. @item gain
  17222. Set scale gain for calculating intensity color values.
  17223. Default value is @code{1}.
  17224. @item data
  17225. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  17226. @item rotation
  17227. Set color rotation, must be in [-1.0, 1.0] range.
  17228. Default value is @code{0}.
  17229. @item start
  17230. Set start frequency from which to display spectrogram. Default is @code{0}.
  17231. @item stop
  17232. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17233. @item fps
  17234. Set upper frame rate limit. Default is @code{auto}, unlimited.
  17235. @item legend
  17236. Draw time and frequency axes and legends. Default is disabled.
  17237. @end table
  17238. The usage is very similar to the showwaves filter; see the examples in that
  17239. section.
  17240. @subsection Examples
  17241. @itemize
  17242. @item
  17243. Large window with logarithmic color scaling:
  17244. @example
  17245. showspectrum=s=1280x480:scale=log
  17246. @end example
  17247. @item
  17248. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  17249. @example
  17250. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17251. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  17252. @end example
  17253. @end itemize
  17254. @section showspectrumpic
  17255. Convert input audio to a single video frame, representing the audio frequency
  17256. spectrum.
  17257. The filter accepts the following options:
  17258. @table @option
  17259. @item size, s
  17260. Specify the video size for the output. For the syntax of this option, check the
  17261. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17262. Default value is @code{4096x2048}.
  17263. @item mode
  17264. Specify display mode.
  17265. It accepts the following values:
  17266. @table @samp
  17267. @item combined
  17268. all channels are displayed in the same row
  17269. @item separate
  17270. all channels are displayed in separate rows
  17271. @end table
  17272. Default value is @samp{combined}.
  17273. @item color
  17274. Specify display color mode.
  17275. It accepts the following values:
  17276. @table @samp
  17277. @item channel
  17278. each channel is displayed in a separate color
  17279. @item intensity
  17280. each channel is displayed using the same color scheme
  17281. @item rainbow
  17282. each channel is displayed using the rainbow color scheme
  17283. @item moreland
  17284. each channel is displayed using the moreland color scheme
  17285. @item nebulae
  17286. each channel is displayed using the nebulae color scheme
  17287. @item fire
  17288. each channel is displayed using the fire color scheme
  17289. @item fiery
  17290. each channel is displayed using the fiery color scheme
  17291. @item fruit
  17292. each channel is displayed using the fruit color scheme
  17293. @item cool
  17294. each channel is displayed using the cool color scheme
  17295. @item magma
  17296. each channel is displayed using the magma color scheme
  17297. @item green
  17298. each channel is displayed using the green color scheme
  17299. @item viridis
  17300. each channel is displayed using the viridis color scheme
  17301. @item plasma
  17302. each channel is displayed using the plasma color scheme
  17303. @item cividis
  17304. each channel is displayed using the cividis color scheme
  17305. @item terrain
  17306. each channel is displayed using the terrain color scheme
  17307. @end table
  17308. Default value is @samp{intensity}.
  17309. @item scale
  17310. Specify scale used for calculating intensity color values.
  17311. It accepts the following values:
  17312. @table @samp
  17313. @item lin
  17314. linear
  17315. @item sqrt
  17316. square root, default
  17317. @item cbrt
  17318. cubic root
  17319. @item log
  17320. logarithmic
  17321. @item 4thrt
  17322. 4th root
  17323. @item 5thrt
  17324. 5th root
  17325. @end table
  17326. Default value is @samp{log}.
  17327. @item fscale
  17328. Specify frequency scale.
  17329. It accepts the following values:
  17330. @table @samp
  17331. @item lin
  17332. linear
  17333. @item log
  17334. logarithmic
  17335. @end table
  17336. Default value is @samp{lin}.
  17337. @item saturation
  17338. Set saturation modifier for displayed colors. Negative values provide
  17339. alternative color scheme. @code{0} is no saturation at all.
  17340. Saturation must be in [-10.0, 10.0] range.
  17341. Default value is @code{1}.
  17342. @item win_func
  17343. Set window function.
  17344. It accepts the following values:
  17345. @table @samp
  17346. @item rect
  17347. @item bartlett
  17348. @item hann
  17349. @item hanning
  17350. @item hamming
  17351. @item blackman
  17352. @item welch
  17353. @item flattop
  17354. @item bharris
  17355. @item bnuttall
  17356. @item bhann
  17357. @item sine
  17358. @item nuttall
  17359. @item lanczos
  17360. @item gauss
  17361. @item tukey
  17362. @item dolph
  17363. @item cauchy
  17364. @item parzen
  17365. @item poisson
  17366. @item bohman
  17367. @end table
  17368. Default value is @code{hann}.
  17369. @item orientation
  17370. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17371. @code{horizontal}. Default is @code{vertical}.
  17372. @item gain
  17373. Set scale gain for calculating intensity color values.
  17374. Default value is @code{1}.
  17375. @item legend
  17376. Draw time and frequency axes and legends. Default is enabled.
  17377. @item rotation
  17378. Set color rotation, must be in [-1.0, 1.0] range.
  17379. Default value is @code{0}.
  17380. @item start
  17381. Set start frequency from which to display spectrogram. Default is @code{0}.
  17382. @item stop
  17383. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17384. @end table
  17385. @subsection Examples
  17386. @itemize
  17387. @item
  17388. Extract an audio spectrogram of a whole audio track
  17389. in a 1024x1024 picture using @command{ffmpeg}:
  17390. @example
  17391. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  17392. @end example
  17393. @end itemize
  17394. @section showvolume
  17395. Convert input audio volume to a video output.
  17396. The filter accepts the following options:
  17397. @table @option
  17398. @item rate, r
  17399. Set video rate.
  17400. @item b
  17401. Set border width, allowed range is [0, 5]. Default is 1.
  17402. @item w
  17403. Set channel width, allowed range is [80, 8192]. Default is 400.
  17404. @item h
  17405. Set channel height, allowed range is [1, 900]. Default is 20.
  17406. @item f
  17407. Set fade, allowed range is [0, 1]. Default is 0.95.
  17408. @item c
  17409. Set volume color expression.
  17410. The expression can use the following variables:
  17411. @table @option
  17412. @item VOLUME
  17413. Current max volume of channel in dB.
  17414. @item PEAK
  17415. Current peak.
  17416. @item CHANNEL
  17417. Current channel number, starting from 0.
  17418. @end table
  17419. @item t
  17420. If set, displays channel names. Default is enabled.
  17421. @item v
  17422. If set, displays volume values. Default is enabled.
  17423. @item o
  17424. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  17425. default is @code{h}.
  17426. @item s
  17427. Set step size, allowed range is [0, 5]. Default is 0, which means
  17428. step is disabled.
  17429. @item p
  17430. Set background opacity, allowed range is [0, 1]. Default is 0.
  17431. @item m
  17432. Set metering mode, can be peak: @code{p} or rms: @code{r},
  17433. default is @code{p}.
  17434. @item ds
  17435. Set display scale, can be linear: @code{lin} or log: @code{log},
  17436. default is @code{lin}.
  17437. @item dm
  17438. In second.
  17439. If set to > 0., display a line for the max level
  17440. in the previous seconds.
  17441. default is disabled: @code{0.}
  17442. @item dmc
  17443. The color of the max line. Use when @code{dm} option is set to > 0.
  17444. default is: @code{orange}
  17445. @end table
  17446. @section showwaves
  17447. Convert input audio to a video output, representing the samples waves.
  17448. The filter accepts the following options:
  17449. @table @option
  17450. @item size, s
  17451. Specify the video size for the output. For the syntax of this option, check the
  17452. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17453. Default value is @code{600x240}.
  17454. @item mode
  17455. Set display mode.
  17456. Available values are:
  17457. @table @samp
  17458. @item point
  17459. Draw a point for each sample.
  17460. @item line
  17461. Draw a vertical line for each sample.
  17462. @item p2p
  17463. Draw a point for each sample and a line between them.
  17464. @item cline
  17465. Draw a centered vertical line for each sample.
  17466. @end table
  17467. Default value is @code{point}.
  17468. @item n
  17469. Set the number of samples which are printed on the same column. A
  17470. larger value will decrease the frame rate. Must be a positive
  17471. integer. This option can be set only if the value for @var{rate}
  17472. is not explicitly specified.
  17473. @item rate, r
  17474. Set the (approximate) output frame rate. This is done by setting the
  17475. option @var{n}. Default value is "25".
  17476. @item split_channels
  17477. Set if channels should be drawn separately or overlap. Default value is 0.
  17478. @item colors
  17479. Set colors separated by '|' which are going to be used for drawing of each channel.
  17480. @item scale
  17481. Set amplitude scale.
  17482. Available values are:
  17483. @table @samp
  17484. @item lin
  17485. Linear.
  17486. @item log
  17487. Logarithmic.
  17488. @item sqrt
  17489. Square root.
  17490. @item cbrt
  17491. Cubic root.
  17492. @end table
  17493. Default is linear.
  17494. @item draw
  17495. Set the draw mode. This is mostly useful to set for high @var{n}.
  17496. Available values are:
  17497. @table @samp
  17498. @item scale
  17499. Scale pixel values for each drawn sample.
  17500. @item full
  17501. Draw every sample directly.
  17502. @end table
  17503. Default value is @code{scale}.
  17504. @end table
  17505. @subsection Examples
  17506. @itemize
  17507. @item
  17508. Output the input file audio and the corresponding video representation
  17509. at the same time:
  17510. @example
  17511. amovie=a.mp3,asplit[out0],showwaves[out1]
  17512. @end example
  17513. @item
  17514. Create a synthetic signal and show it with showwaves, forcing a
  17515. frame rate of 30 frames per second:
  17516. @example
  17517. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  17518. @end example
  17519. @end itemize
  17520. @section showwavespic
  17521. Convert input audio to a single video frame, representing the samples waves.
  17522. The filter accepts the following options:
  17523. @table @option
  17524. @item size, s
  17525. Specify the video size for the output. For the syntax of this option, check the
  17526. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17527. Default value is @code{600x240}.
  17528. @item split_channels
  17529. Set if channels should be drawn separately or overlap. Default value is 0.
  17530. @item colors
  17531. Set colors separated by '|' which are going to be used for drawing of each channel.
  17532. @item scale
  17533. Set amplitude scale.
  17534. Available values are:
  17535. @table @samp
  17536. @item lin
  17537. Linear.
  17538. @item log
  17539. Logarithmic.
  17540. @item sqrt
  17541. Square root.
  17542. @item cbrt
  17543. Cubic root.
  17544. @end table
  17545. Default is linear.
  17546. @item draw
  17547. Set the draw mode.
  17548. Available values are:
  17549. @table @samp
  17550. @item scale
  17551. Scale pixel values for each drawn sample.
  17552. @item full
  17553. Draw every sample directly.
  17554. @end table
  17555. Default value is @code{scale}.
  17556. @end table
  17557. @subsection Examples
  17558. @itemize
  17559. @item
  17560. Extract a channel split representation of the wave form of a whole audio track
  17561. in a 1024x800 picture using @command{ffmpeg}:
  17562. @example
  17563. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  17564. @end example
  17565. @end itemize
  17566. @section sidedata, asidedata
  17567. Delete frame side data, or select frames based on it.
  17568. This filter accepts the following options:
  17569. @table @option
  17570. @item mode
  17571. Set mode of operation of the filter.
  17572. Can be one of the following:
  17573. @table @samp
  17574. @item select
  17575. Select every frame with side data of @code{type}.
  17576. @item delete
  17577. Delete side data of @code{type}. If @code{type} is not set, delete all side
  17578. data in the frame.
  17579. @end table
  17580. @item type
  17581. Set side data type used with all modes. Must be set for @code{select} mode. For
  17582. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  17583. in @file{libavutil/frame.h}. For example, to choose
  17584. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  17585. @end table
  17586. @section spectrumsynth
  17587. Sythesize audio from 2 input video spectrums, first input stream represents
  17588. magnitude across time and second represents phase across time.
  17589. The filter will transform from frequency domain as displayed in videos back
  17590. to time domain as presented in audio output.
  17591. This filter is primarily created for reversing processed @ref{showspectrum}
  17592. filter outputs, but can synthesize sound from other spectrograms too.
  17593. But in such case results are going to be poor if the phase data is not
  17594. available, because in such cases phase data need to be recreated, usually
  17595. it's just recreated from random noise.
  17596. For best results use gray only output (@code{channel} color mode in
  17597. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  17598. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  17599. @code{data} option. Inputs videos should generally use @code{fullframe}
  17600. slide mode as that saves resources needed for decoding video.
  17601. The filter accepts the following options:
  17602. @table @option
  17603. @item sample_rate
  17604. Specify sample rate of output audio, the sample rate of audio from which
  17605. spectrum was generated may differ.
  17606. @item channels
  17607. Set number of channels represented in input video spectrums.
  17608. @item scale
  17609. Set scale which was used when generating magnitude input spectrum.
  17610. Can be @code{lin} or @code{log}. Default is @code{log}.
  17611. @item slide
  17612. Set slide which was used when generating inputs spectrums.
  17613. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  17614. Default is @code{fullframe}.
  17615. @item win_func
  17616. Set window function used for resynthesis.
  17617. @item overlap
  17618. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17619. which means optimal overlap for selected window function will be picked.
  17620. @item orientation
  17621. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  17622. Default is @code{vertical}.
  17623. @end table
  17624. @subsection Examples
  17625. @itemize
  17626. @item
  17627. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  17628. then resynthesize videos back to audio with spectrumsynth:
  17629. @example
  17630. 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
  17631. 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
  17632. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  17633. @end example
  17634. @end itemize
  17635. @section split, asplit
  17636. Split input into several identical outputs.
  17637. @code{asplit} works with audio input, @code{split} with video.
  17638. The filter accepts a single parameter which specifies the number of outputs. If
  17639. unspecified, it defaults to 2.
  17640. @subsection Examples
  17641. @itemize
  17642. @item
  17643. Create two separate outputs from the same input:
  17644. @example
  17645. [in] split [out0][out1]
  17646. @end example
  17647. @item
  17648. To create 3 or more outputs, you need to specify the number of
  17649. outputs, like in:
  17650. @example
  17651. [in] asplit=3 [out0][out1][out2]
  17652. @end example
  17653. @item
  17654. Create two separate outputs from the same input, one cropped and
  17655. one padded:
  17656. @example
  17657. [in] split [splitout1][splitout2];
  17658. [splitout1] crop=100:100:0:0 [cropout];
  17659. [splitout2] pad=200:200:100:100 [padout];
  17660. @end example
  17661. @item
  17662. Create 5 copies of the input audio with @command{ffmpeg}:
  17663. @example
  17664. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  17665. @end example
  17666. @end itemize
  17667. @section zmq, azmq
  17668. Receive commands sent through a libzmq client, and forward them to
  17669. filters in the filtergraph.
  17670. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  17671. must be inserted between two video filters, @code{azmq} between two
  17672. audio filters. Both are capable to send messages to any filter type.
  17673. To enable these filters you need to install the libzmq library and
  17674. headers and configure FFmpeg with @code{--enable-libzmq}.
  17675. For more information about libzmq see:
  17676. @url{http://www.zeromq.org/}
  17677. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  17678. receives messages sent through a network interface defined by the
  17679. @option{bind_address} (or the abbreviation "@option{b}") option.
  17680. Default value of this option is @file{tcp://localhost:5555}. You may
  17681. want to alter this value to your needs, but do not forget to escape any
  17682. ':' signs (see @ref{filtergraph escaping}).
  17683. The received message must be in the form:
  17684. @example
  17685. @var{TARGET} @var{COMMAND} [@var{ARG}]
  17686. @end example
  17687. @var{TARGET} specifies the target of the command, usually the name of
  17688. the filter class or a specific filter instance name. The default
  17689. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  17690. but you can override this by using the @samp{filter_name@@id} syntax
  17691. (see @ref{Filtergraph syntax}).
  17692. @var{COMMAND} specifies the name of the command for the target filter.
  17693. @var{ARG} is optional and specifies the optional argument list for the
  17694. given @var{COMMAND}.
  17695. Upon reception, the message is processed and the corresponding command
  17696. is injected into the filtergraph. Depending on the result, the filter
  17697. will send a reply to the client, adopting the format:
  17698. @example
  17699. @var{ERROR_CODE} @var{ERROR_REASON}
  17700. @var{MESSAGE}
  17701. @end example
  17702. @var{MESSAGE} is optional.
  17703. @subsection Examples
  17704. Look at @file{tools/zmqsend} for an example of a zmq client which can
  17705. be used to send commands processed by these filters.
  17706. Consider the following filtergraph generated by @command{ffplay}.
  17707. In this example the last overlay filter has an instance name. All other
  17708. filters will have default instance names.
  17709. @example
  17710. ffplay -dumpgraph 1 -f lavfi "
  17711. color=s=100x100:c=red [l];
  17712. color=s=100x100:c=blue [r];
  17713. nullsrc=s=200x100, zmq [bg];
  17714. [bg][l] overlay [bg+l];
  17715. [bg+l][r] overlay@@my=x=100 "
  17716. @end example
  17717. To change the color of the left side of the video, the following
  17718. command can be used:
  17719. @example
  17720. echo Parsed_color_0 c yellow | tools/zmqsend
  17721. @end example
  17722. To change the right side:
  17723. @example
  17724. echo Parsed_color_1 c pink | tools/zmqsend
  17725. @end example
  17726. To change the position of the right side:
  17727. @example
  17728. echo overlay@@my x 150 | tools/zmqsend
  17729. @end example
  17730. @c man end MULTIMEDIA FILTERS
  17731. @chapter Multimedia Sources
  17732. @c man begin MULTIMEDIA SOURCES
  17733. Below is a description of the currently available multimedia sources.
  17734. @section amovie
  17735. This is the same as @ref{movie} source, except it selects an audio
  17736. stream by default.
  17737. @anchor{movie}
  17738. @section movie
  17739. Read audio and/or video stream(s) from a movie container.
  17740. It accepts the following parameters:
  17741. @table @option
  17742. @item filename
  17743. The name of the resource to read (not necessarily a file; it can also be a
  17744. device or a stream accessed through some protocol).
  17745. @item format_name, f
  17746. Specifies the format assumed for the movie to read, and can be either
  17747. the name of a container or an input device. If not specified, the
  17748. format is guessed from @var{movie_name} or by probing.
  17749. @item seek_point, sp
  17750. Specifies the seek point in seconds. The frames will be output
  17751. starting from this seek point. The parameter is evaluated with
  17752. @code{av_strtod}, so the numerical value may be suffixed by an IS
  17753. postfix. The default value is "0".
  17754. @item streams, s
  17755. Specifies the streams to read. Several streams can be specified,
  17756. separated by "+". The source will then have as many outputs, in the
  17757. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  17758. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  17759. respectively the default (best suited) video and audio stream. Default
  17760. is "dv", or "da" if the filter is called as "amovie".
  17761. @item stream_index, si
  17762. Specifies the index of the video stream to read. If the value is -1,
  17763. the most suitable video stream will be automatically selected. The default
  17764. value is "-1". Deprecated. If the filter is called "amovie", it will select
  17765. audio instead of video.
  17766. @item loop
  17767. Specifies how many times to read the stream in sequence.
  17768. If the value is 0, the stream will be looped infinitely.
  17769. Default value is "1".
  17770. Note that when the movie is looped the source timestamps are not
  17771. changed, so it will generate non monotonically increasing timestamps.
  17772. @item discontinuity
  17773. Specifies the time difference between frames above which the point is
  17774. considered a timestamp discontinuity which is removed by adjusting the later
  17775. timestamps.
  17776. @end table
  17777. It allows overlaying a second video on top of the main input of
  17778. a filtergraph, as shown in this graph:
  17779. @example
  17780. input -----------> deltapts0 --> overlay --> output
  17781. ^
  17782. |
  17783. movie --> scale--> deltapts1 -------+
  17784. @end example
  17785. @subsection Examples
  17786. @itemize
  17787. @item
  17788. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  17789. on top of the input labelled "in":
  17790. @example
  17791. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17792. [in] setpts=PTS-STARTPTS [main];
  17793. [main][over] overlay=16:16 [out]
  17794. @end example
  17795. @item
  17796. Read from a video4linux2 device, and overlay it on top of the input
  17797. labelled "in":
  17798. @example
  17799. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17800. [in] setpts=PTS-STARTPTS [main];
  17801. [main][over] overlay=16:16 [out]
  17802. @end example
  17803. @item
  17804. Read the first video stream and the audio stream with id 0x81 from
  17805. dvd.vob; the video is connected to the pad named "video" and the audio is
  17806. connected to the pad named "audio":
  17807. @example
  17808. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  17809. @end example
  17810. @end itemize
  17811. @subsection Commands
  17812. Both movie and amovie support the following commands:
  17813. @table @option
  17814. @item seek
  17815. Perform seek using "av_seek_frame".
  17816. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  17817. @itemize
  17818. @item
  17819. @var{stream_index}: If stream_index is -1, a default
  17820. stream is selected, and @var{timestamp} is automatically converted
  17821. from AV_TIME_BASE units to the stream specific time_base.
  17822. @item
  17823. @var{timestamp}: Timestamp in AVStream.time_base units
  17824. or, if no stream is specified, in AV_TIME_BASE units.
  17825. @item
  17826. @var{flags}: Flags which select direction and seeking mode.
  17827. @end itemize
  17828. @item get_duration
  17829. Get movie duration in AV_TIME_BASE units.
  17830. @end table
  17831. @c man end MULTIMEDIA SOURCES